diff --git a/client/jumpcooldown.lua b/client/jumpcooldown.lua new file mode 100644 index 00000000..0ce22531 --- /dev/null +++ b/client/jumpcooldown.lua @@ -0,0 +1,43 @@ +-- Initialize variables +local QBCore = exports['qb-core']:GetCoreObject() +local jumpCooldown = false +local cooldownTime = Config.jumpCooldown + +-- Cooldown function +local function startJumpCooldown() + jumpCooldown = true + Citizen.CreateThread(function() + Citizen.Wait(cooldownTime * 1000) -- Wait for the cooldown time + jumpCooldown = false + end) +end + +-- Main thread to handle jump key +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + if not IsControlPressed(0, 25) then + if IsControlJustPressed(0, 22) then + if not jumpCooldown then + TaskJump(PlayerPedId()) + startJumpCooldown() + end + end + else + end + end +end) + +-- Disable the default jump when cooldown is active +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + if not IsControlPressed(0, 25) 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 = {