How to shorten strcmp
#1

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

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

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

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,

Reply
#5

Nah, same errors
Reply
#6

Nope, nothing.
Reply
#7

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

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

I put this in my code:

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)