Command for specified player.
#1

Hello all,
I need to make a command in which that command works only with specified name.
For example that specified name is Kalroz.
Can anyone create that?
It's urgent.
Reply
#2

if(GetPlayerName(playerid,Kalroz));
I think we must use like this ^
But IM NOT SURE.
Reply
#3

^^ No wrong use strcmp like this

pawn Код:
CMD:iloveyou(playerid, params[])
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    if(strcmp(name, "Kalroz", true) == 0)
    {
         SendClientMessage(playerid, -1, "You know what you have been faked!");
    }
    else return SendClientMessage(playerid, -1, "Fuck u n00b you are not Kalroz");
    return 1;
}
Reply
#4

lol?
you should use strcmp like
pawn Код:
CMD:test(playerid,params[])
{  
   new pname[24];
   GetPlayerName(playerid,pname,sizeof(pname))
   if(!strcmp(pname,"NAME",false)) // it is case sensitive check to see if player who use command has name "NAME"
   {
      SendClientMessage(playerid,-1,"Yo! this is special command for you only <3 ");
     //command code
   }else return SendClientMessage(playerid,-1,"YOU NOT THE PERSON FOR WHICH THIS COMMAND HAS BEEN MADE");
   return 1;
}
Reply
#5

Quote:
Originally Posted by Niko_boy
Посмотреть сообщение
lol?
you should use strcmp like
pawn Код:
CMD:test(playerid,params[])
{  
   new pname[24];
   GetPlayerName(playerid,pname,sizeof(pname))
   if(!strcmp(pname,"NAME",false)) // it is case sensitive check to see if player who use command has name "NAME"
   {
      SendClientMessage(playerid,-1,"Yo! this is special command for you only <3 ");
     //command code
   }else return SendClientMessage(playerid,-1,"YOU NOT THE PERSON FOR WHICH THIS COMMAND HAS BEEN MADE");
   return 1;
}
@Niko_boy Ha lol no?

if(strcmp(...,...,...) == 0) is the same as !strcmp...

@Romel, you have strcmp(...,...,TRUE) == 0. This means that your have ignorecase enabled, which means a player can enter the server with the name KaLRoZ and still be accepted... must be set to false in this instance.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)