SA-MP Forums Archive
[HELP] If players name = 'example' do this action - 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: [HELP] If players name = 'example' do this action (/showthread.php?tid=95968)



[HELP] If players name = 'example' do this action - indy-greg - 05.09.2009

Im not 100% sure how to set this up so im asking you guys/girls for help.

What i want to do is if a player has a certain name it will do something. So for example...


If the players name = indy-greg
Do this action

I dont care about the action i can sort that out. Its just, how do i set up the if the players name = <whatevername>

Thanks for your help




Re: [HELP] If players name = 'example' do this action - Correlli - 05.09.2009

Use strcmp function.


Re: [HELP] If players name = 'example' do this action - Correlli - 05.09.2009

Quote:
Originally Posted by [HLF
It's using strcmp anyway.


Re: [HELP] If players name = 'example' do this action - LuxurioN™ - 05.09.2009

Add this function to check the name of the player.
Then define a function to it (Example: GivePlayerMoney, RemovePlayerFromVehicle ,...)

pawn Код:
new PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
pawn Код:
if(strcmp(PlayerName,"indy-greg",true))
{
Is just one example!



Re: [HELP] If players name = 'example' do this action - indy-greg - 05.09.2009

Quote:
Originally Posted by ► © The LuxurioN™
Add this function to check the name of the player.
Then define a function to it (Example: GivePlayerMoney, RemovePlayerFromVehicle ,...)

pawn Код:
new PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
pawn Код:
if(strcmp(PlayerName,"indy-greg",true))
{

Is just one example!
That is EXACTLY the thing i needed. Thanks very much.