SA-MP Mobile

SA-MP Scripting and Plugins => Scripting Help => Discussion => Topic started by: SA:MP on May 05, 2023, 08:51 AM

Title: Serious Discussion about TIMERS!
Post by: SA:MP on May 05, 2023, 08:51 AM
Serious Discussion about TIMERS!

Hello everyone, I really want to do something like this:


Code:

public OnPlayerConnect(playerid)
{
SetTimerEx(funcname[], 650, true:flag, "d", playerid);
//Example:
SetTimerEx(funcname[], 650, true:AUTO_KILL_ON_PLAYER_DISCONNECT, "d", playerid);
return 1;
}

I'm really wondering how can I make timer that kills when player disconnect in this case?

I know that i can create some custom function where i can make enum and than for each started player timer i give a some ++ increment for createdtimers and then just kill all through loop through enum, but that is not so efficient bcuz i cannot know if it is player timer, even if i do sth like flag, i need your opinion

Source: Serious Discussion about TIMERS! (https://sampforum.blast.hk/showthread.php?tid=662422)