• Lil help with custom jobs
    6 replies, posted
So.... I got my custom jobs working and stuff, but the thing that is weird are that when your a user and you join the server. You can't see the job that is for donator, but if you become a donator than you can see the job in the F4 menu. I want it so that all ranks can see the job so when the custom message comes up then they can see what jobs are donator and can donate to get those jobs. Without the users seeing them then they don't know if there are any donator jobs and they won't donate. So.... Is there a way to fix this?
put this in the TEAM_VIPJOB {} where the CustomCheck is supposed to be tag under the last line that you have [CODE]customCheck = function(ply) return CLIENT or table.HasValue({"donator"}, ply:GetNWString("usergroup")) end, CustomCheckFailMsg = "You are not a Donator",[/CODE]
[QUOTE=issykul;46090162]put this in the TEAM_VIPJOB {} where the CustomCheck is supposed to be tag under the last line that you have [CODE]customCheck = function(ply) return CLIENT or table.HasValue({"donator"}, ply:GetNWString("usergroup")) end, CustomCheckFailMsg = "You are not a Donator",[/CODE][/QUOTE] You should really just create a local file table of all groups that can use those jobs instead of using table.HasValue. Also, why would you even look in a table for one user group? That's wildly inefficient.
[QUOTE=issykul;46090162]put this in the TEAM_VIPJOB {} where the CustomCheck is supposed to be tag under the last line that you have [CODE]customCheck = function(ply) return CLIENT or table.HasValue({"donator"}, ply:GetNWString("usergroup")) end, CustomCheckFailMsg = "You are not a Donator",[/CODE][/QUOTE] I have that but a lil different and I use ulx [CODE] TEAM_SWAT = DarkRP.createJob("Swat", { color = Color(70, 130, 180), model = {"models/player/police.mdl", "models/player/police_fem.mdl"}, description = [[You have been a Swat Recruit for years and finally you became one of the big boys! Swat can only help Swat on raids and protec]], weapons = {"fas2_m4a1", "stunstick", "door_ram", "weaponchecker"}, command = "Swat", max = 2, salary = GAMEMODE.Config.normalsalary * 1.45, admin = 0, vote = true, hasLicense = false, customCheck = function(ply) return table.HasValue({"donator", "Moderator", "admin", "superadmin", "Owner"}, ply:GetUserGroup("usergroup")) end, CustomCheckFailMsg = "Sorry, this class is donator only! Go to the website to become a donator" , ammo = { ["pistol"] = 60, } }) [/CODE]
[QUOTE=PopPop;46093465]I have that but a lil different and I use ulx TEAM_SWAT = DarkRP.createJob("Swat", { color = Color(70, 130, 180), model = {"models/player/police.mdl", "models/player/police_fem.mdl"}, description = [[You have been a Swat Recruit for years and finally you became one of the big boys! Swat can only help Swat on raids and protec]], weapons = {"fas2_m4a1", "stunstick", "door_ram", "weaponchecker"}, command = "Swat", max = 2, salary = GAMEMODE.Config.normalsalary * 1.45, admin = 0, vote = true, hasLicense = false, customCheck = function(ply) return table.HasValue({"donator", "Moderator", "admin", "superadmin", "Owner"}, ply:GetUserGroup("usergroup")) end, CustomCheckFailMsg = "Sorry, this class is donator only! Go to the website to become a donator" , ammo = { ["pistol"] = 60, } })[/QUOTE] 1. Use [code] tags. 2. Read my last post about efficiency. 3. "I use ulx" means nothing; ply:GetNWString() is a core GMod function. 4. You need to also return CLIENT like he did for users to see the jobs.
[QUOTE=code_gs;46093523]1. Use [code] tags. 2. Read my last post about efficiency. 3. "I use ulx" means nothing; ply:GetNWString() is a core GMod function. 4. You need to also return CLIENT like he did for users to see the jobs.[/QUOTE] [CODE] ULX If you wish to use ULX instead of FAdmin, replace: ply:GetNWString("usergroup") == "donator" With: ply:GetUserGroup() == "donator" [/CODE] That is what it says in the wiki so I have to use that instead of ply:GETNWString()
[QUOTE=PopPop;46093567][CODE] ULX If you wish to use ULX instead of FAdmin, replace: ply:GetNWString("usergroup") == "donator" With: ply:GetUserGroup() == "donator" [/CODE] That is what it says in the wiki so I have to use that instead of ply:GETNWString()[/QUOTE] That's just wrong. If you look through the ULX code, GetUserGroup literally just calls [URL="http://wiki.garrysmod.com/page/Entity/GetNWString"]GetNWString[/URL]. It's stupid.
Sorry, you need to Log In to post a reply to this thread.