-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cabb12a
commit 5e253b9
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
-- Initialize variables | ||
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) |