24.03.2010, 13:53
Ok so I just tried to update my GM with the new PVar system, but in my team based GM, teams aren't being set at all.
Nothing works. I set every player who connects colour to white when they connect, then set their color based on their team when they spawn.
Did I use PVars wrong?
EDIT: why is everything in there blue?
pawn Code:
//at top of script
#define TEAM_COPS 1
#define TEAM_CRIMINALS 2
new Team[MAX_PLAYERS];
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;
}
Did I use PVars wrong?
EDIT: why is everything in there blue?