Hi, I'm creating a SQL-based currency system script, I put a setTime to generate coins at a certain time for certain players, however, I need to destroy this setTime when the player clears, I already did something to do that, However, when the player clears and setTime is destroyed, everyone's time is destroyed, not just the user who logged out. I need that when certain user is logged off, only his setTime is canceled ... does anyone have any idea what I can do?
Starting time:
function startFunction(_,thePlayer)
tempo = setTimer ( function()
...code...
end, 2000, 0 )
end
Destroy time:
function playerOff(thePlayer)
...code...
if isTimer ( tempo ) then
killTimer ( tempo )
end
end
addEventHandler("onPlayerQuit", getRootElement(), playerOff)
addEventHandler("onPlayerLogout", getRootElement(), playerOff)