.:`=-~rANdOm~`-=:. Game Servers

Support (Read Only) => Help => Topic started by: mdew355 on September 17, 2010, 08:19:28 PM

Title: FML Panel!!!
Post by: mdew355 on September 17, 2010, 08:19:28 PM
Hey, I'm making a gamemode and I'm trying to get a derma panel but everytime I run it I get and LUA Error saying that it can't call a global nil value, something like that. Below is mai code and the error XD Thank you for any help given.

Code: [Select]
function set_team()
    local frame = vgui.Create( "DFrame" )
    frame:SetPos( ScrW() / 2, ScrH() / 2 )
    frame:SetSize( 200, 210 )
    frame:SetTitle( "Get Team!" )
    frame:SetVisible( true )
    frame:SetDraggable( false )
    frame:ShowCloseButton( false )
    frame:MakePopup()
     
    team_1 = vgui.Create( "DButton", frame )
    team_1:SetPos( frame:GetTall() / 2, 5 )
    team_1:SetSize( 80, 100 )
    team_1:SetText( "Join a team!" )
    team_1.DoClick = function()
        RunConsoleCommand( "team1" )
    end   
end
concommand.Add("team_menu", set_team)

And now the Error.

Code: [Select]
[gamemodes\dodgeball\gamemode\init.lua:60] attempt to index global 'vgui' (a nil value)
Title: Re: FML Panel!!!
Post by: SMasters on September 17, 2010, 09:41:43 PM
I'm not good at lua or anything but post the whole code maybe, and which is line 60? Maybe that will help to fix this error.
Title: Re: FML Panel!!!
Post by: Tomcat on September 17, 2010, 10:24:23 PM
I'm not good at lua or anything but post the whole code maybe, and which is line 60? Maybe that will help to fix this error.


yes please tell me witch line in this snipp


NVM:


You need to run derma and vgui clientside
Title: Re: FML Panel!!!
Post by: mdew355 on September 19, 2010, 11:42:04 PM
Line 60 is : local frame = vgui.Create( "DFrame" )

And I have it under cl_spawnmenu.lua
Title: Re: FML Panel!!!
Post by: Tomcat on September 20, 2010, 02:59:26 PM
I still dont think its running clientside

Title: Re: FML Panel!!!
Post by: mdew355 on September 20, 2010, 11:12:21 PM
I still dont think its running clientside

So then how would I get it to run ClientSide?
Title: Re: FML Panel!!!
Post by: Tomcat on September 21, 2010, 02:06:57 PM
Use

G.AddCSLuaFile   (http://wiki.garrysmod.com/favicon.ico) (http://wiki.garrysmod.com/?title=G.AddCSLuaFile)

In your main init file with that file's name in it
Title: Re: FML Panel!!!
Post by: mdew355 on September 22, 2010, 10:00:33 PM
Use

G.AddCSLuaFile   (http://wiki.garrysmod.com/favicon.ico) (http://wiki.garrysmod.com/?title=G.AddCSLuaFile)

In your main init file with that file's name in it


Already been done for awhile. That is usually my first instinct.
Title: Re: FML Panel!!!
Post by: Кrаsher on September 23, 2010, 05:08:22 PM
Which line is number 60?
Title: Re: FML Panel!!!
Post by: SMasters on September 23, 2010, 06:27:48 PM
Which line is number 60?
Line 60 is : local frame = vgui.Create( "DFrame" )

And I have it under cl_spawnmenu.lua