• How to add 2 custom checks on DarkRP jobs?
    4 replies, posted
So this is my code, [code]TEAM_VIPMETH = DarkRP.createJob("VIP Meth Cook", { -- Name color = Color(238, 99, 99, 255), -- Team color model = "models/player/hostage/hostage_01.mdl", -- Player model description = [[Cook Meth, and sell it to the Meth Dealer.]], -- Job description weapons = {"m9k_fists"}, -- Additional weapons command = "VIPmeth", -- Command to become the job max = 0, -- Maximum amount of said job salary = 200, -- Salary admin = 0, -- Requires Admin? 1 for yes, 0 for no. vote = false, -- Do they need to vote? true for yes, false for no. hasLicense = false, -- Has a license customCheck = function(ply) return ply:GetNWString("usergroup") == "donator" or ply:IsAdmin() end, -- The extra check function. Enter nil or nothing to not have a restriction CustomCheckFailMsg = "This job is VIP only!" -- Allows you to tell the user what went wrong when attempting to switch jobs })[/code] I'm trying to add 2 custom checks for the donator rank, because basically a mod of mine donated but I'm unable to give 2 groups. That's why I made a new group but I'm wondering how can I add another custom check to this job? would it be == "donator", "anothergroup" ?
Try something like this. [CODE] local UserGroups = {"vip", "admin", "superadmin"} customCheck = function(ply) return table.HasValue(UserGroups, ply:GetUserGroup()) end, [/CODE]
[QUOTE=SexyBeast70;48359645]Try something like this. [CODE] local UserGroups = {"vip", "admin", "superadmin"} customCheck = function(ply) return table.HasValue(UserGroups, ply:GetUserGroup()) end, [/CODE][/QUOTE] Should there be a comma at the end of local UserGroups = {"vip", "admin", "superadmin"}?
[QUOTE=JohnathanRust;48359693]Should there be a comma at the end of local UserGroups = {"vip", "admin", "superadmin"}?[/QUOTE] Don't put the table inside your job, put it at the top of the jobs file or something.
[QUOTE=SexyBeast70;48359725]Don't put the table inside your job, put it at the top of the jobs file or something.[/QUOTE] Ah.. I actually googled your code thinking maybe there would be something similar, and I found this. [url]http://facepunch.com/showthread.php?t=1418458[/url] Seems more efficient for me, as it would be easier in the future if I wanted to add more jobs. Thanks for the help anyways!
Sorry, you need to Log In to post a reply to this thread.