Is it possible to allow a certain person to use a command?
#1

Alright, so I was wondering is it possible to allow someone access to a command? Such as I'd like to be able to use my /makeadmin and /maketempadmin commands whilst I am online and have removed my admin. I have a undercover admin rank in which I use time to time but I've got to close my game and edit my user stats.

So I was wondering is it possible to allow myself access?

Код:
CMD:makeadmin(playerid, params[])  {
	if(PlayerInfo[playerid][pAdmin] >= 100004)
	{
		new
		iAdminValue,
		iTargetID;

		if(sscanf(params, "ui", iTargetID, iAdminValue))
		{
			SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
		}
		else if(IsPlayerConnected(iTargetID))
		{
				new
				szMessage[47 + (MAX_PLAYER_NAME * 2)];

				PlayerInfo[iTargetID][pAdmin] = iAdminValue;
				format(szMessage, sizeof(szMessage), "AdmCmd: %s has promoted %s to a level %d admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
				ABroadCast(COLOR_LIGHTRED,szMessage, 2);
				format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
				SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
				format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", GetPlayerNameEx(iTargetID),iAdminValue);
				SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
		}
		else SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid player specified.");
	}
	else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
	return 1;
}

CMD:maketempadmin(playerid, params[])
{
	new string[128], giveplayerid, minutes, rank;
	if(sscanf(params, "udd[64]", giveplayerid, rank, minutes)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /maketempadmin [playerid] [rank] [minutes]");
	if(PlayerInfo[playerid][pAdmin] >= 100004) {
		if(IsPlayerConnected(giveplayerid)) {
			if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin]) {
				SendClientMessageEx(playerid, COLOR_WHITE, "You can't perform this action on an equal or higher level administrator.");
				return 1;
			}
			PlayerInfo[giveplayerid][pAdmin] = rank;
			IsTempAdmin[giveplayerid] = 1;
			/*new IsTempAdmin[MAX_PLAYERS];*/
			PlayerInfo[giveplayerid][pAdminTime] = minutes*60;
			format(string, sizeof(string), "AdmCmd: %s has been temporarily made Level %d Admin for %d minutes by %s", GetPlayerNameEx(giveplayerid), rank, minutes, GetPlayerNameEx(playerid));
			SendClientMessageToAllEx(COLOR_LIGHTRED, string);
			/*format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s for %d minutes.", rank, GetPlayerNameEx(playerid), minutes);
			SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, szMessage);*/
		}
		else SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid player specified.");
	}
	else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
	return 1;
}
I've got it set via on my ban and kick commands so if someone attempts to ban or kick me it'll automatically do whatever they've did back on them. So I was wondering about allowing myself /makeadmin.
Reply
#2

strcmp ..
Reply
#3

strcmp as it was said above


PHP код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playeridnameMAX_PLAYER_NAME);

if(!
strcmp(name"Name"true4)) 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)