14.03.2011, 21:05
Hello,
I want to make a /gmx command for the admin, but
with saving the stats of the players. I mean, on my server,
I use dini to save the variables, when I do gmx from the
RCON box it doesn't save the current status and all the
skins are setting to skin ID: 0. I want to make a /gmx command,
but that it saved all accounts before it restarts..
I started like this:
I made a savestat function to save them but it doesn't work.
Here it is:
I hope someone can help me soon..
Thanks!!
I want to make a /gmx command for the admin, but
with saving the stats of the players. I mean, on my server,
I use dini to save the variables, when I do gmx from the
RCON box it doesn't save the current status and all the
skins are setting to skin ID: 0. I want to make a /gmx command,
but that it saved all accounts before it restarts..
I started like this:
Код:
if(strcmp(cmd, "/gmx", true)
{
// I want to let it save before the GMX so it doesn't mes up when it's restarted.
SendRconCommand("gmx");
return 1;
}
Here it is:
Код:
public SaveStats(playerid)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(gPlayerLogged[playerid] == 1)
{
dini_IntSet(file, "pAdminLevel",PlayerInfo[playerid][pAdminLevel]);
dini_IntSet(file, "pMoney", GetPlayerMoney(playerid));
dini_IntSet(file, "pHours", GetPlayerScore(playerid));
dini_IntSet(file, "pNew", PlayerInfo[playerid][pNew]);
dini_IntSet(file, "pJob", PlayerInfo[playerid][pJob]);
dini_IntSet(file, "pFaction", PlayerInfo[playerid][pFaction]);
dini_IntSet(file, "pGuide", PlayerInfo[playerid][pGuide]);
dini_IntSet(file, "pHasSpawnPlace", PlayerInfo[playerid][pHasSpawnPlace]);
dini_FloatSet(file, "pOwnSpawnX", PlayerInfo[playerid][pOwnSpawnX]);
dini_FloatSet(file, "pOwnSpawnY", PlayerInfo[playerid][pOwnSpawnY]);
dini_FloatSet(file, "pOwnSpawnZ", PlayerInfo[playerid][pOwnSpawnZ]);
dini_IntSet(file, "pSkin", GetPlayerSkin(playerid));
dini_IntSet(file, "pWepLic",PlayerInfo[playerid][pWepLic]);
dini_IntSet(file, "pPassport",PlayerInfo[playerid][pPassport]);
dini_IntSet(file, "pCigars",PlayerInfo[playerid][pCigars]);
dini_IntSet(file, "pLighter",PlayerInfo[playerid][pLighter]);
dini_IntSet(file, "pMats",PlayerInfo[playerid][pMats]);
dini_IntSet(file, "pAjailed",PlayerInfo[playerid][pAjailed]);
dini_IntSet(file, "pAjailTime",AJailTime[playerid]);
dini_IntSet(file, "pAge",PlayerInfo[playerid][pAge]);
dini_IntSet(file, "pSex",PlayerInfo[playerid][pSex]);
dini_IntSet(file, "pHasHouse",PlayerInfo[playerid][pHasHouse]);
dini_IntSet(file, "pPackages",PlayerInfo[playerid][pPackages]);
dini_IntSet(file, "pWeedSeeds",PlayerInfo[playerid][pWeedSeeds]);
dini_IntSet(file, "pWeed",PlayerInfo[playerid][pWeed]);
new weapons[13][2];
for (new i = 0; i < 13; i++) GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
dini_IntSet(file, "weaponSlot0", weapons[0][0]);
dini_IntSet(file, "weaponSlot1", weapons[1][0]);
dini_IntSet(file, "weaponSlot2", weapons[2][0]);
dini_IntSet(file, "weaponSlot3", weapons[3][0]);
dini_IntSet(file, "weaponSlot4", weapons[4][0]);
dini_IntSet(file, "weaponSlot5", weapons[5][0]);
dini_IntSet(file, "weaponSlot6", weapons[6][0]);
dini_IntSet(file, "weaponSlot7", weapons[7][0]);
dini_IntSet(file, "weaponSlot8", weapons[8][0]);
dini_IntSet(file, "weaponSlot9", weapons[9][0]);
dini_IntSet(file, "weaponSlot10", weapons[10][0]);
dini_IntSet(file, "weaponSlot11", weapons[11][0]);
dini_IntSet(file, "weaponSlot12", weapons[12][0]);
}
SendClientMessage(playerid, COLOR_GREEN, "(( All account stats saved. ))");
}
Thanks!!


