Articles on: Garry's Mod

How to hide jobs in the DarkRP F4 Menu (DarkRP/bWhitelist/Xenin F4)

🥷 Hiding your DarkRP Jobs in the F4 Menu


Whether you are using the normal method or using bWhitelist we have a guide on how to use both to hide jobs players are not suppose to see!

🛂 How to hide your DarkRP jobs in the F4 Menu using the jobs.lua file


If you are not using bWhitelist to manage your jobs permissions you can always use the job file itself.


🚻 Making the job only visible to User Groups (e.g. vip/mod/etc..)


If you want to make a job only visible to a certain user group whether it be your donators or staff this is how you would achieve that.

Below is an example job that is only accessible by the "vip" and "supervip" group.
TEAM_PHYSGUN_VIP = DarkRP.createJob("Physgun VIP", {
    color = Color(0, 130, 255),
    model = "models/player/skeleton.mdl",
    description = [[
        The epic Physgun V.I.P job!
    ]],
    weapons = {},
    command = "physgunvip",
    salary = 5000,
    hasLicense = false,
    category = "Physgunners",
    customCheck = function(ply) 
        return table.HasValue({"vip", "supervip"}, ply:GetUserGroup()) 
    end,
    CustomCheckFailMsg = "Only V.I.Ps can use this job!",
})


The customCheck dictates the jobs' visibility since there is no return CLIENT or ... only people in that group can see the job.
customCheck = function(ply) 
    return table.HasValue({"vip", "supervip"}, ply:GetUserGroup()) 
end,


In the table.HasValue({"group_here"}, ply:GetUserGroup()) function is what determines which group can see the job, simply change group_here to whichever group you want to see the specific job.
You can also add more groups to this job by simply adding a comma and a new string such as: "group_one", "group_two".


🛅 Making the job only visible to Other Jobs (e.g. only TEAM_COP can see TEAM_SWAT)


If you want your job to only be visible when the player is on a specific job you can do so with the same custom check!

Below is an example of the job "TEAM_SWAT" that can only be accessed if you are on "TEAM_COP"
TEAM_SWAT = DarkRP.createJob("Swat", {
    color = Color(0, 130, 255),
    model = "models/player/skeleton.mdl",
    description = [[
        The S.W.A.T job!
    ]],
    weapons = {},
    command = "swat",
    max = 4,
    salary = 5000,
    hasLicense = true,
    category = "Police",
    customCheck = function(ply) 
        return table.HasValue({TEAM_COP}, ply:Team()) 
    end,
    CustomCheckFailMsg = "Only other police can use this job!",
})


Currently the customCheck is set to ply:Team() so that means instead of looking for a group from your admin system it will look for the DarkRP job identifier.
customCheck = function(ply) 
    return table.HasValue({TEAM_COP}, ply:Team()) 
end,


The table.HasValue({TEAM_COP}, ply:Team()) determines what jobs can see the "Swat" job in the F4 menu.
You can add more jobs by simply adding a comma like such: TEAM_COP, TEAM_CHIEF_POLICE.
An example of multiple jobs would look like this:
customCheck = function(ply) 
    return table.HasValue({TEAM_COP, TEAM_CHIEF_POLICE}, ply:Team()) 
end,



🪪 Making the job only visible to Steam IDs (This is used best with Custom Jobs)


Sometimes you may have a donator who bought a "Custom Job" and you only want them to see it and use it, luckily you can do so with another custom check!

Below is an example of a job restricted to only a specific SteamID
TEAM_CUSTOM_JOB = DarkRP.createJob("Insane Custom Job", {
    color = Color(0, 130, 255),
    model = "models/player/skeleton.mdl",
    description = [[
        This is your own Custom Job!
    ]],
    weapons = {},
    command = "customjob",
    max = 4,
    salary = 5000,
    hasLicense = true,
    category = "Physgunners",
    customCheck = function(ply) 
        return table.HasValue({"STEAM_0:1:57080031"}, ply:SteamID()) 
    end,
    CustomCheckFailMsg = "Only Lunaversity can use this job!",
})


The customCheck is currently set to ply:SteamID() which means it will check for specific SteamID(s). This is incredibly useful for custom jobs for specific players.
customCheck = function(ply) 
    return table.HasValue({"STEAM_0:1:57080031"}, ply:SteamID()) 
end,


The function table.HasValue({"STEAM_0:1:57080031"}, ply:SteamID()) is what determines who can see the job, obviously inside it is a SteamID in a string, this is how you add SteamID(s) to a custom check.
Below is an example of multiple SteamIDs in one customCheck. Simply just use a comma to add an extra string with a new SteamID
(ex: "STEAM_0:1:57080031", "STEAM_0:1:509579920")

customCheck = function(ply) 
    return table.HasValue({"STEAM_0:1:57080031", "STEAM_0:1:509579920"}, ply:SteamID()) 
end,



📑How to hide jobs using bWhitelist


If you're using Billy's Whitelist hiding jobs is incredibly easy with a single button!

Simply follow the steps below to make whitelisted jobs hidden from people who are not whitelisted to them.

Open the bWhitelist menu (!bwhitelist)
Click on Operator at the top right
Click on Settings
Click ShowUnjoinableJobs until it is red (disabled)
Disabling jobs from being seen when not whitelisted

That's it! Super simple!


💎 How to hide jobs with the Xenin F4 Menu



By default all jobs even ones that users cannot access will be shown to everyone.
To prevent people from seeing jobs they do not have access to simply follow the steps below!

Navigate to addons/xenin-f4/lua/xenin_f4/configuration/config.lua
Scroll down to line 81 you will see the option: cfg:SetHideOnCustomCheckFail(false)
Set the false boolean to true
Click Save File and restart your server

You're done! Jobs with custom checks should be hidden!

Updated on: 28/06/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!