SA-MP Forums Archive
if playername = "" ??? - 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 playername = "" ??? (/showthread.php?tid=440845)



if playername = "" ??? - NicholasA - 31.05.2013

How can I make an if statement to check if a players name matches the string?


Re: if playername = "" ??? - Kirollos - 31.05.2013

pawn Код:
if(!strcmp(string, playername))
{
    //if matches
}
else
{
    //not matches
}



Re: if playername = "" ??? - NicholasA - 31.05.2013

Код:
if(!strcmp(string, "NicholasA"))
	{
	    SendClientMessageToAll(0x26F70FFF, "it works");
	}
	else
	{
	    //not matches
	}
Doesnt work


Re: if playername = "" ??? - Kirollos - 31.05.2013

what did the string contain?


Re: if playername = "" ??? - ikkentim - 31.05.2013

Then you didn't but the right string in "string"

Here is some strcmp reference:
https://sampwiki.blast.hk/wiki/Strcmp


Re: if playername = "" ??? - NicholasA - 31.05.2013

It works now