SA-MP Forums Archive
Command for specified player. - 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: Command for specified player. (/showthread.php?tid=359755)



Command for specified player. - Kalroz - 15.07.2012

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.


Re: Command for specified player. - Lordzy - 15.07.2012

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


Re: Command for specified player. - JaKe Elite - 15.07.2012

^^ 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;
}



Re: Command for specified player. - Niko_boy - 15.07.2012

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;
}



Re: Command for specified player. - clarencecuzz - 15.07.2012

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.