Quote:
Originally Posted by Tee
Even better.
When the player logins in
pawn Код:
FileSave[playerid] = SetTimerEx("Save",1000,true,"i",playerid)
pawn Код:
forward Save(playerid) public Save(playerid) { //Then put the dini stuff in here return 1; }
public OnPlayerDisconnect(playerid) { KillTimer(FileSave[playerid); return 1; }
Here is the 1st 14 lines of mine
pawn Код:
public Save(playerid) { if(Logged[playerid] == 1 && Spawned[playerid] == 1 && IsSpecing[playerid] == 0 && !IsPlayerNPC(playerid)) { GetPlayerName(playerid, Name, sizeof(Name)); format(file, sizeof(file), USER_FILES, Name); if(dini_Exists(file)) { dini_IntSet(file, "Cash", GetPlayerMoney(playerid)); dini_IntSet(file, "Score", GetPlayerScore(playerid)); } } return 1; }
|
I wouldn't advise using that code. Unless you increase the time on the timer. There is no reason i can think of to save every players stats every second. Its very inefficient, especially with dini. Once a minute or even two would be good IMO.
Put this in your timer too,
pawn Код:
dini_IntSet(file, "skin", GetPlayerSkin(playerid));