Serious Discussion about TIMERS!
#4

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:
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;
	}
}
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
Reply


Messages In This Thread
Serious Discussion about TIMERS! - by NexyAG - 31.12.2018, 23:36
Re: Serious Discussion about TIMERS! - by CantBeJohn - 01.01.2019, 00:03
Re: Serious Discussion about TIMERS! - by CantBeJohn - 01.01.2019, 03:49
Re: Serious Discussion about TIMERS! - by NexyAG - 01.01.2019, 10:49
Re: Serious Discussion about TIMERS! - by Spmn - 01.01.2019, 12:21
Re: Serious Discussion about TIMERS! - by IllidanS4 - 01.01.2019, 12:46
Re: Serious Discussion about TIMERS! - by NexyAG - 01.01.2019, 13:07
Re: Serious Discussion about TIMERS! - by B3x7K - 18.01.2019, 23:44

Forum Jump:


Users browsing this thread: 1 Guest(s)