18.02.2012, 13:45
Title, basicly. I want a form, that, for example, if the player's name is Rodger_Dodger, he get's access to (a) command(s). Could anyone of you give me a example?
new Pname[24];
GetPlayerName(playerid, Pname, 24);
if(strcmp(Pname, "NameHere", true) == 0) //set the name here
{
//What you do, here.
return 1;
}
return 1;
}
CMD:lol(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,COLOR,"You are not authorized to use that command!"); //checks, if the player has got a high enough level, pAdmin is the enum-var which gets us the info
SendClientMessage(playerid,COLOR,"lol!");
return 1;
}
//Use this stock, paste it at the bottom of your script outside other callbacks.
stock IsPlayerName(playerid, const name[], bool:ignore_case=false)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof playername);
if(!strcmp(playername, name, ignore_case)) return true;
return false;
}
CMD:guy(playerid, params[])
{
if(IsPlayerName(playerid, "Some_Guy"))
{
SendClientMessage(playerid, -1, "Hello some guy!");
} else SendClientMessage(playerid, -1, "You're not some guy!");
return true;
}