Death system, need answers.
#5

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]?
Reply


Messages In This Thread
Death system, need answers. - by Mystique - 25.02.2013, 17:21
Re: Death system, need answers. - by Misiur - 25.02.2013, 17:35
Re: Death system, need answers. - by Mystique - 25.02.2013, 18:17
Re: Death system, need answers. - by Misiur - 25.02.2013, 18:54
Re: Death system, need answers. - by Mystique - 25.02.2013, 19:21
Re: Death system, need answers. - by Misiur - 25.02.2013, 19:31
Re: Death system, need answers. - by Mystique - 25.02.2013, 19:33
Re: Death system, need answers. - by Misiur - 25.02.2013, 19:38
Re: Death system, need answers. - by Mystique - 25.02.2013, 19:57
Re: Death system, need answers. - by Misiur - 25.02.2013, 20:08

Forum Jump:


Users browsing this thread: 1 Guest(s)