gTeam saving
#1

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


Messages In This Thread
gTeam saving - by krisis32 - 17.06.2011, 13:03
Re: gTeam saving - by krisis32 - 17.06.2011, 15:25
AW: gTeam saving - by Nero_3D - 17.06.2011, 16:11
Re: gTeam saving - by krisis32 - 17.06.2011, 16:53
Re: gTeam saving - by DRIFT_HUNTER - 17.06.2011, 16:57
Re: gTeam saving - by Seven_of_Nine - 17.06.2011, 17:00
Re: gTeam saving - by krisis32 - 17.06.2011, 17:19

Forum Jump:


Users browsing this thread: 2 Guest(s)