CMD:makeadmin(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 99998) { new iAdminValue, iTargetID; if(sscanf(params, "ui", iTargetID, iAdminValue)) { SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]"); SendClientMessageEx(playerid, COLOR_GRAD1, "Server Moderator[1], Junior Admin[2], General Admin[3], Senior Admin[4], Head Admin[1337]"); SendClientMessageEx(playerid, COLOR_GRAD1, "Server Manager[1338], Server Co-Owner[99998], Server Owner[99999]"); } 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; }
When im a Level 99998 admin and i tried to make players 99999 admin. It will return SendClientMessage(playerid,COLOR_WHITE, "You cannot make players 99999 Admin. Only Server Owner can do that!");
But how can i do that? Here is my /makeadmin code Код:
CMD:makeadmin(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 99998) { new iAdminValue, iTargetID; if(sscanf(params, "ui", iTargetID, iAdminValue)) { SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]"); SendClientMessageEx(playerid, COLOR_GRAD1, "Server Moderator[1], Junior Admin[2], General Admin[3], Senior Admin[4], Head Admin[1337]"); SendClientMessageEx(playerid, COLOR_GRAD1, "Server Manager[1338], Server Co-Owner[99998], Server Owner[99999]"); } 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; } |
Why would a Lower Level Admin be able to make Admins Higher level than themself?
|
if(PlayerInfo[playerid][pAdmin] >= 99998)
if(PlayerInfo[playerid][pAdmin] <= 99998)
if(PlayerInfo[playerid][pAdmin] < 99998)
Simple mistake.
pawn Код:
> - More. < - Less Just change it to pawn Код:
and also, if you want a 99998'th level admin to use this command, then use this pawn Код:
|
if(PlayerInfo[playerid][pAdmin] >= 99998)
CMD:makeadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 99999)
{
new
iAdminValue,
iTargetID;
if(sscanf(params, "ui", iTargetID, iAdminValue)) {
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Moderator[1], Junior Admin[2], General Admin[3], Senior Admin[4], Head Admin[1337]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Manager[1338], Server Co-Owner[99998], Server Owner[99999]");
}
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 a fucker! You can't do this !");
return 1;
}