01.01.2019, 10:49
CantBeJohn, you did not understand or better said i did not explained well, i know that with creating pvar than assigning that pvar to timer than when player disconnect just use killtimer(pvar), but i need timer to kill itself automatically, without this, it often happens to forget to kill timer and boom...
I know about y_timers but i do not know if they have this feature mentioned above ( kill ptask when player dc without any code needed by me )
EDIT : Lemme explain better:
I have LoginPlayer function, i need this timer to be executed when pconnect but if player dc before timer executed kill it automatically
EDIT 2 : Lemme write code to even more explain:
But this code above uses alot of memory ( i suppose ) and isn't so efficient bcuz timer id may be number far greater than 500 in this case...
I have some idea with enums without using arrays but still its not efficient enough
I know about y_timers but i do not know if they have this feature mentioned above ( kill ptask when player dc without any code needed by me )
EDIT : Lemme explain better:
I have LoginPlayer function, i need this timer to be executed when pconnect but if player dc before timer executed kill it automatically
EDIT 2 : Lemme write code to even more explain:
Code:
new PTimer[MAX_PLAYERS][500]; new UsedTimers[MAX_PLAYERS] = -1; public OnPlayerConnect(playerid) { SetPlayerTimer("LoginPlayer", 8000, false, "i", playerid); } public SetPlayerTimer(code..) { PTimer[playerid][UsedTimers[playerid]] = SetTimerEx("LoginPlayer", 8000, false, "i", playerid); UsedTimers[playerid]++; } public OnPlayerDisconnect(playerid, reason) { for(new i=0; i < UsedTimers[playerid]; i++) { KillTimer(PTimer[playerid][i]); UsedTimers[playerid] = -1; } }
I have some idea with enums without using arrays but still its not efficient enough