if(strfind problem - 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)
+--- Thread: if(strfind problem (
/showthread.php?tid=630598)
if(strfind problem -
coool - 16.03.2017
Hello so my problem here. The if function is not working correctly it always bypasses:
PHP код:
//The " Tag " here
new Tag[6] = "[EX]"
new pn[24]; GetPlayerName(playerid, pn, 24);
if(strfind(pn, Tag, true) != 1)
{
}
else SCM(playerid, -1, "Whatever");
if my name doesn't contain [EX] it should say Whatever, but it continues in the things nested in if
P.S I don't know why the identication is not working in my browser
Re: if(strfind problem -
Toroi - 16.03.2017
https://sampwiki.blast.hk/wiki/Strfind
Quote:
Return Values:
The number of characters before the sub string (the sub string's start position) or -1 if it's not found.
|
Код:
if(strfind(pn, Tag, true) != -1)
Yeah, sometimes the
identication does not work.
Re: if(strfind problem -
coool - 16.03.2017
PHP код:
if(strfind(pn, Tag, true) != 1) //When the strfind dosen't equals to not found
else //When the strfind returns something else
OR what should I have to write?
Re: if(strfind problem -
Toroi - 16.03.2017
Quote:
Originally Posted by coool
PHP код:
if(strfind(pn, Tag, true) != 1) //When the strfind dosen't equals to not found
else //When the strfind returns something else
OR what should I have to write?
|
Nonononononono:
PHP код:
if(strfind(pn, Tag, true) != -1) // when strfind FOUND something NOTICE the -1 < minus one
else // when it's -1 , it did not find anything.
Re: if(strfind problem -
coool - 16.03.2017
Thanks It Works