SA-MP Forums Archive
Name Commands,Name Tags - 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 Commands,Name Tags (/showthread.php?tid=371564)



Name Commands,Name Tags - SumX - 23.08.2012

Hello!
It is possible to make a command only for a player who's name is SumX? (example) I was thinking to use strmatch?...I am using ZCMD + sscanf.
It is possible when I set a player's AdminLevel to change his name too into [ADMIN]Name,or I will screw up the acounts?I am using Y_INI and my variable is GetPVarInt(playerid,"AdminLevel") .
Thank you!
SumX


Re: Name Commands,Name Tags - Sielly - 23.08.2012

yes it is,
add something like this:
Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
if(strcmp(name, "SumX", true) != 0) return 1;
(i didn't try it, but it should work)


Re: Name Commands,Name Tags - clarencecuzz - 23.08.2012

pawn Код:
CMD:setlevel(playerid,params[])
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    if(strcmp(name, "SumX", false) == 0)
    {
    }
    else return SendClientMessage(playerid, 0xFF0000FF, "Only 'SumX' can use this command!");
    return 1;
}
EDIT: @ Above Poster, ignorecase must be false. Otherwise players can join as SuMX or sUmX and still gain access to it.


Re: Name Commands,Name Tags - Sielly - 23.08.2012

I don't know, if his server check case on login.


Re: Name Commands,Name Tags - XStormiest - 23.08.2012

pawn Код:
CMD:setlevel(playerid,params[])
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    if(strcmp(name, "SumX", false) == 0)
    {
                   new name[MAX_PLAYER_NAME], string[256];
                GetPlayerName(playerid,name,sizeof(name));
                format(string,sizeof(string),"[ADMIN]%s",name);
                  SetPlayerName(playerid,string);
    }
    else return SendClientMessage(playerid, 0xFF0000FF, "Only 'SumX' can use this command!");
    return 1;
try this