[HELP]reset timer after death - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP]reset timer after death (
/showthread.php?tid=414840)
[HELP]reset timer after death -
Ryder1997 - 10.02.2013
I have problem, I use set timer on onplayerspawn, and then killtimer on onplayerdeath and when i die my timer doesnt reset, so anyone can help me?
Here is code:
PHP код:
public OnPlayerSpawn(playerid)
{
timer1 = SetTimer("TimeU",1000,true);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
KillTimer(timer1);
return 1;
}
Re: [HELP]reset timer after death -
Inverse - 29.06.2013
You need to use the MAX_PLAYERS array so if one player dies it doesn't reset the timer for other players. And you also need to use SetTimerEx to pass on the playerid to the public function you're calling.
pawn Код:
new timer1[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
timer1[playerid] = SetTimerEx("TimeU", 1000, true, "i", playerid);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
KillTimer(timer1[playerid]);
return 1;
}
Re: [HELP]reset timer after death -
Anak - 29.06.2013
*
pawn Код:
timer1[playerid] = SetTimerEx("TimeU", 1000, true, "i", playerid);