21.04.2012, 15:01
Well it saves the variables fine but there's something wrong on OnPlayerConnect because it don't convert the INI variables to the enum's variables correctly, so like I set my pScore to 20 and pAdmin to 1 in the INI file and when I log in it doesn't convert it to the enum's variables and it stays 0.
PHP код:
public OnPlayerConnect(playerid)
{
GameTextForPlayer(playerid, "~w~Team Deathmatch",3000,1);
SetPlayerColor(playerid, 0xFFFFFF00);
if(gCriminals == 0 && gSWAT > 0)
{
new string[128], Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
format(string, sizeof(string), "%s has logged in \n New round is starting up...", Name);
SendClientMessageToAll(COLOR_WHITE, string);
SetEveryoneToSpawn(playerid);
}
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
}
return 1;
}
stock LoadUser_data(playerid,name[],value[])
{
INI_Int("Score", PlayerInfo[playerid][pScore]);
INI_Int("Admin", PlayerInfo[playerid][pAdmin]);
}
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}