Skip to content

Commit

Permalink
Update jumpcooldown
Browse files Browse the repository at this point in the history
  • Loading branch information
monarchmatrix authored Aug 26, 2024
1 parent 8561a39 commit 9be4c6d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions client/jumpcooldown
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local cooldownTime = Config.jumpCooldown
local function startJumpCooldown()
jumpCooldown = true
Citizen.CreateThread(function()
Citizen.Wait(cooldownTime * 1000) -- Wait for the cooldown time
Citizen.Wait(cooldownTime * 1000)
jumpCooldown = false
end)
end
Expand All @@ -15,10 +15,14 @@ end
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if not IsControlPressed(0, 25) then

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(PlayerPedId())
TaskJump(playerPed)
startJumpCooldown()
end
end
Expand All @@ -31,7 +35,11 @@ end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if not IsControlPressed(0, 25) then

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
Expand Down

0 comments on commit 9be4c6d

Please sign in to comment.