GMX Problem
#1

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;
}
Reply
#2

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;
}
Reply
#3

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.
Reply
#4

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");
}
Reply
#5

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.
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)