strfind and cmp - 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: strfind and cmp (
/showthread.php?tid=193421)
strfind and cmp -
BLAbla93 - 26.11.2010
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
Re: strfind and cmp -
willsuckformoney - 26.11.2010
pawn Код:
if(!strfind(text, "10-4", true))
if(!strcmp(params, "help", true))
?
Re: strfind and cmp -
BLAbla93 - 26.11.2010
then wouldn't that make it return false every time then?
Re: strfind and cmp -
jonrb - 26.11.2010
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).