The server crashes when executing this?
#1

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

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

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

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

-wrong button-
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)