SA-MP Forums Archive
GMX Problem - 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 Problem (/showthread.php?tid=410186)



GMX Problem - Blackazur - 24.01.2013

Hello, i have a Problem with the GMX Command, my Problem is that after the GMX, some Account Data's lost, and i dont know why, i tried to make something what saving the Playerfiles after an GMX, but it work not so right, can everyone help me?

Код:
COMMAND:gmx(playerid,params[])
{
    if(PlayerAdmin[playerid] < 4) return SendClientMessage(playerid,COLOR_RED,"You cannot use this Command!");

	for(new i=0;i<MAX_PLAYERS;i++)
	{
	    if(IsPlayerConnected(i))
	    {
	        SavePlayer(i);
	    }
	}
	
	GameTextForAll("~r~Server restart, ~g~be patient!",5000,3);
	SendRconCommand("gmx");
	return 1;
}



Re: GMX Problem - Roach_ - 24.01.2013

Try to do that thing( with the SavePlayer(i); ) into OnGameModeExit callback, and the command would be this:
pawn Код:
COMMAND:gmx(playerid)
{
    if(PlayerAdmin[playerid] < 4) return SendClientMessage(playerid,COLOR_RED,"You cannot use this Command!");
   
    GameTextForAll("~r~Server restart, ~g~be patient!",5000,3);
    SendRconCommand("gmx");
    return 1;
}



Re: GMX Problem - FUNExtreme - 24.01.2013

I don't know how you save your information. But if you use mysql with threaded queries then it is possible that the server shuts down before the queries are finished.


Re: GMX Problem - DaRk_RaiN - 24.01.2013

pawn Код:
//Use a timer, this should give the server enough time to save the data.
COMMAND:gmx(playerid,params[])
{
    if(PlayerAdmin[playerid] < 4) return SendClientMessage(playerid,COLOR_RED,"You cannot use this Command!");

    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            SavePlayer(i);
        }
    }
    SetTimer("GMX",5000,0);
    GameTextForAll("~r~Server restart, ~g~be patient!",5000,3);
    return 1;
}
forward GMX();
public GMX()
{
    SendRconCommand("gmx");
}



Re: GMX Problem - Skribblez - 06.03.2013

Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
pawn Код:
//Use a timer, this should give the server enough time to save the data.
COMMAND:gmx(playerid,params[])
{
    if(PlayerAdmin[playerid] < 4) return SendClientMessage(playerid,COLOR_RED,"You cannot use this Command!");

    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            SavePlayer(i);
        }
    }
    SetTimer("GMX",5000,0);
    GameTextForAll("~r~Server restart, ~g~be patient!",5000,3);
    return 1;
}
forward GMX();
public GMX()
{
    SendRconCommand("gmx");
}
I coded the exact same thing and checked the debug for MySQL, it saves before the server restarts but after it; whenever a player is going to log-in, they just die at the "0.0 position" having the CJ skin.


Re: GMX Problem - SuperViper - 06.03.2013

What I did to fix this is to not save the player if their position is 0, which is what it is during a restart.