SA-MP Forums Archive
Gamemode freezing on restart - 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: Gamemode freezing on restart (/showthread.php?tid=391726)



Gamemode freezing on restart - 2KY - 11.11.2012

I have a restart command, and everything works fine. Problem is, 50% of the time, it will freeze everyone's game and forces them to crtl alt delete and kill the process. What's the problem? I have nothing in OnGameModeExit, and that's the only thing I could figure would cause a problem that's caused when "gmx" is called, because my restart command is on a timer to save everything..

pawn Code:
public UpdateRestartTimer ( )
{
    TimeLeftUntilRestart_Sec --;

    if( TimeLeftUntilRestart_Sec <= 0 )
    {
        TimeLeftUntilRestart_Min --;
        TimeLeftUntilRestart_Sec = 60;
    }

    if( TimeLeftUntilRestart_Min > 1 || TimeLeftUntilRestart_Min == 0 )
    {
        format( Timerstr, 64, "~w~%d minutes %d seconds", TimeLeftUntilRestart_Min, TimeLeftUntilRestart_Sec );
    }
    else
    {
        format( Timerstr, 64, "~w~%d minute %d seconds", TimeLeftUntilRestart_Min, TimeLeftUntilRestart_Sec );
    }

    TextDrawSetString( UpdateTimerAnn2, Timerstr );
    TextDrawHideForAll( UpdateTimerAnn2 ), TextDrawShowForAll( UpdateTimerAnn2 );

    if( TimeLeftUntilRestart_Min < 1 && TimeLeftUntilRestart_Sec == 10 )
    {
        for( new u; u < MAX_PLAYERS; u ++ )
        {
            OnPlayerDisconnect( u, 1 );
            TogglePlayerControllable( u, false );
        }


        SendClientMessageToAll( C_RoyalBlue, "-- Restarting in 10 seconds; saving stats." );
    }
    return true;
}

public RestartTheServer ( )
{
    TimeLeftUntilRestart_Min = 0;
    TimeLeftUntilRestart_Sec = 0;

    SendRconCommand( "gmx" );
    return true;
}
That's it..


Re: Gamemode freezing on restart - 2KY - 13.11.2012

Bump.