SA-MP Forums Archive
Strfind not working.. - 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: Strfind not working.. (/showthread.php?tid=414253)



Strfind not working.. - Magic_Time - 08.02.2013

Hi,
What's wrong with this:

PHP код:
new nname[MAX_PLAYER_NAME];
GetPlayerName(playeridnnamesizeof(nname));
if(
strfind("[GTA]"nnametrue) != -1
I want to check if the Name of the player has [GTA] or not.


Re: Strfind not working.. - Height - 08.02.2013

Try using this code, you got the error because you used wrong format of strfind() function
Quote:

new nname[MAX_PLAYER_NAME];
GetPlayerName(playerid, nname, sizeof(nname));
if(strfind(nname, "[GTA]", true) != -1)


Its the wrong format
Quote:

strfind("[GTA]", nname, true) != -1)

The correct format should be
Quote:

strfind(nname, "[GTA]", true) != -1)




Re: Strfind not working.. - MicroD - 08.02.2013

Код:
if(strfind(nname, "[GTA]", true) != -1)



Re: Strfind not working.. - Magic_Time - 08.02.2013

Thanks. MicroD. It worked.