OnPlayerDeath
#1

Hello, Alright i have two team TEAM_HUMAN and TEAM_ZOMBIE i want if an human died he goes on zombie side
and if everyone is a zombie the game mode restart how can i do it ?
Reply
#2

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
   if(GetPlayerTeam(playerid) == TEAM_HUMAN) {
      SendClientMessageToAll(0xFF0000, "A Human died!");
      SetPlayerTeam(playerid, TEAM_ZOMBIE);
   }
   if(GetPlayerTeam(playerid) == TEAM_ZOMBIE) {
      SendClientMessageToAll(0xFF0000, "A Zombie died!");
      // Restart ?
   }
   return 1;
}
Reply
#3

Thx but what i want to do where u put restart? its only if ALL human died :P
Reply
#4

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new string[128],sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    switch(GetPlayerTeam(playerid))
    {
        case TEAM_HUMAN:
        {
            format(string, sizeof(string), "News: %s has died and turned into a zombie !", sendername);
            SendClientMessageToAll(0xFF0000, string);
            SetPlayerTeam(playerid, TEAM_ZOMBIE);
        }
        case TEAM_ZOMBIE:
        {
            format(string, sizeof(string), "News: %s has died !", sendername);
            SendClientMessageToAll(0xFF0000, string);
        }
    }
    return 1;
}
If you wanted to make it so all humans died you'd have to make a variable checking all players teams and etc..
Reply
#5

Alright thx but thats the problem i dont know how to do these variable o.o

i want ur code but with the variable can u do it ? (i understanded the coe)
Reply
#6

if GetPlayerTeam Works u can loop all players with it and check if there is at least 1 human.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)