pawn Code:
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "myserver/%s.ini", name);
new INI:Acc = INI_Open(file);
INI_WriteString(Acc, "...", ...);
INI_WriteInt(Acc, "...", ...);
INI_Close(Acc);
Dini opens, reads and closes the file everytime you call a function, y_ini opens the file then it reads what you tell him to read and the you close the file, more difficult but if you take a deep look at it, it ends being easy.
A little example when it comes saving all the data
pawn Code:
enum pInfo
{
pAdminLevel,
pScore,
pMoney,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new bool:gPlayerLogged[MAX_PLAYERS];
forward Y_SaveAcc(playerid);
public Y_SaveAcc(playerid)
{
new pname[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "myserver/%s.ini", pname);
if(gPlayerLogged[playerid] == true)
{
new INI:Acc = INI_Open(file);
PlayerInfo[playerid][pMoney] = GetPlayerMoney(playerid);
PlayerInfo[playerid][pScore] = GetPlayerScore(playerid);
INI_WriteInt(Acc, "Score", PlayerInfo[playerid][pScore]);
INI_WriteInt(Acc, "Money", PlayerInfo[playerid][pMoney]);
INI_WriteInt(Acc, "AdminLevel", PlayerInfo[playerid][pAdminLevel]);
INI_Close(Acc);
}
gPlayerLogged[playerid] = false;
return 1;
}
When it comes reading use ParseFile, i suggest to just check ****** tutorial.
OH and remember to create the folder ''myserver'' inside scriptfiles one
Use Y_SaveAcc(playerid); inside OnPlayerDissconect or use it for a command you do.