13.06.2014, 13:30
When the player uses /savestats cmd, his stats save successfully in-game.
But when i put the same thing under OnPlayerDisconnect ( and add if(gPlayerLogged == 1) ) the stats won't save
Under onplayerdisconnect
Any solution?
pawn Код:
CMD:savestats(playerid, params[])
{
SendClientMessage(playerid, COLOR_YELLOW, ".:||Stats Saved||:.");
dini_Set(file, "example0", PlayerInfo[playerid][example0]);
dini_Set(file, "example1", PlayerInfo[playerid][example1]);
dini_Set(file, "example2", PlayerInfo[playerid][example2]);
dini_Set(file, "example3", PlayerInfo[playerid][example3]);
return 1;
}
Under onplayerdisconnect
pawn Код:
format(file, sizeof(file), SERVER_USER_FILE, GetName(playerid));
if(gPlayerLogged[playerid] == 1)
{
dini_Set(file, "example0", PlayerInfo[playerid][example0]);
dini_Set(file, "example1", PlayerInfo[playerid][example1]);
dini_Set(file, "example2", PlayerInfo[playerid][example2]);
dini_Set(file, "example3", PlayerInfo[playerid][example3]);
}
gPlayerLogged[playerid] = 0;