Change team when die
#1

Herro,
i have make a game mode but when a player die i want him to go to the team he got killed by there my code

i have seriously no idea on how to do it

if u can help me i will be happy :P
Reply
#2

little up i have change post new idea
Reply
#3

Hey there, here is a good idea for doing what you are trying to:

At the top of the file
Код:
#define TEAM_RED 0xFF0000AA
#define TEAM_BLUE 0x375FFFFF

new gTeam[MAX_PLAYERS];
Inside the middle
Код:
OnPlayerDeath(playerid, killerid, reason)
{
   if(gTeam[playerid] == TEAM_RED)
   {
       gTeam[playerid] = TEAM_BLUE;
       SetPlayerColor(playerid, TEAM_BLUE);
       GameTextForPlayer(playerid, "~w~You have been switched to team~n~~b~Blue",2500,6);
   }
   else if(gTeam[playerid] == TEAM_BLUE)
   {
       gTeam[playerid] = TEAM_RED;
       SetPlayerColor(playerid, TEAM_RED);
       GameTextForPlayer(playerid, "~w~You have been switched to team~n~~r~Red",2500,6);
   }
}
When a player dies, this will tell a player that they have been switched to whatever team opposite from their current team, and set their name color to the team color. Pretty basic system, but its what you wanted! Good Luck!
Reply
#4

omg why i dont have think of that
BUT thx dude very helpfull
Reply
#5

ok i have do what u have say but i have do SetPlayerSkin becuz its other skin and when i die it change me of gang but i cant move and my health is stuck at 0 and i die without the little "movie" i just change skin and stay at same place there the code :
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
   if(team[playerid] == zombie)
   {
       team[playerid] = zombie;
       SetPlayerColor(playerid,grove);
       SetPlayerSkin(playerid,106);
       GameTextForPlayer(playerid, "~w~You have been switched to grove gang",2500,6);
   }
   else if(team[playerid] == grove)
   {
       team[playerid] = grove;
       SetPlayerColor(playerid,zombie);
       SetPlayerSkin(playerid,137);
       GameTextForPlayer(playerid, "~w~You have been switched to zombie",2500,6);
   }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)