Name Commands,Name Tags
#1

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
Reply
#2

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)
Reply
#3

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.
Reply
#4

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

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
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)