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
Lordz™
High-roller
 
Lordz™'s Avatar
 
Join Date: Mar 2012
Location: NetherRealm
Posts: 2,208
Reputation: 707
Default Re: Command for specified player.

if(GetPlayerName(playerid,Kalroz));
I think we must use like this ^
But IM NOT SURE.
__________________
You're awesome if you viewed this!

Latest ones:

Tutorial - Securing RCON
Lordz™ is online now   Reply With Quote
Old 15/07/2012, 07:52 AM   #3
_Jake_
High-roller
 
_Jake_'s Avatar
 
Join Date: Apr 2012
Location: Land of Ooo
Posts: 2,794
Reputation: 294
Default Re: Command for specified player.

^^ No wrong use strcmp like this

pawn 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;
}
__________________
I stopped playing stunt servers long time ago and decided to enter the RolePlay servers and roleplay with it, You would find me playing in P:LA or in any popular servers, edit or not, My roleplay name would be always Ronald_Lacson.


When on UN-RP servers, My username would be always Jake_Hero, If you want to add me on Skype, the ID would be, spencer_

I need a user who can let me use JakAdmin 3.2.2 on their servers, I am glad if someone will let me, It's not that i will steal anything - You're the one who'll upload the Beta Script.
_Jake_ 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,325
Reputation: 137
Default Re: Command for specified player.

lol?
you should use strcmp like
pawn 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;
}
__________________
$$$ Willing to offer my services to script or map some of the stuff for Money.
If anyone want to get any of these:
  • 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.
•••[0.3x]LCS•Freeroam•DM•Stunts•Race•Parkour•••AutoArena [0.3z][No SkinShot][sixtytiger.com]Want a decent Attack Defend Gamemode?
176.31.120.76:7777176.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
pawn 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 03:47 PM.


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