08.11.2010, 04:27
this should work fine can be simplified to
pawn Код:
#define TEAM_ROBBERS 0
#define TEAM_POLICE 1
#define TEAM_SWAT 2
#define TEAM_ARMY 3
#define TEAM_ROBBERS_COLOUR 0xFFFFFFAA // White
#define TEAM_POLICE_COLOUR 0x0000FFAA // Blue
#define TEAM_SWAT_COLOUR 0x800080AA // Purple
#define TEAM_ARMY_COLOUR 0x33AA33AA // Green
new gTeam[MAX_PLAYERS];
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerTeamFromClass(playerid, classid);
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
stock SetPlayerTeamFromClass(playerid, classid){
if(classid == 0)gTeam[playerid] = TEAM_ROBBERS;
else if(classid == 1)gTeam[playerid] = TEAM_POLICE;
else if(classid == 2)gTeam[playerid] = TEAM_SWAT;
else if(classid == 3)gTeam[playerid] = TEAM_ARMY;
SetPlayerToTeamColour(playerid);
}
stock SetPlayerToTeamColour(playerid){
if(gTeam[playerid] == TEAM_ROBBERS)SetPlayerColor(playerid,TEAM_ROBBERS_COLOUR);
else if(gTeam[playerid] == TEAM_POLICE)SetPlayerColor(playerid,TEAM_POLICE_COLOUR);
else if(gTeam[playerid] == TEAM_SWAT)SetPlayerColor(playerid,TEAM_SWAT_COLOUR);
else if(gTeam[playerid] == TEAM_ARMY)SetPlayerColor(playerid,TEAM_ARMY_COLOUR);
}