25.03.2010, 15:18
Just realised what i did wrong.
Try this:
Try this:
pawn Code:
//at top of script
#define TEAM_COPS 1
#define TEAM_CRIMINALS 2
forward SetPlayerTeamFromClass(playerid, classid);
public SetPlayerTeamFromClass(playerid, classid) //called from OnPlayerRequestClass
{
// Set their team number based on the class they selected.
if (classid == 4 || classid == 5 || classid == 6 || classid == 7 || classid == 8 || classid == 9 || classid == 10 || classid == 11 || classid == 12)
{
SetPVarInt(playerid, "Team", TEAM_COPS);
SetPVarInt(playerid, "HasPlayerChangedTeams", 1);
SetPVarInt(playerid, "HasBeenSentObjectives", 0);
}
else if (classid == 0 || classid == 1 || classid == 2 || classid == 3)
{
SetPVarInt(playerid, "Team", TEAM_CRIMINALS);
SetPVarInt(playerid, "HasPlayerChangedTeams", 1);
SetPVarInt(playerid, "HasBeenSentObjectives", 0);
}
return 1;
}
public SetPlayerToTeamColor(playerid) //called from OnPlayerSpawn, which also checks for team
{
if (GetPVarInt(playerid, "Team") == TEAM_COPS) SetPlayerColor(playerid,COPS_COLOR); // blue
else if (GetPVarInt(playerid, "Team") == TEAM_CRIMINALS) SetPlayerColor(playerid,CRIMINALS_COLOR); // red
return 1;
}