GMX screw with saving. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: GMX screw with saving. (
/showthread.php?tid=390390)
GMX screw with saving. -
willsuckformoney - 05.11.2012
After my problem from yesterday which could be found
here, I decided to add the gmx function and move on, but for my gmx function I took out the Kick() part and the weapons would not save again but they would if I kicked the person. I even tried editing it a bit so that if the gmx() function is called, no stats would be saved on disconnect.
(To long^?)
Weapons still won't save on gmx even if I have it modified to not save on disconnect/gmx at the same time.
pawn Код:
//under disconnect
if(Restarting == 0)
{
if(Logged[playerid] == 1)
{
SavePlayerData(playerid);
}
}
stock gmx()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
Restarting = true;
SavePlayerData(i);
// Kick(i);
}
}
SendRconCommand("gmx");
}
Re: GMX screw with saving. -
Kyle - 05.11.2012
It's usually best to execute a special function to save weapons etc, then execute gmx 3 seconds later.
Re: GMX screw with saving. -
willsuckformoney - 05.11.2012
Still doesn't work.
Re: GMX screw with saving. -
Jack_Leslie - 05.11.2012
Try making the players data save when they disconnect, and before you execute the gmx command, call OnPlayerDisconnect and force the player to disconnect, that's how I always did it.
Re: GMX screw with saving. -
Glad2BeHere - 05.11.2012
PHP код:
new LoggedIn[MAX_PLAYERS];
when the player spawns u should
LoggedIn[playerid] = 1;
Код:
And in the stock saving u should
if(LoggedIn[playerid] == 1)
{
and u should continue on with stuff
pawn Код:
CMD:gmx(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] != 6)return SendClientMessage(playerid, COLOR_GREEN,"Only Owner may do this");
foreach(Player, i)
{
SavePlayerData(i);
LoggedIn[i] = 0;
SendClientMessage(playerid, -1, "SERVER: The server is being restarted.");
}
SendRconCommand("gmx");
return 1;
}
so when gamemode restarting before it restarts it;
Saves the player data
sets his log in to 0, and remember u stats only save if loggin = 1 but its 0 so it doesnt save, then i send i little message before gmx 2 say its restarting then the gamemode restarts does it work? YES! i dont post what dont work