Undefined Symbol "cmd" -
DragonYancy - 11.06.2012
Код:
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"
Re: Undefined Symbol "cmd" -
Flake. - 11.06.2012
should be
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/command here", cmdtext, true, 10) == 0)
{
Re: Undefined Symbol "cmd" -
Cxnnor - 11.06.2012
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.
Re: Undefined Symbol "cmd" -
Randy More - 11.06.2012
Quote:
Originally Posted by Cxnnor
|
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);
Re: Undefined Symbol "cmd" -
DragonYancy - 11.06.2012
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.
Re: Undefined Symbol "cmd" -
Randy More - 11.06.2012
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
Re: Undefined Symbol "cmd" -
JhnzRep - 11.06.2012
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.
AW: Re: Undefined Symbol "cmd" -
Extremo - 11.06.2012
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.
Re: Undefined Symbol "cmd" -
Cxnnor - 11.06.2012
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
Re: Undefined Symbol "cmd" -
DragonYancy - 11.06.2012
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.