I am stuck on this -- Attempt to index field 'NO' (a nil value)
3 replies, posted
[CODE]
[ERROR] gamemodes/2dparkour/gamemode/cl_init.lua:108: attempt to index field 'NO' (a nil value)
1. unknown - gamemodes/2dparkour/gamemode/cl_init.lua:108
2. unknown - lua/includes/modules/concommand.lua:69
[/CODE]
[CODE]
function ToggleMouse( bool )
for _, panel in pairs( self.Toggables ) do
panel:SetMouseInputEnabled( bool )
end
self.Togglables =
{
SET2ComboBox, SET3ComboBox
}
end
function WeaponSelectorDerma()
local WeaponFrame = vgui.Create("DFrame")
WeaponFrame:SetSize(400, 200)
WeaponFrame:Center()
WeaponFrame:SetTitle("Choose Your Loadout")
WeaponFrame:SetDraggable(true)
WeaponFrame:SetSizable(false)
WeaponFrame:ShowCloseButton(false)
WeaponFrame:MakePopup()
local SET1ComboBox = vgui.Create("DComboBox", WeaponFrame)
SET1ComboBox:SetSize(100, 30)
SET1ComboBox:SetPos(10, 35)
SET1ComboBox:SetText("SET 1")
SET1ComboBox:AddChoice( "STUNSTICK" )
SET1ComboBox:AddChoice( "PISTOL" )
local SET2ComboBox = vgui.Create("DComboBox", WeaponFrame)
SET2ComboBox:SetSize(100, 30)
SET2ComboBox:SetPos(140, 35)
SET2ComboBox:SetText("SET 2")
SET2ComboBox:AddChoice(".357 Magnum")
SET2ComboBox:AddChoice("SMG")
SET2ComboBox:AddChoice("AR2")
local SET3ComboBox = vgui.Create("DComboBox", WeaponFrame)
SET3ComboBox:SetSize(100, 30)
SET3ComboBox:SetPos(270, 35)
SET3ComboBox:SetText("SET 3")
SET3ComboBox:AddChoice("SHOTGUN")
SET3ComboBox:AddChoice("CROSSBOW")
SET3ComboBox:AddChoice("RPG")
local parkour = vgui.Create("DComboBox", WeaponFrame)
parkour:SetSize(200, 30)
parkour:SetPos(10, 160)
parkour:SetText("Would you like parkour enabled?")
parkour:AddChoice("YES")
parkour:AddChoice("NO")
local DONEButton = vgui.Create("DButton", WeaponFrame)
DONEButton:SetSize(50, 30)
DONEButton:SetPos(250, 160)
DONEButton:SetText("DONE")
DONEButton.DoClick = function() RunConsoleCommand("weapon_take") WeaponFrame:Close() end
parkour.NO.DoClick = function() ToggleMouse( false ) end
parkour.YES.DoClick = function() ToggleMouse( true ) end
end
[/CODE]
I have no idea what I'm doing wrong? The problems are at the bottom with the "parkour.NO.DoClick" ... Can someone please help me?
that lua you gave is is not where the error is . you need to show us
[lua]gamemodes/2dparkour/gamemode/cl_init.lua[/lua]
And please use [lua] tags.
ComboBox options are not buttons, you need to do something more like an OnSelect sort of thing. See [url]http://wiki.garrysmod.com/page/VGUI/Elements/DComboBox[/url]
Sorry, you need to Log In to post a reply to this thread.