25.10.2010, 09:38
My script works fine apart from when you get killed you spec a player and it constantly goes -1 -2 -3 etc and doesn't stop,
i want it to be Respawning in %d(countdown from 5) and when the timer hits 0 he gets respawned and starts playing again.
my code.
i want it to be Respawning in %d(countdown from 5) and when the timer hits 0 he gets respawned and starts playing again.
my code.
Код:
new spectateTimer[MAX_PLAYERS]; forward respawnCounter(playerid); public OnPlayerDeath(playerid, killerid, reason) { TogglePlayerSpectating(playerid, 1); PlayerSpectatePlayer(playerid, killerid); spectateTimer[playerid] = SetTimerEx("respawnCounter", 1000, true, "d" , playerid); return 1; } public respawnCounter(playerid) { new string[21]; format(string, sizeof(string), "Respawning in %d", GetPVarInt(playerid, "rCount")); GameTextForPlayer(playerid, string, 1000, 4); SetPVarInt(playerid, "rCount", GetPVarInt(playerid, "rCount")-1); if(GetPVarInt(playerid, "rCount") == 0) { TogglePlayerSpectating(playerid, 0); KillTimer(spectateTimer[playerid]); SetPVarInt(playerid, "rCount", 0); } return 1; }