OnPlayerCommandText - 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 (
/showthread.php?tid=79827)
OnPlayerCommandText -
russiany - 31.05.2009
Hey guys. I'm trying to make a command in a INCLUDE , but i can't ... When i type the command , nathing happend.
e.g. in INCLUDE:
pawn Код:
#include <a_samp>
#define OnPlayerCommandText CMD
forward CMD(playerid, cmdtext[]);
public CMD(playerid, cmdtext[]);
{
if(!strcmp(cmdtext,"/hi",true))
{
SendClientMessage(playerid,0xFF,"Hello");
return 1;
}
}
I type /hi and he didn't show me anything
Re: OnPlayerCommandText -
Andom - 31.05.2009
Quote:
|
Originally Posted by russiany
Hey guys. I'm trying to make a command in a INCLUDE , but i can't ... When i type the command , nathing happend.
e.g. in INCLUDE:
pawn Код:
#include <a_samp>
#define OnPlayerCommandText CMD forward CMD(playerid, cmdtext[]);
public CMD(playerid, cmdtext[]); { if(!strcmp(cmdtext,"/hi",true)) { SendClientMessage(playerid,0xFF,"Hello"); return 1; } }
I type /hi and he didn't show me anything
|
pawn Код:
#include <a_samp>
forward CMD(playerid, cmdtext[]);
public OnPlayerCommandText(playerid, cmdtext[]);
{
CMD(playerid, cmdtext);
return 0;
}
public CMD(playerid, cmdtext[]);
{
if(!strcmp(cmdtext,"/hi",true))
{
SendClientMessage(playerid,0xFF,"Hello");
return 1;
}
}
Re: OnPlayerCommandText -
russiany - 31.05.2009
Thanks , it works.
Re: OnPlayerCommandText -
yom - 31.05.2009
You inverted the parameters of #define.
It should be
pawn Код:
#define CMD OnPlayerCommandText
And then your code will work, you won't even need to forward it..
Edit: or i misunderstood what you really want to do.