SA-MP Forums Archive
How to shorten strcmp - 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: How to shorten strcmp (/showthread.php?tid=233127)



[SOLVED]How to shorten strcmp - ifly4life - 01.03.2011

Ok i know you guys are gonna say stuff like use dcmd, and what not but i like strcmp, so this is my question
is there anyway to make it like
Код:
CMD:"/mycommand", cmdtext, true, 10) == 0)
and then do
Код:
#define CMD: if(strcmp(cmd,
And then use it?

and once again please dont tell me to use a diff cmd processor cause im staying with strcmp!


Re: How to shorten strcmp - ifly4life - 01.03.2011

I tried , didnt work, so any idea for a solution?


Re: How to shorten strcmp - Hal - 01.03.2011

Quote:
Originally Posted by ifly4life
Посмотреть сообщение
I tried , didnt work, so a solution?
pawn Код:
#define CMD(    if(strcmp(cmd,
try dat


Re: How to shorten strcmp - ifly4life - 01.03.2011

nah im getting
error 017: undefined symbol "CMD"
error 017 invalid expression, assumed zero
Код:
CMD( "/test", cmdtext, true, 10) == 0)
and put
Quote:

#define CMD( if(strcmp(cmd,




Re: How to shorten strcmp - ifly4life - 01.03.2011

Nah, same errors


Re: How to shorten strcmp - ifly4life - 01.03.2011

Nope, nothing.


Re: How to shorten strcmp - randomkid88 - 01.03.2011

You have
Код:
#define CMD( if(strcmp(cmd,
as your define. Using your example, you have
pawn Код:
CMD("/test", cmdtext, true, 10) == 0
So when the preprocessor runs, it replaces CMD with what you defined it as, so you get this:
pawn Код:
if(strcmp(cmd, "/test", cmdtext, true, 10) == 0)
which is one too many arguments, no?
Try taking out the "cmd," in your define.


Re: How to shorten strcmp - ifly4life - 01.03.2011

Now all im getting is :
Код:
error 017: undefined symbol "CMD"
warning 225: unreachable code



Re: How to shorten strcmp - Antonio [G-RP] - 01.03.2011

I put this in my code:

pawn Код:
#define CMD:%0 if(strcmp(cmdtext, "/%0", true) == 0)
And got no errors.


Re: How to shorten strcmp - ifly4life - 01.03.2011

Nor did i but when i try to make a command i get the errors

EDIT: 1 error
Код:
error 013: no entry point (no public functions)