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;
}
As I told you before, in y_ini this is the way of calling it, ParseFile.
|
public OnPlayerDisconnect(playerid, reason) { new INI:iniFile = INI_Open(UserPath(playerid)), score = GetPlayerScore(playerid); INI_SetTag(iniFile, "data"); INI_WriteInt(iniFile, "Score", score); INI_WriteInt(iniFile, "Admin", PlayerInfo[playerid][pAdmin]); INI_Close(iniFile); return 1; }
[data] Score = 20 Admin = 1
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); stock LoadUser_data(playerid,name[],value[]) { print("LoadUser: Before Score"); INI_Int("Score", PlayerInfo[playerid][pScore]); print("LoadUser: After Score"); INI_Int("Admin", PlayerInfo[playerid][pAdmin]); print("LoadUser: After Admin"); return 1; }