.:`=-~rANdOm~`-=:. Game Servers
Support (Read Only) => Help => Topic started 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.
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.
[gamemodes\dodgeball\gamemode\init.lua:60] attempt to index global 'vgui' (a nil value)
-
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.
-
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
-
Line 60 is : local frame = vgui.Create( "DFrame" )
And I have it under cl_spawnmenu.lua
-
I still dont think its running clientside
-
I still dont think its running clientside
So then how would I get it to run ClientSide?
-
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
-
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.
-
Which line is number 60?
-
Which line is number 60?
Line 60 is : local frame = vgui.Create( "DFrame" )
And I have it under cl_spawnmenu.lua