Quote:
Originally Posted by lol2112
Add:
to the top of those commands to sort your undefined error out.
|
No! This is a typo! Redefining cmd at the top of the callback will result in some of his commands mysteriously failing. Do not take this advice.
Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by Luka™
Just change
pawn Код:
if (strcmp(cmd,"/copcommands",true)==0)
to
pawn Код:
if (strcmp("/copcommands", cmdtext, true, 10) == 0)
|
12 is the length of /copcommands so why did you putted 10?
|
You both need to review the
documentation on strings in the Pawn language specification. To recap, the method definition of
strcmp follows:
strcmp(const string1[], const string2[], bool:ignorecase=false, length=cellmax)
string1 The first string in the comparison.
string2 The first string in the comparison.
ignorecase If logically “true”, case is ignored during the comparison.
length The maximum number of characters to consider for comparison.
The parameters with an equal following them indicate DEFAULT values (if you don't specify
ignorecase it defaults to false). Not only are you using these parameters incorrectly, you are adding more work for yourself! The compiler can calculate length automatically for you, and I'm quite sure you don't want your commands to be case senstive (/copcommands should work just like /COPCOMMANDS).