• F4 Menu failed to create VGUI Component
    0 replies, posted
I am trying to make an f4 menu, I have it set so whenever the player presses the f4 it will run a lua file with what I want to show on the player s screen in the vgui folder. Located in addons/customf4/lua/autorun/customf4.lua if SERVER then AddCSLuaFile( "vgui/cs_f4_menu.lua" ) util.AddNetworkString( "f4menu" ) hook.Add( "ShowSpare2", "F4MenuHook", function ( ply ) net.Start( "f4menu" ) net.Send( ply ) end ) end if CLIENT then include( "vgui/cs_f4_menu.lua" ) net.Receive( "f4menu" ,function()  if ( !CSF4MENU ) then CSF4MENU = vgui.Create( "cs_f4_menu" ) CSF4MENU:SetVisible( false ) end if (CSF4MENU:IsVisible() ) then CSF4MENU:SetVisible( false ) gui.EnableScreenClicker( false ) else CSF4MENU:SetVisible( true ) gui.EnableScreenClicker( true ) end end) end Located in addons/customf4/lua/vgui/cs_f4_menu.lua local PANEL = { Init = function( self ) self:SetSize( 1280, 720 ) self:Center() self:SetVisible( true ) local x, y = self:GetSize() local closebutton = vgui.Create( "DButton", self ) closebutton:SetText( "x" ) closebutton:SetSize( 25, 25 ) closebutton:SetPos( x - 31, 6 ) closebutton.Paint = function( self, w, h ) surface.SetDrawColor( 245, 120, 120, 150 ) surface.DrawRect( 0, 0, w, h ) surface.SetDrawColor( 50, 50, 50, 150 ) surface.DrawOutlinedRect( 0, 0, w, h ) end closebutton.DoClick = function() CSF4MENU:SetVisible( false ) gui.EnableScreenClicker( false ) end end Paint = function( self, w, h ) surface.SetDrawColor( 255, 255, 255, 150 )  surface.DrawRect( 0, 0, w, h ) surface.DrawOutlinedRect( 2, 2, w - 4, h - 4 ) end } vgui.Register( "cs_f4_menu", PANEL )
Sorry, you need to Log In to post a reply to this thread.