Safe GMX (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: Safe GMX (Restarting server). (
/showthread.php?tid=180604)
Safe GMX (Restarting server). -
Whizion - 02.10.2010
I want to make a /gmx command so i can easily restart my server from inside the game.
But i don't know how to perform it safe.
I know that objects need to be destroyed because if i don't destroy them then theres double of them etc.
What else do i need to destroy? Pickups, timers?
Please tell my so i can have this nice command.
Thank you.
Re: Safe GMX (Restarting server). -
Matej_ - 02.10.2010
SendRconCommand("gmx");
Re: Safe GMX (Restarting server). -
Ash. - 02.10.2010
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/restart", cmdtext, true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOUR, "You are not admin");
for(new i; i < MAX_OBJECTS; i++)
{
DestroyObject(i);
}
SendRconCommand("gmx");
return 1;
}
return 1;
}
Destroying the objects will only work if you are using CreateObject, im personally not, and so i have not tested it. The restart will only work if you are logged in as RCON admin.
Re: Safe GMX (Restarting server). -
CracK - 02.10.2010
Quote:
Originally Posted by funky1234
...
pawn Код:
for(new i; i < MAX_OBJECTS; i++) { DestroyObject(i); }
...
|
Add IsValidObject here, because the server will crash (atleast it crashed before) when deleting not created object:
pawn Код:
for(new i; i < MAX_OBJECTS; i++)
{
if(IsValidObject(i)) DestroyObject(i);
}