Ulysses

General => Developers Corner => Topic started by: Promptitude on January 04, 2016, 12:30:14 PM

Title: Making ULX Ranks apply to the IsAdmin() Class
Post by: Promptitude on January 04, 2016, 12:30:14 PM
How would I go about making certain ULX ranks apply to the IsAdmin() class?
Title: Re: Making ULX Ranks apply to the IsAdmin() Class
Post by: Decicus 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().
Title: Re: Making ULX Ranks apply to the IsAdmin() Class
Post by: Promptitude 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
Title: Re: Making ULX Ranks apply to the IsAdmin() Class
Post by: JamminR 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.