• DarkRP F4Menu help!
    4 replies, posted
Well I have been working on this from the last 3 days for my server.. and I need help.. I wan't to know how I get the Information for the jobs? like most over F4 Menus, get the info from the DarkRP job config. How do I complete this? F4 Menu: [CODE]include( "config.lua" ) local Menu function StartMenu() local client = LocalPlayer() if !IsValid( Menu ) then Menu = vgui.Create( "DFrame" ) Menu:SetSize( 900, 700 ) Menu:SetPos( 270, 100 ) Menu:SetTitle( "" ) Menu:SetDraggable( false ) Menu.Paint = function() draw.RoundedBox(0, 0, 0, 900, 600, Color(75, 75, 149, 255)) end TopLayer = vgui.Create( "DPanel", Menu ) TopLayer:SetSize( 900, 50 ) TopLayer:SetPos(0, 0 ) TopLayer.Paint = function() draw.RoundedBox(0, 0, 0, 900, 50, Color(75, 75, 124, 255)) draw.RoundedBox(0, 0, 0, 300, 50, Color(75, 75, 200, 255)) draw.SimpleText( AL_ServerName, "AL_BigText", 25, 15, Color( 255,255,255,255 ), 0, TEXT_ALIGN_LEFT ) surface.SetDrawColor(40,40,40,255) surface.DrawRect(300, 0, 1, 50) end Menu:Add( TopLayer ) CloseButton = vgui.Create( "DButton", Menu ) CloseButton:SetSize( 25, 25 ) CloseButton:SetPos( 875, 0 ) CloseButton:SetText( "" ) CloseButton.Paint = function() draw.RoundedBox(0, 0, 0, 25, 25, Color(255, 0, 0, 255)) draw.SimpleText( "X", "AL_Close", 8, 5, Color( 255,255,255,255 ), 0, 0 ) surface.SetDrawColor(40,40,40,255) surface.DrawRect(0, 0, CloseButton:GetWide(), 1) surface.DrawRect(0, 24, CloseButton:GetWide(), 1) surface.DrawRect(24, 0, 1, CloseButton:GetTall()) surface.DrawRect(0, 0, 1, CloseButton:GetTall()) end Menu:Add( CloseButton ) CloseButton.DoClick = function(CloseButton) Menu:Hide() end Menu:SetKeyboardInputEnabled(true) Menu:MakePopup() Menu:ShowCloseButton( false ) jobbutton = vgui.Create("DButton", TopLayer) jobbutton:SetParent("Menu") jobbutton:SetSize(100,50) jobbutton:SetPos(500,0) jobbutton:SetText("") jobbutton.Paint = function() if jobbutton:IsHovered() then draw.RoundedBox(0, 0, 0, jobbutton:GetWide(), jobbutton:GetTall(), Color(75, 75, 180, 230)) draw.SimpleText("Jobs", "AL_Button", 30, 17, Color(255,255,255,255)) else draw.RoundedBox(0, 0, 0, jobbutton:GetWide(), jobbutton:GetTall(), Color(75, 75, 100, 230)) draw.SimpleText("Jobs", "AL_Button", 30, 17, Color(255,255,255,255)) end surface.SetDrawColor(40,40,40,255) surface.DrawRect(0, 0, jobbutton:GetWide(), 1) surface.DrawRect(0,49, jobbutton:GetWide(), 1) surface.DrawRect(99,0, 1, jobbutton:GetTall()) surface.DrawRect(0,0, 1, jobbutton:GetTall()) end TopLayer:Add(jobbutton) JobScrollPanel = vgui.Create( "DScrollPanel", Menu ) JobScrollPanel:SetSize(Menu:GetWide(), Menu:GetTall() - 150) JobScrollPanel:SetPos(0, 50) JobMenu = vgui.Create( "DIconLayout", JobScrollPanel ) JobMenu:SetParent(JobScrollPanel) JobMenu:SetPos(1, 0 ) JobMenu:SetSize( 150, Menu:GetTall() ) JobMenu:SetSpaceY( 5 ) JobMenu:SetSpaceX( 5 ) JobScrollPanel:Add(JobMenu) jobbutton.DoClick = function(jobbutton) JobMenu:Show() end elseif IsValid( Menu ) then Menu:Show() end end hook.Add( "ShowSpare2", "Open Menu", StartMenu )[/CODE] config.lua: [CODE]AddCSLuaFile() AL_ServerName = "DarkRP Menu" surface.CreateFont( "AL_BigText", { font = "Coolvetica", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name extended = false, size = 40, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = true, additive = true, outline = true, } ) surface.CreateFont( "AL_Close", { font = "Coolvetica", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name extended = false, size = 15, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = true, additive = true, outline = true, } ) surface.CreateFont( "AL_Button", { font = "Coolvetica", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name extended = false, size = 20, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = true, additive = true, outline = true, } ) [/CODE]
[code]lua_run PrintTable( RPExtraTeams )[/code] Also 2 tips: 1. Turn your function into local one. 2. Shorten your code, for example - you don't need to set an option in surface.CreateFont to false if you don't want it enabled - simply don't set it to true.
[QUOTE=Netheous;50906767][code]lua_run PrintTable( RPExtraTeams )[/code] Also 2 tips: 1. Turn your function into local one. 2. Shorten your code, for example - you don't need to set an option in surface.CreateFont to false if you don't want it enabled - simply don't set it to true.[/QUOTE] Hmm, so use lua_run PrintTable( RPExtraTeams ) were I am going to add jobs? or.. im confused. [CODE]for k,v in pairs(RPExtraTeams) do -- text etc here using the V value to get the names and etc [/CODE] or [CODE]for k,v in pairs(lua_run PrintTable(RPExtraTeams)) do -- text etc here using the V value to get the names and etc [/CODE]
Don't use lua_run for anything, and you can't loop through a printed table anyway
for i, jobData in pairs( RPExtraTeams ) do
Sorry, you need to Log In to post a reply to this thread.