SA-MP Forums Archive
Need Help By Restarting Server - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need Help By Restarting Server (/showthread.php?tid=148215)



Need Help By Restarting Server - rs2fun111 - 16.05.2010

Hi I Have question ..

is this possible to restart server with command like /restart

if it is please reply


Re: Need Help By Restarting Server - juice.j - 16.05.2010

https://sampwiki.blast.hk/wiki/RCON

/rcon gmx


Re: Need Help By Restarting Server - DJDhan - 16.05.2010

You might wana use the following
Код:
if((!strcmp(cmdtext,"/restart",true,8) && IsPlayerAdmin(playerid))
{
GameTextForAll("~g~Server Restarting!", 2000, 5);
SendRconCommand("gmx");
return 1;
}



Re: Need Help By Restarting Server - Bomber - 16.05.2010

Quote:
Originally Posted by DJDhan
You might wana use the following
Код:
if(!strcmp(cmdtext,"/restart",true,8)
{
GameTextForAll("~g~Server Restarting!", 2000, 5);
SendRconCommand("gmx");
return 1;
}
And you should add this command with your adminlevel, or else all can use this command xD


Re: Need Help By Restarting Server - MafiaGuy™ - 16.05.2010

Код:
if(!strcmp(cmdtext,"/restart",true,8)
{
GameModeExit();
return 1;
}



Re: Need Help By Restarting Server - juice.j - 16.05.2010

... which wouldn't restart the server.


Re: Need Help By Restarting Server - MafiaGuy™ - 16.05.2010

Quote:
Originally Posted by juice.j
... which wouldn't restart the server.
eH ? it would


Re: Need Help By Restarting Server - DJDhan - 16.05.2010

If you use GameModeExit(), you will have to use OnGameModeExit() too.

So, my code is simply better


Re: Need Help By Restarting Server - juice.j - 16.05.2010

GameModeExit as such simply exits the game mode. Using it bare it will not restart your server.


Re: Need Help By Restarting Server - DaneAMattie - 16.05.2010

just /rcon login [password]
/rcon gmx

or using script:
if(!strcmp(cmdtext,"/restart",true,
{
if (!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COLOR_RED, "You are not Administrator.");
return 1;
}
SendRconCommand("gmx");
}