UTime Job timer with ranks

Hi, so I need help with setting up utime with jobs. Basically I want to set up my police job that has a requirement of 6 hours of play time. I want utime to track the amount of hours a user has, and will not let them join the police until they have 6 hours or more on the server. I also want a custom message that pops up when they do try to become police saying “You need 6 hours of playtime”.

I also want VIP and Super VIP ulx ranks to bypass this timer, so when users have under 6 hours but with either of these ranks, they can get into the police job.

I have searched around how to do this but I cant find anything, could someone please help me add this in, thanks


Instead of doing
ply:GetUserGroup() == “donator”
in the CustomCheck do [lua]ply:GetUTime() >= 18000[/lua] (5 hours)

And how would we bypass this time limit as VIP ranks?

return ply:GetUserGroup() == “VIP” or ply:GetUTime() >= 18000

customCheck = function(ply) return ply:GetUTimeTotalTime() >= 18000 end,
CustomCheckFailMsg = “You don’t have enough time”

I added this to my job, this works. How would I add in that code to make it so VIP and other ranks can skip the time?

[editline]14th January 2017[/editline]

Okay so quick edit, I figured out how this works but I feel like this can be changed into a more simple and effective way. I have this set to my police job:

customCheck = function(ply)
            if ply:GetUTimeTotalTime() >= 18000 then
                return true
            elseif CLIENT or table.HasValue({"VIP", "SuperVIP","Owner", "SuperAdmin", "Admin", "Mod"}, ply:GetNWString("usergroup")) then
                if ply:GetUTimeTotalTime() >= 0 then
                    return true
                    if CLIENT then
                        return true
                        return false
                return false
       CustomCheckFailMsg = "You need 5 hours play time to become this job"

There’s really no need to recreate the table every time. Just do something like this:

-- Outside the job table
local AllowedRanks = {
	vip = true,
	supervip = true,
	owner = true,
	superadmin = true,
	admin = true,
	mod = true

-- In the job table
customCheck = function(ply) return CLIENT or AllowedRanks[ply:GetUserGroup():lower()] or ply:GetUTimeTotalTime() >= 18000 end,
CustomCheckFailMsg = "You need 5 hours play time to become this job"

That doesnt work, all the ranks still need a required play time it says

Try with GetNWString(“usergroup”) instead. An addon could be overriding GetUserGroup.