10.10.2012, 19:41
Quote:
pawn Код:
|
You will need to call the timer and pass the specific player ID to the timer as well, so you'll be using SetTimerEx. An example of this would be:
pawn Код:
// When player dies
SetTimerEx("RespawnPlayer", 3000, false, "i", playerid); // 3 seconds
// On the top of your script
forward RespawnPlayer(playerid);
// The timer itself
public RespawnPlayer(playerid)
{
SpawnPlayer(playerid);
}
pawn Код:
// Top of your script
new pRespawnTimer[MAX_PLAYERS];
forward RespawnPlayer(playerid);
// When the player dies
pRespawnTimer[playerid] = SetTimerEx(...); // The SetTimerEx line from above
// When the player disconnects (OnPlayerDisconnect)
if(pRespawnTimer[playerid] != 0)
{
KillTimer(pRespawnTimer[playerid]);
}
// The timer itself
public RespawnPlayer(playerid)
{
SpawnPlayer(playerid);
pRespawnTimer[playerid] = 0;
}
Good luck scripting!