SA-MP Forums Archive
The server crashes when executing this? - 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: The server crashes when executing this? (/showthread.php?tid=78604)



The server crashes when executing this? - NovaParadox - 21.05.2009

if(strcmp(tmp, "!ABORT", true) == 0)
{
if(SERVER_SHUTDOWN_STARTED == 0) {SendClientMessage(playerid, COLOR_RED_LIGHT, "{ADMIN} There is no timed shutdown in effect"); return 1; }
KillTimer(SERVER_SHUTDOWN_STARTED);
format(str, 128, "{ADMIN} The timed server shutdown has been aborted.", name, playerid);
SendClientMessage(playerid, COLOR_YELLOW, str);
return 1;
}

For some reason it crashes when sending the message to the client?


Re: The server crashes when executing this? - Joske_Vermeulen - 21.05.2009

badass indentation , try this

pawn Код:
if(strcmp(tmp, "!ABORT", true) == 0)
{
  if(SERVER_SHUTDOWN_STARTED == 0)
  return SendClientMessage(playerid, COLOR_RED_LIGHT, "{ADMIN} There is no timed shutdown in effect");

  KillTimer(SERVER_SHUTDOWN_STARTED);
  SendClientMessage(playerid, COLOR_YELLOW, "{ADMIN} The timed server shutdown has been aborted.");
  return 1;
}
if it still crashes, then this code is not the problem


Re: The server crashes when executing this? - NovaParadox - 21.05.2009

Ah, thanks, it worked. The reason it was formatting a string was because the problem popped up when it was supposed to send the message to all online players.


Ack, tried changing it back to sending it to everyone with the following code:

if(strcmp(tmp, "!ABORT", true) == 0)
{
if(SERVER_SHUTDOWN_STARTED == 0)
return SendClientMessage(playerid, COLOR_RED_LIGHT, "{ADMIN} There is no timed shutdown in effect");

KillTimer(SERVER_SHUTDOWN_STARTED);
format(str, 128, "{ADMIN} '%s'[ID:%d] has cancelled the timed server shutdown.", name, playerid);
SendClientMessageToAll(COLOR_YELLOW, str);
return 1;
}

It still crashed. Guess I have to deal with only the admin getting the message.


Re: The server crashes when executing this? - Joske_Vermeulen - 21.05.2009

pawn Код:
if(!strcmp(tmp, "!ABORT", true))
{
  if(SERVER_SHUTDOWN_STARTED == 0)
  return SendClientMessage(playerid, COLOR_RED_LIGHT, "{ADMIN} There is no timed shutdown in effect");
               
  KillTimer(SERVER_SHUTDOWN_STARTED);
  GetPlayerName(playerid, name, 24);
  format(str, 128, "{ADMIN} '%s'[ID:%d] has cancelled the timed server shutdown.", name, playerid);
  SendClientMessageToAll(COLOR_YELLOW, str);
  return 1;
}



Re: The server crashes when executing this? - Joske_Vermeulen - 21.05.2009

-wrong button-