17.06.2011, 13:03
I am trying to set player to team from .ini file but the player can select team from selection class. Here is the code:
Код:
#define POLICE 0 #define POLICEE 1 new gTeam[MAX_PLAYERS]; public OnPlayerConnect(playerid) { new pname[128]; new file[128]; GetPlayerName(playerid, pname, sizeof(pname)); format(file, sizeof(file), saves,pname); if(!dini_Exists(file)) { dini_Create(file); dini_IntSet(file, "Team", gTeam[playerid]); SetPlayerTeam(playerid, dini_Int(file, "Team")); } else { SetPlayerTeam(playerid, dini_Int(file, "Team")); } return 1; } public OnPlayerDisconnect(playerid, reason) { new pname[128]; new file[128]; GetPlayerName(playerid, pname, sizeof(pname)); format(file, sizeof(file), saves,pname); if(!dini_Exists(file)) { } else { dini_IntSet(file, "Team", gTeam[playerid]); } SaveStats(playerid); return 1; } public OnPlayerSpawn(playerid) { SetPlayerTeam(playerid, dini_Int(file, "Team")); SetPlayerToTeamColour(playerid); return 1; }