Quote:
Originally Posted by Misiur
pawn Код:
new Timers[MAX_PLAYERS]; new Text:Textdraw0[MAX_PLAYERS] = { Text:INVALID_TEXT_DRAW, ... }; //OPD: PlayerInfo[playerid][pDeadTimer] = 60; TextDrawShowForPlayer(playerid, Textdraw0[playerid]); Timers[playerid] = SetTimerEx(...);
public DeathTimer(playerid) { if(PlayerInfo[playerid][pDead] == 1){ if(PlayerInfo[playerid][pDeadTimer] == 0){ KillTimer(Timers[playerid]); PlayerInfo[playerid][pDead] = 0; SpawnPlayer(playerid); GivePlayerMoney(playerid, 100); SendClientMessage(playerid, COLOR_LIGHTBLUE, "You died, remember that you can't remember getting killed.!"); TextDrawHideForPlayer(playerid, Textdraw0[playerid]); } else if(PlayerInfo[playerid][pDeadTimer] < 61){ if(PlayerInfo[playerid][pDeadAnim] == 1) { PlayerInfo[playerid][pDeadAnim] = 0; TogglePlayerControllable(playerid,false); ApplyAnimation(playerid,"CRACK","crckdeth2",4.1,0,1,1,1,0,1); } PlayerInfo[playerid][pDeadTimer]--; new string[128]; format(string,sizeof(string),"Time until \nrespawn:\n%d seconds",PlayerInfo[playerid][pDeadTimer]); TextDrawShowForPlayer(playerid, Textdraw0[playerid]); TextDrawSetString(Textdraw0[playerid], string); } } }
#e: Also you have to find and replace all Textdraw0 assignments for all players accordingly
#e2: In fact - rebuild the system. Create array with users which are dead (I strongly recommend y_iterate to handle looping), and have only global timer - then loop only through dead players, not all
|
How should the OnGameModeInit variables look? Because if I put Textdraw0[MAX_PLAYERS] there it says that the array is out of bounds.. Should it be Textdraw[MAX_PLAYERS-1]?