17.06.2011, 16:11
You forgot to set gTeam to the team in the file at OnPlayerConnect
pawn Код:
enum {
POLICE,
POLICEE
}
stock gTeam[MAX_PLAYERS];
pawn Код:
public OnPlayerConnect(playerid)
{
new file[128];
GetPlayerName(playerid, file, MAX_PLAYER_NAME);
format(file, sizeof(file), saves, file);
if(dini_Exists(file)) {
gTeam[playerid] = dini_Int(file, "Team");
} else {
dini_Create(file);
gTeam[playerid] = -1; //no team
}
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new file[128];
GetPlayerName(playerid, file, MAX_PLAYER_NAME);
format(file, sizeof(file), saves, file);
dini_IntSet(file, "Team", gTeam[playerid]);
SaveStats(playerid);
return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
SetPlayerTeam(playerid, gTeam[playerid]);
SetPlayerToTeamColour(playerid);
return 1;
}