SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/07/2012, 07:42 AM   #1
Kalroz
Big Clucker
 
Join Date: Jul 2012
Location: Shadows
Posts: 86
Reputation: 41
Default Command for specified player.

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.
__________________
If you liked my thread/work or if I've helped you,please Repute me.
Join World Of Scripters ==>www.xgtdms.createaforum.com
My name in xgtdms ==> Kalroz
Kalroz is offline   Reply With Quote
Old 15/07/2012, 07:46 AM   #2
Lordzy
High-roller
 
Join Date: Mar 2012
Location: NetherRealm
Posts: 2,711
Reputation: 916
Default Re: Command for specified player.

if(GetPlayerName(playerid,Kalroz));
I think we must use like this ^
But IM NOT SURE.
Lordzy is offline   Reply With Quote
Old 15/07/2012, 07:52 AM   #3
JaKe Elite
High-roller
 
Join Date: Apr 2012
Location: Philippines
Posts: 3,112
Reputation: 346
Default Re: Command for specified player.

^^ No wrong use strcmp like this

Code:
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;
}
__________________

Scratch Roleplay,
New Script Development Progress
98%

Features: New MySQL,Dynamic Features,Realistic Economy+
Stay Tune!
JaKe Elite is offline   Reply With Quote
Old 15/07/2012, 07:53 AM   #4
Niko_boy
High-roller
 
Niko_boy's Avatar
 
Join Date: Aug 2010
Location: Somewhere i belong
Posts: 1,452
Reputation: 138
Default Re: Command for specified player.

lol?
you should use strcmp like
Code:
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;
}
__________________
$$$ If anyone NEED A SCRIPTER for:
  • DM/TDM/Freeroam/Stunt server, filterscripts or Bug fixing.or some general mapping. Above all any of the logos and banners or signature sorta stuff aswell.At some cheap and worth-full prices.
can Contact me for more info or a deal.
•••[CLOSED]LCS•Freeroam•DM•Stunts•••AutoArena [0.3z][No SkinShot][sixtytiger.com]Want a decent Attack Defend Gamemode?
N/A176.31.229.148:7830Get This! Attack-Defend(v2.3.1)
Niko_boy is offline   Reply With Quote
Old 15/07/2012, 08:21 AM   #5
clarencecuzz
Gangsta
 
Join Date: Jul 2010
Location: Australia
Posts: 940
Reputation: 89
Default Re: Command for specified player.

Quote:
Originally Posted by Niko_boy View Post
lol?
you should use strcmp like
Code:
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.
clarencecuzz is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get the Name of Player used some Command? Saw® Scripting Help 6 05/09/2011 11:14 PM
Slap command returns an Unknown Command when player is not connected HydraX Help Archive 16 01/08/2011 05:19 AM
player command farris Help Archive 1 09/09/2010 12:56 AM
Command for near Player HardstylerNiko Help Archive 3 05/09/2010 10:08 AM
Player to Player /sendcash command?? sheepondrugs Help Archive 4 17/08/2010 05:19 PM


All times are GMT. The time now is 11:45 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.