06.01.2011, 13:31
Hi,
Since some time ago i have some loading trouble after a restart.
The problem: if i use the /restart cmd, it will take ridicolous much time to execute the code (lagg).
But now the real problem, if i give a player money (it doesn't matter if i use /givemoney or change the files, it haves the same effect) and i activate a server restart, the money is gone when the server is back online. Even the files show me that the 'money' var is 0. Here you see my complete save/restart code:
Note: Only the money doesn't save, the rest of it loads fine.
It's only after restarts.
Please, if you know whats the problem is say it to me!!
Greetz,
Danny
Since some time ago i have some loading trouble after a restart.
The problem: if i use the /restart cmd, it will take ridicolous much time to execute the code (lagg).
But now the real problem, if i give a player money (it doesn't matter if i use /givemoney or change the files, it haves the same effect) and i activate a server restart, the money is gone when the server is back online. Even the files show me that the 'money' var is 0. Here you see my complete save/restart code:
Код:
dcmd_restart(playerid, cmdtext[]) { #pragma unused cmdtext if(pInfo[playerid][adminlevel] == 0) { SendClientMessage(playerid, COLOR_GREY,"You are not autorized to use this command!"); return 1; } SaveAllStats(); GetPlayerName(playerid, pname, sizeof (pname)); SetTimer("Restart",3000,false); // ive made this to give the server some time to save the stats SendClientMessageToAll(ADMINFS_MESSAGE_COLOR,"Server restart activated. Restart in 3 seconds."); printf("[server] Admin %s has activated a server restart.",pname); return true; } public SaveAllStats() { for(new i;i<MAX_PLAYERS;i++) { SavePlayerStats(i); print("SaveAllStats Called!"); break; } } public SavePlayerStats(playerid) { new Float:hp; new Float:am; new Float:saveX, Float:saveY, Float:saveZ; GetPlayerName(playerid, pname, sizeof (pname)); GetPlayerHealth(playerid,hp); GetPlayerArmour(playerid,am); GetPlayerPos(playerid, saveX, saveY, saveZ); SaveWeaponsToFile(playerid); dini_IntSet((pname), "money", GetPlayerMoneyEx(playerid)); dini_IntSet((pname), "kills", pInfo[playerid][kills]); dini_IntSet((pname), "deaths",pInfo[playerid][deaths]); dini_IntSet((pname), "bankmoney", pInfo[playerid][bankmoney]); dini_IntSet((pname), "beer", pInfo[playerid][beer]); dini_IntSet((pname), "cigarets", pInfo[playerid][cigarets]); dini_IntSet((pname), "chainlock", pInfo[playerid][chainlock]); dini_IntSet((pname), "sprunk", pInfo[playerid][sprunk]); if(hp != 0) dini_FloatSet((pname), "health", floatround(hp)); if(am != 0) dini_FloatSet((pname), "armour", floatround(am)); if(saveX != 0) dini_FloatSet((pname), "spawnX",saveX); if(saveY != 0) dini_FloatSet((pname), "spawnY",saveY); if(saveZ != 0) dini_FloatSet((pname), "spawnZ",saveZ); dini_IntSet((pname), "weed", pInfo[playerid][weed]); dini_IntSet((pname), "seeds", pInfo[playerid][seeds]); dini_IntSet((pname), "prepaid", pInfo[playerid][prepaid]); print("SavePlayerStats Called!"); }
It's only after restarts.
Please, if you know whats the problem is say it to me!!
Greetz,
Danny