I don't recommend using OnPlayerUpdate for saving stuff in files, it will cause a lot of lag because OnPlayerUpdate is called about 20 times per second, I recommend using a timer instead...
Here is the code if you need it:
pawn Код:
public OnPlayerConnect(playerid)
{
//Set a timer for the player that repeats every 2 seconds to update the player's stats...
SetPVarInt(playerid, "UpdateTimer", SetTimerEx("UpdatePlayer", 2000, true, "i", playerid));
}
public OnPlayerDisconnect(playerid)
{
//Kill the update timer for the player...
KillTimer(GetPVarInt(playerid, "UpdateTimer"));
}
//Called every 2 seconds for a player
stock UpdatePlayer(playerid)
{
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "%s.ini", name);
new uCash = GetPlayerMoney(playerid);
dini_IntSet(file,"AdminLevel", PlayerInfo[playerid][AdminLevel]);
dini_IntSet(file,"Cash", uCash);
dini_IntSet(file,"Kills", PlayerInfo[playerid][pKills]);
dini_IntSet(file,"Deaths", PlayerInfo[playerid][pDeaths]);
dini_IntSet(file,"Locked", PlayerInfo[playerid][pLocked]);
dini_IntSet(file,"Local", PlayerInfo[playerid][pLocal]);
dini_IntSet(file,"Int", PlayerInfo[playerid][pInt]);
return 1;
}