OnPlayerCommandText
#1

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

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

Thanks , it works.
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)