Need a little help with this (MakeAdmin) - 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)
+--- Thread: Need a little help with this (MakeAdmin) (
/showthread.php?tid=501789)
Need a little help with this (MakeAdmin) -
ChristianIvann09 - 20.03.2014
I want this CMD.. that if a Level 5 admin is trying to set the playerid admin level to 6. it will says "Only Owner can make Players as Owner"
So, if you are Co Owner(Level 5 Admin) then you trying to my Admin level to 6 then it will return 1;.
and if im Owner i can make peoples owner
Код:
CMD:makeadmin(playerid, params[])
{
if(CheckGMX(playerid)) return 1;
if(PlayerInfo[playerid][pAdmin] >= 5)
{
new
iAdminValue,
iTargetID;
if(sscanf(params, "ui", iTargetID, iAdminValue))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid/partofname] [level]");
}
else if(IsPlayerConnected(iTargetID))
{
if(AdminDuty[iTargetID] != 0)
{
SendClientMessage(playerid, COLOR_WHITE, "That admin is currently on-duty. They must go off-duty in order for you to set their admin level.");
return 1;
}
new szMessage[47 + (MAX_PLAYER_NAME * 2)];
format(szMessage, sizeof(szMessage), "AdmCmd: %s has set %s to Level %d Admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
ABroadCast(COLOR_LIGHTRED,szMessage, 1);
PlayerInfo[iTargetID][pAdmin] = iAdminValue;
format(szMessage, sizeof(szMessage), "You have been set to Level %d Admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
SendClientMessage(iTargetID, COLOR_LIGHTBLUE, szMessage);
if(PlayerInfo[iTargetID][pHelper] >= 1) {
PlayerInfo[iTargetID][pHelper] = 0;
PlayerInfo[iTargetID][pAcceptReport] = 0;
}
if(iAdminValue == 0)
{
format(PlayerInfo[iTargetID][pAdminName], MAX_PLAYER_NAME, "0");
}
}
else SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified.");
}
else SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
return 1;
}
Re: Need a little help with this (MakeAdmin) -
Sascha - 20.03.2014
try it
pawn Код:
CMD:makeadmin(playerid, params[])
{
if(CheckGMX(playerid)) return 1;
if(PlayerInfo[playerid][pAdmin] >= 5)
{
new
iAdminValue,
iTargetID;
if(sscanf(params, "ui", iTargetID, iAdminValue))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid/partofname] [level]");
}
else if(IsPlayerConnected(iTargetID))
{
if(AdminDuty[iTargetID] != 0)
{
SendClientMessage(playerid, COLOR_WHITE, "That admin is currently on-duty. They must go off-duty in order for you to set their admin level.");
return 1;
}
new szMessage[47 + (MAX_PLAYER_NAME * 2)];
if(PlayerInfo[playerid][pAdmin] < 6 && iAdminValue == 6)
{
SendClientMessage(playerid, COLOR_WHITE, "You can't set the level to owner.");
return 1;
}
format(szMessage, sizeof(szMessage), "AdmCmd: %s has set %s to Level %d Admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
ABroadCast(COLOR_LIGHTRED,szMessage, 1);
PlayerInfo[iTargetID][pAdmin] = iAdminValue;
format(szMessage, sizeof(szMessage), "You have been set to Level %d Admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
SendClientMessage(iTargetID, COLOR_LIGHTBLUE, szMessage);
if(PlayerInfo[iTargetID][pHelper] >= 1) {
PlayerInfo[iTargetID][pHelper] = 0;
PlayerInfo[iTargetID][pAcceptReport] = 0;
}
if(iAdminValue == 0)
{
format(PlayerInfo[iTargetID][pAdminName], MAX_PLAYER_NAME, "0");
}
}
else SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified.");
}
else SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
return 1;
}