Custom Check Job

Hello,
I wanted to know how do I add to check two groups in ulx that are being inherited by others? As of currently this code is not working.
Thank you.


	    customCheck = function(ply) 
        if ply:IsValid() then return ply:CheckGroup("VIP") or ply:CheckGroup("VIP Moderator") end 
    end,
	CustomCheckFailMsg = "You do not VIP."

Try IsUserGroup instead of CheckGroup


	customCheck = function(ply) return table.HasValue({"gold", "diamond", "admin", "superadmin", "communitydirector", "founder"},ply:GetUserGroup()) end,

I use the above and it works very well. I prefer to check for every group instead of inherited ones. Just replace my ranks with yours :stuck_out_tongue:

No need to loop over the table like that.
[lua]
local ranks = { [“gold”] = true, [“diamond”] = true, [“admin”] = true, [“superadmin”] = true, [“communitydirector”] = true, [“found”] = true }
customCheck = function( ply ) return ( ranks[ply:GetUserGroup( )] ) end
[/lua]

Well I guess you learn something everyday. Also, question: Would looping over the table cause noticeable lag?

Depends on how many elements you are looping over and your sorting

No not in that function, but everyone here will tell you that you will reach O( n ). In layman’s terms, you shouldn’t. It’s bad practice, especially when you start having larger tables/start using loops in functions that are called more rapidly.

This works extremely well, thank you very much!