ULX

Author Topic: Making ULX Ranks apply to the IsAdmin() Class  (Read 3008 times)

0 Members and 1 Guest are viewing this topic.

Offline Promptitude

  • Newbie
  • *
  • Posts: 9
  • Karma: 1
Making ULX Ranks apply to the IsAdmin() Class
« on: January 04, 2016, 12:30:14 PM »
How would I go about making certain ULX ranks apply to the IsAdmin() class?

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Making ULX Ranks apply to the IsAdmin() Class
« Reply #1 on: January 04, 2016, 12:36:38 PM »
If I remember right, make the group inherit from the default "admin" group.

Same goes for "superadmin" and IsSuperAdmin().
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline Promptitude

  • Newbie
  • *
  • Posts: 9
  • Karma: 1
Re: Making ULX Ranks apply to the IsAdmin() Class
« Reply #2 on: January 04, 2016, 12:43:29 PM »
I found this in the Garry's Mod Github.

Code: [Select]
--[[---------------------------------------------------------
    Name: IsAdmin
    Desc: Returns if a player is an admin.
-----------------------------------------------------------]]
function meta:IsAdmin()
    if self:IsSuperAdmin() then return true end
    if self:IsUserGroup("admin") then return true end

    return false
end

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Making ULX Ranks apply to the IsAdmin() Class
« Reply #3 on: January 04, 2016, 02:10:27 PM »
promptitude, what decicus says is correct.
ULib, and therefore ULX, allow inheritance.
If you set any group to inherit the admin group in your group setup, IsAdmin will return true.
Be warned however, Gmod's admin access allows much control over a server.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming