strfind and cmp
#1

why do these 2 methods always return true even when false

pawn Код:
if(strfind(text, "10-4", true))
    {
        ...
        return 0;
    }
and

pawn Код:
if(strcmp(params, "help", true))
            {
                ...
            }
all help is appreciated as I do not know what is wrong
Reply
#2

pawn Код:
if(!strfind(text, "10-4", true))

if(!strcmp(params, "help", true))
?
Reply
#3

then wouldn't that make it return false every time then?
Reply
#4

strfind returns the position of the string found.
If you want to use it to see if it is EVER mentioned you can do this:
Код:
if(strfind(text,"10-4",true)!=-1)
strcmp compares the strings, if they are identical it returns 0, if they are not it returns something else (i'm not sure if it's always 1).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)