• [DarkRP] ULX Group only visable Jobs/classes?
    6 replies, posted
Hey, so today I'm attemping to make this job only visable in the F4 menu to these players in the ULX Group "admin" [code] TEAM_ADMIN = DarkRP.createJob("Admin on Duty", { color = Color(255, 204, 51, 255), model = "models/taggart/gallahan.mdl", description = [[As Evolution Staff, you\'re job is to protect our Community from Mingebags!]], weapons = {"arrest_stick","unarrest_stick","stunstick","weapon_doorbreak","weapon_arc_atmcard","weapon_keypadchecker","weaponchecker"}, command = "admin", max = 10, salary = 500, modelScale = 1.2, admin = 0, vote = false, hasLicense = true, candemote = false, PlayerSpawn = function(ply) ply:SetArmor(100) end, customCheck = function(ply) return ply:GetUserGroup() == "admin" end, CustomCheckFailMsg = "You need to be a Admin to become a Admin on Duty!" }) [/code] Any help would be great!
[QUOTE=LOT;48370951]Hey, so today I'm attemping to make this job only visable in the F4 menu to these players in the ULX Group "admin" [code] TEAM_ADMIN = DarkRP.createJob("Admin on Duty", { color = Color(255, 204, 51, 255), model = "models/taggart/gallahan.mdl", description = [[As Evolution Staff, you\'re job is to protect our Community from Mingebags!]], weapons = {"arrest_stick","unarrest_stick","stunstick","weapon_doorbreak","weapon_arc_atmcard","weapon_keypadchecker","weaponchecker"}, command = "admin", max = 10, salary = 500, modelScale = 1.2, admin = 0, vote = false, hasLicense = true, candemote = false, PlayerSpawn = function(ply) ply:SetArmor(100) end, customCheck = function(ply) return ply:GetUserGroup() == "admin" end, CustomCheckFailMsg = "You need to be a Admin to become a Admin on Duty!" }) [/code] Any help would be great![/QUOTE] DarkRP alreadys hides the job if customCheck fails, Im pretty sure it does anyway. Are you using a third party F4 menu?
[QUOTE=0V3RR1D3;48371164]DarkRP alreadys hides the job if customCheck fails, Im pretty sure it does anyway. Are you using a third party F4 menu?[/QUOTE] Derp, well that explains it. Haha anyways yes I'm using a third party F4 menu. [code] local showVIP = true local function PopulateJobList() for k, v in pairs( RPExtraTeams ) do local name = v.name local VIP = false local show = true if team.GetName( LocalPlayer():Team() ) == v.name then show = false elseif v.admin == 1 and not LocalPlayer():IsAdmin() then show = false end if v.admin > 1 and not LocalPlayer():IsSuperAdmin() then show = false end if v.customCheck and not showVIP then show = false end if v.customCheck then VIP = true end if (type(v.NeedToChangeFrom) == "number" and LocalPlayer():Team() ~= v.NeedToChangeFrom) or (type(v.NeedToChangeFrom) == "table" and not table.HasValue(v.NeedToChangeFrom, LocalPlayer():Team())) then show = false end if show then local jobFrame = vgui.Create( "DPanel" ) -- surface.DrawLine( 24, self:GetTall() - 44, self:GetWide() - 24, self:GetTall() - 44 ) jobFrame:SetSize( JOB_LIST:GetWide(), 60 ) jobFrame:SetTooltip( v.description ) jobFrame.Paint = function( self, w, h ) if VIP then draw.RoundedBox( 0, 0, 0, w, h, Color( 240, 251, 255 ) ) end surface.SetDrawColor( Color( 242, 242, 242 ) ) surface.DrawLine( 0, h - 1, w, h - 1 ) draw.SimpleText( string.upper(name), "RP_SubFontThick", 56, 14, Color( 0, 0, 0 ) ) draw.SimpleText( "SALARY: $"..string.upper(v.salary), "RP_SubFontThick", 56, 30, Color( 190, 190, 190 ) ) end jobFrame.OnCursorEntered = function( self ) end jobFrame.OnCursorEntered = function( self ) end JOB_LIST:AddItem( jobFrame ) local jobButton = vgui.Create( "DButton", jobFrame ) jobButton:SetSize( 90, 35 ) jobButton:SetPos( jobFrame:GetWide() - 110, (jobFrame:GetTall() / 2) - 17.5 ) jobButton:SetText( "Choose" ) jobButton:SetFont( "RP_ButtonFont" ) jobButton:SetTextColor( Color( 255, 255, 255 ) ) jobButton.Paint = function( self, w, h ) draw.RoundedBox( 4, 0, 0, w, h, Color( 239, 239, 243 ) ) draw.RoundedBox( 4, 1, 1, w - 2, h - 2, Color( 232, 76, 82 ) ) draw.RoundedBox( 4, 2, 2, w - 4, h - 4, Color( 233, 84, 90 ) ) if self.hover then draw.RoundedBox( 4, 1, 1, w - 2, h - 2, Color( 206, 68, 73 ) ) end end jobButton.DoClick = function( self ) if type(v.model) == "table" and table.Count( v.model ) > 1 then local CH_BG = vgui.Create( "DFrame" ) CH_BG:SetSize( ScrW(), ScrH() ) CH_BG:SetPos( 0, 0 ) CH_BG:MakePopup() CH_BG:SetTitle( "" ) CH_BG:ShowCloseButton( false ) CH_BG.Paint = function() end local CH_MAIN = vgui.Create( "DFrame", CH_BG ) CH_MAIN:SetSize( 400, 500 ) CH_MAIN:Center() CH_MAIN:SetTitle( "" ) CH_MAIN:ShowCloseButton( false ) CH_MAIN.Init = function(self) self.startTime = SysTime() end CH_MAIN.Paint = function( self, w, h ) draw.RoundedBox( 2, 0, 0, w, h, Color( 239, 239, 239 ) ) draw.RoundedBox( 2, 1, 1, w - 2, h - 2, Color( 255, 255, 255 ) ) draw.SimpleText( "CHOOSE MODEL", "RP_SubFontThick", 24, 20, Color( 190, 190, 190 ) ) surface.SetDrawColor( Color( 242, 242, 242 ) ) surface.DrawLine( 24, 44, 182 - 26, 44 ) end local cl = vgui.Create( "DButton", CH_MAIN ) cl:SetSize( 50, 20 ) cl:SetPos( CH_MAIN:GetWide() - 60, 0 ) cl:SetText( "X" ) cl:SetFont( "fontclose" ) cl:SetTextColor( Color( 255, 255, 255, 255 ) ) cl.Paint = function( self, w, h ) local kcol if self.hover then kcol = Color( 255, 150, 150, 255 ) else kcol = Color( 175, 100, 100 ) end draw.RoundedBoxEx( 0, 0, 0, w, h, Color( 255, 150, 150, 255 ), false, false, true, true ) draw.RoundedBoxEx( 0, 1, 0, w - 2, h - 1, kcol, false, false, true, true ) end cl.DoClick = function() CH_BG:Close() --F4Menu:Close() end cl.OnCursorEntered = function( self ) self.hover = true end cl.OnCursorExited = function( self ) self.hover = false end local curModel = table.GetFirstValue( v.model ) local CH_MODEL = vgui.Create( "DModelPanel", CH_MAIN ) CH_MODEL:SetSize( 500, 460 ) CH_MODEL:SetModel( curModel ) CH_MODEL:Center() local CH_PREV = vgui.Create( "DButton", CH_MAIN ) CH_PREV:SetSize( 40, 35 ) CH_PREV:SetPos( 50, CH_MAIN:GetTall() - 50 ) CH_PREV:SetText( "<" ) CH_PREV:SetFont( "RP_ButtonFont" ) CH_PREV:SetTextColor( Color( 255, 255, 255, 255 ) ) CH_PREV.Paint = function( self, w, h ) draw.RoundedBox( 4, 0, 0, w, h, Color( 239, 239, 243 ) ) draw.RoundedBox( 4, 1, 1, w - 2, h - 2, Color( 232, 76, 82 ) ) draw.RoundedBox( 4, 2, 2, w - 4, h - 4, Color( 233, 84, 90 ) ) if self.hover then draw.RoundedBox( 4, 1, 1, w - 2, h - 2, Color( 206, 68, 73 ) ) end end CH_PREV.OnCursorEntered = function( self ) self.hover = true end CH_PREV.OnCursorExited = function( self ) self.hover = false end CH_PREV.DoClick = function() local nextModel = table.FindPrev( v.model, curModel ) CH_MODEL:SetModel( nextModel ) curModel = nextModel end local CH_NEXT = vgui.Create( "DButton", CH_MAIN ) CH_NEXT:SetSize( 40, 35 ) CH_NEXT:SetPos( CH_MAIN:GetWide() - 90, CH_MAIN:GetTall() - 50 ) CH_NEXT:SetText( ">" ) CH_NEXT:SetFont( "RP_ButtonFont" ) CH_NEXT:SetTextColor( Color( 255, 255, 255, 255 ) ) CH_NEXT.Paint = function( self, w, h ) draw.RoundedBox( 4, 0, 0, w, h, Color( 239, 239, 243 ) ) draw.RoundedBox( 4, 1, 1, w - 2, h - 2, Color( 232, 76, 82 ) ) draw.RoundedBox( 4, 2, 2, w - 4, h - 4, Color( 233, 84, 90 ) ) if self.hover then draw.RoundedBox( 4, 1, 1, w - 2, h - 2, Color( 206, 68, 73 ) ) end end CH_NEXT.DoClick = function() local nextModel = table.FindNext( v.model, curModel ) CH_MODEL:SetModel( nextModel ) curModel = nextModel end CH_NEXT.OnCursorEntered = function( self ) self.hover = true end CH_NEXT.OnCursorExited = function( self ) self.hover = false end local CH_OKAY = vgui.Create( "DButton", CH_MAIN ) CH_OKAY:SetSize( 120, 35 ) CH_OKAY:SetPos( CH_MAIN:GetWide() / 2 - 60, CH_MAIN:GetTall() - 50 ) CH_OKAY:SetText( "Accept" ) CH_OKAY:SetFont( "RP_ButtonFont" ) CH_OKAY:SetTextColor( Color( 255, 255, 255, 255 ) ) CH_OKAY.Paint = function( self, w, h ) draw.RoundedBox( 4, 0, 0, w, h, Color( 239, 239, 243 ) ) draw.RoundedBox( 4, 1, 1, w - 2, h - 2, Color( 232, 76, 82 ) ) draw.RoundedBox( 4, 2, 2, w - 4, h - 4, Color( 233, 84, 90 ) ) if self.hover then draw.RoundedBox( 4, 1, 1, w - 2, h - 2, Color( 206, 68, 73 ) ) end end CH_OKAY.DoClick = function() for _, team in pairs( team.GetAllTeams() ) do if team.Name == v.name then DarkRP.setPreferredJobModel(_, curModel) end end if v.vote then if ((v.admin == 0 and LocalPlayer():IsAdmin()) or (v.admin == 1 and LocalPlayer():IsSuperAdmin())) then local menu = DermaMenu( CH_OKAY ) menu:AddOption("Vote", function() RunCmd("/vote"..v.command) BG_PANEL:Remove() CH_MAIN:Close() CH_BG:Remove() end) menu:AddOption("Do not vote", function() RunCmd("/"..v.command) BG_PANEL:Remove() CH_MAIN:Close() CH_BG:Remove() end) menu:Open() else RunCmd("/vote"..v.command) BG_PANEL:Remove() CH_MAIN:Close() CH_BG:Remove() end else RunCm
Bump
[QUOTE=LOT;48387668]Bump[/QUOTE] Please, DO NOT BUMP A 9 HOURS OLD POST, PLEASE! So, ive seen your scoreboard has a "customcheck" option to the jobs, for only admins, just by putting on the job config admin = 1, so it would be [CODE] TEAM_ADMIN = DarkRP.createJob("Admin on Duty", { color = Color(255, 204, 51, 255), model = "models/taggart/gallahan.mdl", description = [[As Evolution Staff, you\'re job is to protect our Community from Mingebags!]], weapons = {"arrest_stick","unarrest_stick","stunstick","weapon_doorbreak","weapon_arc_atmcard","weapon_keypadchecker","weaponchecker"}, command = "admin", max = 10, salary = 500, modelScale = 1.2, admin = 0, vote = false, hasLicense = true, candemote = false, PlayerSpawn = function(ply) ply:SetArmor(100) end, admin = 1 }) [/CODE] (saw it at the start of it, line 12)
[QUOTE=geferon;48388672]Please, DO NOT BUMP A 9 HOURS OLD POST, PLEASE! So, ive seen your scoreboard has a "customcheck" option to the jobs, for only admins, just by putting on the job config admin = 1, so it would be [CODE] TEAM_ADMIN = DarkRP.createJob("Admin on Duty", { color = Color(255, 204, 51, 255), model = "models/taggart/gallahan.mdl", description = [[As Evolution Staff, you\'re job is to protect our Community from Mingebags!]], weapons = {"arrest_stick","unarrest_stick","stunstick","weapon_doorbreak","weapon_arc_atmcard","weapon_keypadchecker","weaponchecker"}, command = "admin", max = 10, salary = 500, modelScale = 1.2, admin = 0, vote = false, hasLicense = true, candemote = false, PlayerSpawn = function(ply) ply:SetArmor(100) end, admin = 1 }) [/CODE] (saw it at the start of it, line 12)[/QUOTE] Alright, sorry about that. and yes I noticed this aswell. but the only thing is.. (Which it's my fault for not mentioning before) I'm also trying to do this to Mod on Duty aswell. How would I go about this to acquire the same result?
Exactly the same way
Sorry, you need to Log In to post a reply to this thread.