OnPlayerCommandText --- Help!
#1

Well I can get one CMD in but I can't happen to get another working one in. It looks like this.

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

  if (strcmp(cmdtext, "/shutdownmsg", true) == 0)
  {
    // Send a message to everyone.
    SendClientMessageToAll(0xDEEE20FF, "Server ShutDown - |||5 Minutes|||");
    return 1;
  }
  return 0;
  
  if(!strcmp(cmdtext, "/serverstats", true))
  {
    SendClientMessage(playerid, 0xFFFFFFFF, "Current Server Version:  |v0.1| Last Update: Saturday, March 20th, 2010|");
    return 1;
    /* Returning '1' is used to notify the server that the command
    has successfully been processed. If you return true here you won't
    get that 'SERVER: Unknown Command.', and any conflicts will be
    avoided.
    */
  }
  return 0;
/* Returning '0' is used to inform the server that the command
has not been successfully processed, and passes it to other scripts.
If there hasn't been a successful process, then you will get that
'SERVER: Unknown Command.' error.
*/
}
Could someone please help?
Reply
#2

You've returned 0 after the first command.

Correct:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/shutdownmsg", true) == 0) return SendClientMessageToAll(0xDEEE20FF, "Server ShutDown - |||5 Minutes|||");
  if(strcmp(cmdtext, "/serverstats", true) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Current Server Version:  |v0.1| Last Update: Saturday, March 20th, 2010|");
  return false;
}
Reply
#3

Hmm... When I try to compile this happens.

Код:
C:\Documents and Settings\HP_Administrator\Desktop\Test Server Shiz\gamemodes\barron.pwn(105) : error 054: unmatched closing brace ("}")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#4

Woops, hehe. Fixed the problem. Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)