Pvars...
#5

Just realised what i did wrong.

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


Messages In This Thread
Pvars... - by biltong - 24.03.2010, 13:53
Re: Pvars... - by Anwix - 24.03.2010, 15:30
Re: Pvars... - by biltong - 24.03.2010, 16:10
Re: Pvars... - by biltong - 25.03.2010, 15:14
Re: Pvars... - by Anwix - 25.03.2010, 15:18
Re: Pvars... - by biltong - 25.03.2010, 15:30
Re: Pvars... - by Anwix - 25.03.2010, 15:44
Re: Pvars... - by biltong - 25.03.2010, 16:03
Re: Pvars... - by biltong - 26.03.2010, 13:31

Forum Jump:


Users browsing this thread: 3 Guest(s)