SA-MP Forums Archive
Detecting someone's name - 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: Detecting someone's name (/showthread.php?tid=333760)



Detecting someone's name - ...: 1 :... - 12.04.2012

I want to make a command, /hgate, but I don't want everyone to be able to use it, how would I go about detecting someone's name?


Re: Detecting someone's name - Macluawn - 12.04.2012

You can use strcmp to compare the players name and allowed name/s


Re: Detecting someone's name - ...: 1 :... - 12.04.2012

Quote:
Originally Posted by Macluawn
Посмотреть сообщение
You can use strcmp to compare the players name and allowed name/s
Er..could you show me how, please?
I'm a noob with strcmp.


Re: Detecting someone's name - Macluawn - 12.04.2012

pawn Код:
new playername[MAX_PLAYERS]; //declares an array
GetPlayerName(playerid, playername, MAX_PLAYER_NAME); //gets the players name
if(!strcmp("ChangeMe", playername, false, strlen("ChangeMeToo"))) //compare
{
  //do something when the names match.
}