Job Disable

Hello,
I wanted to know if there was a way to only allow a certain job to be allowed to use for a certain rank from ulx?

Thanks!


TEAM_CITIZEN = DarkRP.createJob("Citizen", {
    color = Color(0, 177, 106, 255),
    regular = true,
    model = {
    "models/player/Group01/Female_01.mdl",
    "models/player/Group01/Female_02.mdl",
    "models/player/Group01/Female_03.mdl",
    "models/player/Group01/Female_04.mdl",
    "models/player/Group01/Female_06.mdl",
    "models/player/group01/male_01.mdl",
    "models/player/Group01/Male_02.mdl",
    "models/player/Group01/male_03.mdl",
    "models/player/Group01/Male_04.mdl",
    "models/player/Group01/Male_05.mdl",
    "models/player/Group01/Male_06.mdl",
    "models/player/Group01/Male_07.mdl",
    "models/player/Group01/Male_08.mdl",
    "models/player/Group01/Male_09.mdl"
    },
    description = [[The Citizen holds the most basic level of society you can hold besides being a hobo.
    You may own a house and have roommates.
    You have no specific role in city life.]],
    weapons = {},
    command = "citizen",
    max = 0,
    salary = 150,
    admin = 0,
    vote = false,
    hasLicense = false,
    candemote = false,
    customCheck = function(ply) 
        if ply:IsValid() then return (ply:CheckGroup("donator")) end 
    end,
    CustomCheckFailMsg = "You have not donated. This is a donator exclusive job."
})

Thank you!

[editline]12th March 2015[/editline]

How do I add more groups to be checked?

[editline]12th March 2015[/editline]

I’m doing this, but it’s not working.

customCheck = function(ply) 
    if ply:IsValid() then return (ply:CheckGroup("Moderator","Head Moderator","Section Administrator",
	"Administrator","Head Administrator", "superadmin", "Council", "Host")) end

[editline]12th March 2015[/editline]

It gives me this error as well.

[ERROR] Lua is unable to understand file “darkrp_customthings/jobs.lua” because its author made a mistake around line number 208.
The best help I can give you is this:

There is an opening ‘{’ bracket at line 196, but this bracket is never closed or not closed in time. It was expected to be closed before the ‘customCheck’ at line 208.

Hints:
- Did you forget a comma?
- All open brackets ({, (, [) must have a matching closing bracket. Are you sure it’s there?
- Brackets must be opened and closed in the right order. This will work: ({}), but this won’t: ({)}.

------- End of Simplerr error -------

ply:CheckGroup(group) only accepts one argument.
To check for multiple groups, you can just use an or operator in between each check.

(ply:CheckGroup(“donator”) or ply:CheckGroup(“admin”))

However, if you setup inheritance in ULX correctly, (such as donator on the bottom of the ladder), then you only need one check.

How about for the error?

There is an opening ‘{’ bracket at line 196, but this bracket is never closed or not closed in time. It was expected to be closed before the ‘customCheck’ at line 208.

Post your full job entry.

TEAM_STAFF = DarkRP.createJob(“Administration”, {
color = Color(0, 51, 0, 255),
model = “models/player/mnu_soldier.mdl”,
description = [[Admin on duty.]],
weapons = {""},
command = “admin”,
max = 0,
salary = 0,
admin = 0,
vote = false,
hasLicense = true,
candemote = false
customCheck = function(ply)
if ply:IsValid() then return (ply:CheckGroup(“Moderator”)) end
end,
CustomCheckFailMsg = “You do not have access.”
})

You need to put a comma after candemote = false

Thanks so much, it works!