SA-MP Forums Archive
/restart then whole server restarts over 3 seconds? - 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: /restart then whole server restarts over 3 seconds? (/showthread.php?tid=86868)



/restart then whole server restarts over 3 seconds? - [GF]sIdEkIcK - 16.07.2009

hey all, how do i make a command when i type /restart and then it says, "Server is restarting in 3..." etc. etc?

then after 3 seconds it will restart and say "Server has been restarted"?

thnx.


Re: /restart then whole server restarts over 3 seconds? - iMonk3y - 16.07.2009

how simple it is

Код:
public OnPlayerCommandText(playerid, cmdtext[]) {

  if(strcmp(cmdtext, "/restart", true)==0) {
    if(!IsPlayerAdmin(playerid) return 0;
    else{
       SendClientMessageToAll(COLOR_WHITE,"Server is restarting in 3...");
	  SetTimer("OnGameModeExit",3000,0);
    }
    return 1;
  }
  return 0;
}



Re: /restart then whole server restarts over 3 seconds? - refshal - 16.07.2009

Quote:
Originally Posted by ιMσик3у
how simple it is

Код:
public OnPlayerCommandText(playerid, cmdtext[]) {

  if(strcmp(cmdtext, "/restart", true)==0) {
    if(!IsPlayerAdmin(playerid) return 0;
    else{
       SendClientMessageToAll(COLOR_WHITE,"Server is restarting in 3...");
	  SetTimer("OnGameModeExit",3000,0);
    }
  }
  return 1;
}
Sorry, but your code failed. This would work:

pawn Код:
if(strcmp(cmdtext, "/restart", true) ==0)
{
if(IsPlayerAdmin(playerid))
{
SendClientMessageToAll(0xFFFFFFAA, "Server is restarting in 3 seconds...");
SetTimer("OnGameModeExit", 3000, 0);
}
return 1;
}
else return 0;
}



Re: /restart then whole server restarts over 3 seconds? - [GF]sIdEkIcK - 16.07.2009

hmm.. u guys seem confident that it WILL Work so.. i copied it edited it like i like:

Mσик3у's one:

pawn Код:
if(strcmp(cmd,"/restart", true)==0) {
        if(!IsPlayerAdmin(playerid)) {
          SendClientMessageToAll(BRIGHTRED,"Server is restarting in 3...");
          SetTimer("OnGameModeExit",3000,0);
          return 1;
         } else {
          SendClientMessage(playerid,BRIGHTRED,"=> This command does not exsist, type ''help'' for help.");
          return 1; } }
Eddy's one:

pawn Код:
if(strcmp(cmdtext, "/restart", true) ==0) {
          if(IsPlayerAdmin(playerid)) {
          SendClientMessageToAll(BRIGHTRED, "Server is restarting in 3 seconds...");
          SetTimer("OnGameModeExit", 3000, 0); }
          return 1; }
and they both dont work :[ help plz? is there something i need to add like the OnGameModeExit thing or something?


Re: /restart then whole server restarts over 3 seconds? - refshal - 16.07.2009

Press "new" in Pawno, and copy and paste this:

pawn Код:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/restart", true) ==0)
{
if(IsPlayerAdmin(playerid))
{
SendClientMessageToAll(0xFFFFFFAA, "Server is restarting in 3 seconds...");
SetTimer("RestartGameMode", 3000, 0);
}
return 1;
}
return 0;
}

forward RestartGameMode();
public RestartGameMode()
{
GameModeExit();
return 1;
}
And compile it.


Re: /restart then whole server restarts over 3 seconds? - iMonk3y - 16.07.2009

just simplify: add GameModeExit(); on the bottom of OnGameModeExit callback


Re: /restart then whole server restarts over 3 seconds? - [GF]sIdEkIcK - 16.07.2009

nothing happens


Re: /restart then whole server restarts over 3 seconds? - Khelif - 16.07.2009

damnit why dont you use /rcon gmx?


Re: /restart then whole server restarts over 3 seconds? - refshal - 16.07.2009

Quote:
Originally Posted by ĸнelιғaтι
damnit why dont you use /rcon gmx?
Because he want his server to restart after 3 seconds.


Re: /restart then whole server restarts over 3 seconds? - [GF]sIdEkIcK - 16.07.2009

Quote:
Originally Posted by еddy
Quote:
Originally Posted by ĸнelιғaтι
damnit why dont you use /rcon gmx?
Because he want his server to restart after 3 seconds.
yep.. ok it works, but it only works if i get rid of my other FS.. so i can i fix that? ! i tried putting in my other FS but it doesnt work help plz?