Commands arent working
#1

I have an old SAMP script that uses strcmp to work with commands. I recently included zcmd and rewrote a few commands to work with zcmd.

I cant show you an entire public because it'd be way too long, but heres some basic pseudo-code.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
          new variables;
          if(strcmp(cmdtext, "/hello", true) == 0)
          {
              SendClientMessage(playerid, -1, "Hello.");
              return 1;
          }
          return 1;
}

CMD:hellothere(playerid, params[])
{
       SendClientMessage(playerid, -1, "Hello there.");
       return 1;
}
That's the basic structure. Commands aren't working at all. They just return SERVER: UNKNOWN COMMAND, both strcmp commands and zcmd commands are broken.

Any suggestions? I've been coding for hours and I'm having a brainfart, this is simple stuff but I just need your guys' help with this one. Thanks.
Reply
#2

You can't use both of them in the same time after you finish converting all of your commands remove the callback OnPlayerCommandText, and your zcmd commands will work.
Reply
#3

There's over 100 commands there, I believe. I'm sure you can use strcmp and zcmd at the same time, isn't there some way of utilizing OnPlayerCommandPerformed or something?
Reply
#4

It will work if you use OnPlayerCommandPerformed callback but it won't work when you are using strcmp on OnPlayerCommandText callback
Reply
#5

Could you show me how to do this? I'm finding it a bit hard to concentrate, like when you've been reading/coding for hours and think "these don't even look like letters anymore," lol.

Use my code how to do it please. I appreciate your help, man.
Reply
#6

I believe that's how you make strcmp and zcmd work together, try it out and see if it works.

Do not convert your commands to OnPlayerCommandPerformed leave it as it is.

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success)
    {
        return SendClientMessage(playerid, -1, "Unknown Command.");
    }
    return 1;
}
Reply
#7

Use OnPlayerCommandReceived instead of OnPlayerCommandText.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)