SA-MP Forums Archive
Change team when die - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Change team when die (/showthread.php?tid=88209)



Change team when die - matdav - 24.07.2009

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


Re: Change team when die - matdav - 24.07.2009

little up i have change post new idea


Re: Change team when die - Luciano - 25.07.2009

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!


Re: Change team when die - matdav - 25.07.2009

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


Re: Change team when die - matdav - 25.07.2009

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);
   }
}