Undefined Symbol "cmd"
#1

Код:
	if(strcmp(cmd, "/train", true) == 0)
34th line is this. But I didn't understand anything why I get this error
Код:
(34) : error 017: undefined symbol "cmd"
Reply
#2

should be
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/command here", cmdtext, true, 10) == 0)
    {
Reply
#3

You need to download the include zcmd, mate.
https://sampforum.blast.hk/showthread.php?tid=91354

EDIT: Didn't read properly Try this.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/_____", cmdtext, true, 10) == 0)
    {
          else SendClientMessage (playerid, COLOR_GREY, "That command does not exist.")
Regards, Connor.
Reply
#4

Quote:
Originally Posted by Cxnnor
Посмотреть сообщение
You need to download the include zcmd, mate.
https://sampforum.blast.hk/showthread.php?tid=91354

Regards, Connor.
Since he didn't use it, he doesn't have to download it.
As for the code, add this under "OnPlayerCommandText" callback.


pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
Reply
#5

Thank you (*|Flake|*) It worked.
Cxnnor I know zcmd, but I don't want to use it. It's more confusing.
Thank you Randy More but I think (*|Flake|*)'s one is more proper.
Reply
#6

Quote:
Originally Posted by DragonYancy
Посмотреть сообщение
Thank you (*|Flake|*) It worked.
Cxnnor I know zcmd, but I don't want to use it. It's more confusing.
Thank you Randy More but I think (*|Flake|*)'s one is more proper.
Anytime, i thought i saw "cmd" thing before, so i knew that you would probably having a command that has params. so
Reply
#7

Dragon, I STRONGLY recommend using YCMD or ZCMD..And it is actually much more simpler. If you would like a explanation on how to use them, I could show you over teamviewer.
Reply
#8

Quote:
Originally Posted by (*|Flake|*)
Посмотреть сообщение
should be
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/command here", cmdtext, true, 10) == 0)
    {
The length parameter is obsolete for this! Do NOT use it! Your command WILL cut off if it's longer and even otherwise its pointless for command comparision.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/command here", true))
    {
This way you don't have to worry about the length and you cannot experience issues either. Remember that the "true" means it ignores upper-lower casing aka CommAnD is the same as command. Set it to false if you don't want that.

Regards.
Reply
#9

Quote:
Originally Posted by DragonYancy
Посмотреть сообщение
Thank you (*|Flake|*) It worked.
Cxnnor I know zcmd, but I don't want to use it. It's more confusing.
Thank you Randy More but I think (*|Flake|*)'s one is more proper.
I read it wrong, I thought you had an error because you didn't have the include.
My bad, I am still new at this stuff
Reply
#10

JhnzRep, I'm learning basic stuffs now. After that I'll use zcmd or ycmd, thank you for your advice.
Extremo, I think it's a better and shorter way, I'll use it. Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)