player specific command
#1

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;
	}
Reply
#2

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

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)