Advertisement
Brownies

gm flags

Dec 9th, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.40 KB | None | 0 0
  1. ---------------------------------------------------------------------------------------------------
  2. -- func: togglegm
  3. -- auth: ZeDingo
  4. -- desc: Toggles a GMs nameflags/icon.
  5. ---------------------------------------------------------------------------------------------------
  6.  
  7. cmdprops =
  8. {
  9.     permission = 1,
  10.     parameters = ""
  11. };
  12.  
  13. function onTrigger(player)
  14.     -- Official Staff Flag Definition
  15.     local Flag_Official_Staff   = 0x03000000; -- Adds Official Staff Icon
  16.     -- GM Flag Definitions
  17.     local FLAG_GM               = 0x04000000;
  18.     local FLAG_GM_SENIOR        = 0x05000000;
  19.     local FLAG_GM_LEAD          = 0x06000000;
  20.     local FLAG_GM_PRODUCER      = 0x07000000;
  21.     local FLAG_SENIOR           = 0x01000000; -- Do NOT set these flags. These are here to
  22.     local FLAG_LEAD             = 0x02000000; -- ensure all GM status is removed.
  23.  
  24.     -- Configurable Options
  25.     local MINLVL_STAFF          = 1; -- If GM lvl set to 1 then use Official  staff icon
  26.     local MINLVL_GM             = 2; -- For "whitelisting" players to have some commands, but not GM tier commands.
  27.     local MINLVL_GM_SENIOR      = 3; -- These are configurable so that commands may be restricted
  28.     local MINLVL_GM_LEAD        = 4; -- between different levels of GM's with the same icon.
  29.     local MINLVL_GM_PRODUCER    = 5;
  30.  
  31.     if (player:checkNameFlags(FLAG_GM)) then
  32.         if (player:checkNameFlags(Flag_Official_Staff)) then -- new line for staff icon
  33.             player:setFlag(Flag_Official_Staff);             -- flag check
  34.         end
  35.         if (player:checkNameFlags(FLAG_GM)) then
  36.             player:setFlag(FLAG_GM);
  37.         end
  38.         if (player:checkNameFlags(FLAG_SENIOR)) then
  39.             player:setFlag(FLAG_SENIOR);
  40.         end
  41.         if (player:checkNameFlags(FLAG_LEAD)) then
  42.             player:setFlag(FLAG_LEAD);
  43.         end
  44.     else
  45.         local gmlvl = player:getGMLevel();
  46.         if (gmlvl >= MINLVL_GM_PRODUCER) then
  47.             player:setFlag(FLAG_GM_PRODUCER);
  48.         elseif (gmlvl >= MINLVL_GM_LEAD) then
  49.             player:setFlag(FLAG_GM_LEAD);
  50.         elseif (gmlvl >= MINLVL_GM_SENIOR) then
  51.             player:setFlag(FLAG_GM_SENIOR);
  52.         elseif (gmlvl >= MINLVL_GM) then
  53.             player:setFlag(FLAG_GM);
  54.         elseif (gmlvl >= MINLVL_STAFF) then         -- Check for "GM" lvl
  55.             player:setFlag(Flag_Official_Staff);    -- set staff icon flag
  56.     end
  57.     end
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement