SA-MP Forums Archive
player specific command - 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: player specific command (/showthread.php?tid=232374)



player specific command - marine - 27.02.2011

Is it possible to make a command player specific? like you have to be logged in as this person in order to use it. I remember it being possible to make vehicles player specific so I would thing commands could be also. If it is, how would i do that?

Code:
if(strcmp(cmd, "/oldcar", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
		    format(string, sizeof(string), "Your old car was: %d",gLastCar[playerid]);
		    SendClientMessage(playerid, COLOR_ORANGE, string);
		    
			format(string, sizeof(string), "[ADMIN]: %s Has Asked to the System his Old Car", sendername);
			ABroadCast(COLOR_LIGHTRED, string, 5);
			new y, m, d;
			new h,mi,s;
			getdate(y,m,d);
			gettime(h,mi,s);
			format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Asked for his Old Car",d,m,y,h,mi,s,sendername);
			AdminLog(string);
	    }
	    return 1;
	}



Re: player specific command - Bogdanovic - 27.02.2011

For Example If player is Admin?
Insert this in your Script:

pawn Code:
if(!IsPlayerAdmin(playerid)) return 1;



Re: player specific command - Mean - 27.02.2011

We need to see your logged variable. Otherwise we can't help you.


Re: player specific command - marine - 28.02.2011

No, not admin.....
Like in-game, my name is Frank_James
I want it so only Frank_James can use a command


Re: player specific command - Unknown123 - 28.02.2011

Quote:
Originally Posted by marine
View Post
No, not admin.....
Like in-game, my name is Frank_James
I want it so only Frank_James can use a command
NOT TESTED!
pawn Code:
stock IsPlayerFrankJames(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    if(!strcmp(name, "Frank_James", false)) return 1;
    return 0;
}
Example:
pawn Code:
dcmd_bye(playerid, params[])
{
    #pragma unused params
    if(!IsPlayerFrankJames(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "This command is just for Frank_James");
    {
        SendClientMessageToAll(0xFF0000FF, "Frank_James sais BYE! to everyone!");
        return 1;
    }
}