/setadmin and /setvip etc.
#11

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;
}
That should just about suffice.

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.
Reply


Messages In This Thread
/setadmin and /setvip etc. - by Azzeto - 30.09.2011, 23:56
Re: /setadmin and /setvip etc. - by GrimR - 01.10.2011, 00:13
Re: /setadmin and /setvip etc. - by Kingunit - 01.10.2011, 00:14
Re: /setadmin and /setvip etc. - by Azzeto - 01.10.2011, 00:38
Re: /setadmin and /setvip etc. - by grand.Theft.Otto - 01.10.2011, 02:07
Re: /setadmin and /setvip etc. - by Azzeto - 01.10.2011, 02:22
Re: /setadmin and /setvip etc. - by Pharrel - 01.10.2011, 02:25
Re: /setadmin and /setvip etc. - by Azzeto - 01.10.2011, 02:50
Re: /setadmin and /setvip etc. - by Pharrel - 01.10.2011, 02:54
Re: /setadmin and /setvip etc. - by Azzeto - 01.10.2011, 02:57
Re: /setadmin and /setvip etc. - by GrimR - 01.10.2011, 03:19
Re: /setadmin and /setvip etc. - by DRIFT_HUNTER - 01.10.2011, 03:46
Re: /setadmin and /setvip etc. - by Azzeto - 01.10.2011, 04:00

Forum Jump:


Users browsing this thread: 2 Guest(s)