SA-MP Forums Archive
Make a commands exclusively for a specific Player - Help Me! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Make a commands exclusively for a specific Player - Help Me! (/showthread.php?tid=146430)



Make a commands exclusively for a specific Player - Help Me! - ramshidjafar - 07.05.2010

Hello,

I have created a lot of garages, but i dont know how to make a Cmd to work only for a specific player and a greater Admin. If you people know anyway to make a specific Commands work for a specific player, Please Help Me!.
Eg:- When the player name is 'Ramshid'. And when types /opengate, the Gate opens, but never opens when others type it...


Any Idea about it... Please Give me.......


Thank You!


Re: Make a commands exclusively for a specific Player - Help Me! - CaHbKo - 07.05.2010

pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
if(!strcmp(name, "Ramshid"))
{
   //open gate
}
else SendClientMessage(playerid, 0xFFFFFFAA, "You're not Ramshid! Don't touch the gate!);



Re: Make a commands exclusively for a specific Player - Help Me! - ramshidjafar - 07.05.2010

Thanks for your help, but where i should put the cmd?
i mean the /gateopen cmd please include it and show me

Thank You very much!


Re: Make a commands exclusively for a specific Player - Help Me! - CaHbKo - 07.05.2010

Quote:
Originally Posted by ramshidjafar
Thanks for your help, but where i should put the cmd?
i mean the /gateopen cmd please include it and show me

Thank You very much!
I thought that you already got a command.

Look for some tutorial and just insert the command they suggest in the script I posted and post if something goes wrong.


Re: Make a commands exclusively for a specific Player - Help Me! - ramshidjafar - 07.05.2010

Well i have made another teleport one, see below!
Код:
if(!strcmp(pname,"Ramshid_Jafar"))
{
	  SetPlayerPos(playerid, 2320.4258, 584.7402, 7.7802);
	  SetPlayerInterior(playerid, 0);
	  return 1;
}
else SendClientMessage(playerid, 0xFFFFFFAA, "You're not Ramshid_Jafar! Don't type Again!");
That got compiled well, but i need to add TELEPORT CMD in between Can u say that?

EDIT:

I got fixed it!
Код:
if(!strcmp(pname,"Ramshid_Jafar"))
{
	if(strcmp(cmd, "/info", true) == 0) {
	  SetPlayerPos(playerid, 2320.4258, 584.7402, 7.7802);
	  SetPlayerInterior(playerid, 0);
	  return 1;
	}
	}
else SendClientMessage(playerid, 0xFFFFFFAA, "You're not Ramshid_Jafar! Don't type Again!");



Re: Make a commands exclusively for a specific Player - Help Me! - CaHbKo - 08.05.2010

Quote:
Originally Posted by ramshidjafar
I got fixed it!
Код:
if(!strcmp(pname,"Ramshid_Jafar"))
{
	if(strcmp(cmd, "/info", true) == 0) {
	  SetPlayerPos(playerid, 2320.4258, 584.7402, 7.7802);
	  SetPlayerInterior(playerid, 0);
	  return 1;
	}
}
else SendClientMessage(playerid, 0xFFFFFFAA, "You're not Ramshid_Jafar! Don't type Again!");
I'd suggest you making it like this..
pawn Код:
if(strcmp(cmd, "/info", true) == 0)
{
     if(!strcmp(pname,"Ramshid_Jafar")){
      SetPlayerPos(playerid, 2320.4258, 584.7402, 7.7802);
      SetPlayerInterior(playerid, 0);
      return 1;
    }
    else SendClientMessage(playerid, 0xFFFFFFAA, "You're not Ramshid_Jafar! Don't type Again!");
}
'else' will stop from working all commands below this one.