/restart then whole server restarts over 3 seconds?
#1

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

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;
}
Reply
#3

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;
}
Reply
#4

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?
Reply
#5

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

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

nothing happens
Reply
#8

damnit why dont you use /rcon gmx?
Reply
#9

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

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)