Skip to content

Commit

Permalink
fix(client/tackle): proper timeout (#40)
Browse files Browse the repository at this point in the history
* Update tackle.lua

Moved:

 SetTimeout(1000, function ()
                self:disable(false) 

to make it stop the tackle function. When outside it was running multiple threads as many times as the tackle key was pressed.

* Update tackle.lua

* Update tackle.lua

* Update tackle.lua

fixed spacing
  • Loading branch information
alberttheprince authored Oct 10, 2023
1 parent c1209e6 commit 617e689
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions client/tackle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ lib.addKeybind({
defaultKey = 'E',
onReleased = function(self)
if cache.vehicle then return end
if QBX.PlayerData.metadata.ishandcuffed then return end
if IsPedSprinting(cache.ped) or IsPedRunning(cache.ped) then
if QBX.PlayerData.metadata.ishandcuffed then return end
if IsPedSprinting(cache.ped) or IsPedRunning(cache.ped) then
local coords = GetEntityCoords(cache.ped)
local targetId, targetPed, _ = lib.getClosestPlayer(coords, 1.6, false)
if not targetPed then return end
Expand All @@ -18,10 +18,10 @@ lib.addKeybind({
ClearPedTasks(cache.ped)
SetPedToRagdoll(cache.ped, 150, 150, 0, 0, 0, 0)
RemoveAnimDict('swimming@first_person@diving')
SetTimeout(1000, function ()
self:disable(false)
end)
end
SetTimeout(10000, function ()
self:disable(false)
end)
end
})

Expand Down

0 comments on commit 617e689

Please sign in to comment.