From 51783acb82ae98403f43c66ed2c924c2cb5ed2a3 Mon Sep 17 00:00:00 2001 From: Monarch Matrix <166127356+monarchmatrix@users.noreply.github.com> Date: Tue, 27 Aug 2024 01:10:34 +0530 Subject: [PATCH 1/3] Create jumpcooldown.lua Added a small cooldown on jumping as people abuse it to run faster when player gets out of Stamina. --- client/jumpcooldown.lua | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 client/jumpcooldown.lua diff --git a/client/jumpcooldown.lua b/client/jumpcooldown.lua new file mode 100644 index 00000000..d9d15cd7 --- /dev/null +++ b/client/jumpcooldown.lua @@ -0,0 +1,35 @@ +-- Initialize variables +local jumpCooldown = false +local cooldownTime = 10 -- Cooldown time in seconds + +-- Cooldown function +local function startJumpCooldown() + jumpCooldown = true + Citizen.CreateThread(function() + Citizen.Wait(cooldownTime * 1000) + jumpCooldown = false + end) +end + +-- Main thread to handle jump key +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + if IsControlJustPressed(0, 22) then + if not jumpCooldown then + TaskJump(PlayerPedId()) + startJumpCooldown() + end + end + end +end) + +-- Disable the default jump when cooldown is active +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + if jumpCooldown then + DisableControlAction(0, 22, true) + end + end +end) From 633e1fab7cb72c4b728d1a7fde1a12721bcfb0cb Mon Sep 17 00:00:00 2001 From: Monarch Matrix <166127356+monarchmatrix@users.noreply.github.com> Date: Tue, 27 Aug 2024 02:12:54 +0530 Subject: [PATCH 2/3] Update jumpcooldown.lua --- client/jumpcooldown.lua | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/client/jumpcooldown.lua b/client/jumpcooldown.lua index d9d15cd7..0ce22531 100644 --- a/client/jumpcooldown.lua +++ b/client/jumpcooldown.lua @@ -1,12 +1,13 @@ -- Initialize variables +local QBCore = exports['qb-core']:GetCoreObject() local jumpCooldown = false -local cooldownTime = 10 -- Cooldown time in seconds +local cooldownTime = Config.jumpCooldown -- Cooldown function local function startJumpCooldown() jumpCooldown = true Citizen.CreateThread(function() - Citizen.Wait(cooldownTime * 1000) + Citizen.Wait(cooldownTime * 1000) -- Wait for the cooldown time jumpCooldown = false end) end @@ -15,11 +16,14 @@ end Citizen.CreateThread(function() while true do Citizen.Wait(0) - if IsControlJustPressed(0, 22) then - if not jumpCooldown then - TaskJump(PlayerPedId()) - startJumpCooldown() + if not IsControlPressed(0, 25) then + if IsControlJustPressed(0, 22) then + if not jumpCooldown then + TaskJump(PlayerPedId()) + startJumpCooldown() + end end + else end end end) @@ -28,8 +32,12 @@ end) Citizen.CreateThread(function() while true do Citizen.Wait(0) - if jumpCooldown then - DisableControlAction(0, 22, true) + if not IsControlPressed(0, 25) then + if jumpCooldown then + DisableControlAction(0, 22, true) + end + else + EnableControlAction(0, 22, true) end end end) From b5be38d5f0f9138a8ecd17cfe3b1deb6da21be26 Mon Sep 17 00:00:00 2001 From: Monarch Matrix <166127356+monarchmatrix@users.noreply.github.com> Date: Tue, 27 Aug 2024 02:13:38 +0530 Subject: [PATCH 3/3] Update config.lua --- config.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/config.lua b/config.lua index f204df42..8c141c8b 100644 --- a/config.lua +++ b/config.lua @@ -5,6 +5,7 @@ Config.PauseMapText = '' -- Text shown above Config.HarnessUses = 20 Config.DamageNeeded = 100.0 -- amount of damage till you can push your vehicle. 0-1000 Config.Logging = 'discord' -- fivemanage +Config.jumpCooldown = 7 -- in seconds Config.AFK = { ignoredGroups = {