17.12.2013, 12:38
Hey Guys,
I have created a timer to basicly count to 25 seconds before it respawns the player.
The issue is that when this happens, the timer seems to decrease each time the player dies.
At top of the script I have:
So OnPlayerDeath here is the code.
And then I have the timer.
Then I have the timer which sets the player alive.
I have removed the variables, functions which are having no affect to the timer. Can someone please help me on this? And possibly shed some light to why its decreasing the time each time the player dies? If players die enough, they end up dying for like 1 second then respawning.
I have created a timer to basicly count to 25 seconds before it respawns the player.
The issue is that when this happens, the timer seems to decrease each time the player dies.
At top of the script I have:
pawn Код:
#define DEATH_TIME 25
new SecsToGo[MAX_PLAYERS];
new Death[MAX_PLAYERS char] = 0;
pawn Код:
SecsToGo[playerid] = DEATH_TIME;
DeathTimer{playerid} = SetTimerEx("Death", 1000, true, "i", playerid);
pawn Код:
public Death(playerid)
{
SecsToGo[playerid]--;
if(SecsToGo[playerid] < 0)
{
SetAlive(playerid);
return 1;
}
return 1;
}
pawn Код:
stock SetAlive(playerid)
{
KillTimer(Death{playerid});
return 1;
}