OnPlayerCommandText --- Help! - 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: OnPlayerCommandText --- Help! (
/showthread.php?tid=135476)
OnPlayerCommandText --- Help! -
Nick Deeds - 20.03.2010
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?
Re: OnPlayerCommandText --- Help! -
Correlli - 20.03.2010
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;
}
Re: OnPlayerCommandText --- Help! -
Nick Deeds - 20.03.2010
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.
Re: OnPlayerCommandText --- Help! -
Nick Deeds - 20.03.2010
Woops,

hehe. Fixed the problem. Thanks!