SA-MP Forums Archive
Name restrictions - 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: Name restrictions (/showthread.php?tid=435498)



lock and bin it please. - Siv - 07.05.2013

Please lock and bin the topic.,


Re: Name restrictions - jakejohnsonusa - 07.05.2013

Try using this function: GetPlayerName(playerid, name, sizeof(name));


So somthing like this:

pawn Код:
if(GetPlayerName(playerid, name, sizeof(name) != "David_Johnson" || "Melinda_Washington")//You might need to format these names; I haven't tested this code yet...
{
    GameTextForPlayer(playerid, "~r~Access Denied!", 3500, 4);
    return 1;
}



Re: Name restrictions - RajatPawar - 07.05.2013

pawn Код:
new allowed_names[][] =
{
     "David_Johnson",
     "Melinda."
};

// Where you check
new name[ 24 ]; GetPlayerName(playerid, name , 24);
for( new i = 0; i < sizeof(allowed_names); i++ )
{
   if( strcmp( name, allowed_names[i], true) != -1)
   {
       // Allow names
   }
}