01.10.2011, 03:19
pawn Code:
CMD:setadminlevel(playerid, params[])
{
new oID, oLvl;
if (sscanf(params, "ui", oID, oLvl)) { return SendClientMessage(playerid, COLOR_WHITE, "... How to use it."); }
if (PlayerInfo[playerid][pAdmin] > 0)
{
if (oID != INVALID_PLAYER_ID)
{
if (PlayerInfo[playerid][pAdmin] > oLvl) { PlayerInfo[oID][pAdmin] = oLvl; }
else { return SendClientMessage(playerid, COLOR_WHITE, "... Can't set player as high or higher than you.");
}
else { return SendClientMessage(playerid, COLOR_WHITE, "... ID not connected/valid."); }
}
else { return SendClientMessage(playerid, COLOR_WHITE, "... Not an admin."); }
// Here you can spit out all the, admin has done blah blah, you have successfully blah blah.
// You can do it here, because if not successful, any 1 of the else cases will exit early.
return 1;
}
It can be different, but I just wrote this off the top of my head in the reply, it makes sure the admin setting a user as an admin, can not make them of equal or higher admin level. The messages are just place holders, can change them and of course add all your format/broadcast etc where the comments are.
If this still gives you an invalid ID, it's an invalid ID, press TAB in game to find out what ID's are actually connected.