A good GMX, without the use of exit.
#1

Using rcon command "changemode crashtheserver", you can use this script to restart your server.

It's better than GMX because we're essentially crashing the server while making it look like a GMX.

Why would I do that? Well, GMX'ing can sometimes leave crap behind, exit works sometimes but not consistently enough, and killing your server process to automatically restart results in not dying when you die, and your sound to mess up.

If you don't understand, then don't worry about it . But this was helpful for me.

Thanks to blacklite for the method on crashing your server.

Код:
// Crashing the server for a better GMX
// Without making the sound messed up and getting you stuck when you're dead

#include <a_samp>

main()
{
	print("\n---------------------------------------");
	print(" Crashing the server.  Aka, a good GMX");
	print("---------------------------------------\n");
}

public OnGameModeInit()
{
	// Crashing the server here
	new File:crash;
	fclose(crash);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}
Reply
#2

Ahh, good ol' fclose.

I'll try it, thanks.
Reply
#3

No, the purpose is, if you have a default gamemode set up on your server, and you need to restart it, GMX'ing can be problematic, so a hard restart is better.

However killing the process or crashing it will cause your game to mess up, the sound gets funky and when you die, you're running around dead.

Using rcon to changemode to this script will perform a gmx that will load this script, and that will crash the server.

If you have your server restart itself automatically, the default gamemode will load completely clean.
Reply
#4

Quote:
Originally Posted by Austin
Посмотреть сообщение
No, the purpose is, if you have a default gamemode set up on your server, and you need to restart it, GMX'ing can be problematic, so a hard restart is better.

However killing the process or crashing it will cause your game to mess up, the sound gets funky and when you die, you're running around dead.

Using rcon to changemode to this script will perform a gmx that will load this script, and that will crash the server.

If you have your server restart itself automatically, the default gamemode will load completely clean.
Oh, sounds nice.

Good job.

P.S. Raw file system is the best! So many functions to crash your server, xD.
Reply
#5

This deserves a bump since it's so useful, thanks.
Reply
#6

Nice script, but you could do
pawn Код:
#include <a_samp>

main(){}

public OnGameModeInit()
{
    SendRconCommand("exit");
    return 1;
}

public OnGameModeExit()
{
    return 1;
}
or even make a command (ZCMD):
pawn Код:
CMD:crashserver(playerid, params[]){
    if(IsPlayerAdmin(playerid)){
        SendRconCommand("exit");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)