diff --git a/client/jumpcooldown b/client/jumpcooldown new file mode 100644 index 00000000..53fd7181 --- /dev/null +++ b/client/jumpcooldown @@ -0,0 +1,50 @@ +-- Initialize variables +local jumpCooldown = false +local cooldownTime = Config.jumpCooldown + +-- 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) + + local playerPed = PlayerPedId() + local isAiming = IsControlPressed(0, 25) + local isInVehicle = IsPedInAnyVehicle(playerPed, false) + if not isAiming and not isInVehicle then + if IsControlJustPressed(0, 22) then + if not jumpCooldown then + TaskJump(playerPed) + startJumpCooldown() + end + end + else + end + end +end) + +-- Disable the default jump when cooldown is active +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + + local playerPed = PlayerPedId() + local isAiming = IsControlPressed(0, 25) + local isInVehicle = IsPedInAnyVehicle(playerPed, false) + if not isAiming and not isInVehicle then + if jumpCooldown then + DisableControlAction(0, 22, true) + end + else + EnableControlAction(0, 22, true) + end + end +end) 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 = {