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



Server Restart.. - Static_X - 11.02.2009

So i maked simple /gmx command.. and when i type /gmx nothing ...
so the code's ive been using without any luck ..

First Code :
pawn Код:
if(strcmp(cmd, "/gmx", true) == 0)
    {
    if (IsPlayerAdmin(playerid))
    {
            GameModeExit();
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
        }
        return 1;
    }
Then i tried using it like this :
pawn Код:
//--------------------------------------SERVER REBOOT------------------------------------
        if(strcmp(cmd, "/gmx", true) == 0)
        {
        if (IsPlayerAdmin(playerid)) return SendRconCommand("gmx");
        else return SendClientMessage(playerid, COLOR_GRAD1, " not authorized to use this command!");
        }



Re: Server Restart.. - yom - 11.02.2009

Its 'cmdtext', not 'cmd'.


Re: Server Restart.. - Static_X - 11.02.2009

im using strtok oke? still not working even with CMDTEXT


Re: Server Restart.. - Static_X - 11.02.2009

its not i get error's it's all compiling fine but not working ingame


Re: Server Restart.. - JaYmE - 11.02.2009

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) {
  if(strcmp(cmdtext, "/gmx", true) == 0 ) {
    if (IsPlayerAdmin(playerid)) {
      SendClientMessage(playerid, "Server Restarting...", 0xFFFFFFFF);
      SendRconCommand("gmx");
      return 1;
    }else {
      SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
      return 1;
    }
  }
  return 0;
}
That should work, have not done awno code in a while


Re: Server Restart.. - crunch112 - 11.02.2009

that doesnt work!


Re: Server Restart.. - Static_X - 11.02.2009

Thank you for your efford but it says Server Unknown Command.. it wasnt saying it before just nothing but now Server Unknown Command...


Re: Server Restart.. - JaYmE - 11.02.2009

What was the unkwown command ?

the SendRconCommand("gmx"); was copy'd from wiki.sa-mp.com ?


Re: Server Restart.. - Danut - 11.02.2009

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/gmx", true) == 0 )
  {
    if (IsPlayerAdmin(playerid)) {
     SendClientMessage(playerid, "Server Restarting...", 0xFFFFFFFF);
     GameModeExit();
      return 1;
    }else {
      SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
      return 1;
    }
  }
  return 0;
}




Re: Server Restart.. - Static_X - 11.02.2009

He-he -he guys this is wrong :
Код:
SendClientMessage(playerid, "Server Restarting...", 0xFFFFFFFF);
it must be:
Код:
SendClientMessage( playerid, 0xFFFFFFFF, "Server Restarting..." );
!! little mistake lol