Safe GMX (Restarting server).
#1

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

SendRconCommand("gmx");
Reply
#3

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)