SA-MP Forums Archive
Get a name for use? - 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: Get a name for use? (/showthread.php?tid=192556)



Get a name for use? - -Rebel Son- - 22.11.2010

Код:
forward VIPHealth(playerid);
public VIPHealth(playerid)
{
if(GetPlayerName(playerid, == "BL1nk")
{
SetPlayerHealth(playerid, 999999999999999);
}
}
EDIT: forgot to type

Anyways, i want to check a players name, such as "BL1nk"

If the players name Is "BL1nk" he has god health.


Re: Get a name for use? - iggy1 - 22.11.2010

pawn Код:
forward VIPHealth(playerid);
public VIPHealth(playerid)
{
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
    if(!strcmp(pname, "BL1nk", true))
    {
        SetPlayerHealth(playerid, 99999);
    }
}
Strcmp to compare strings, not a very good system you have there though you'll have to script every vips players name into your script.


Re: Get a name for use? - -Rebel Son- - 22.11.2010

Well, just doing it for my name :P thanks bro.