All pastes #806147 Raw Edit

Something

public lua v1 · immutable
·published 2007-12-05 00:03 UTC
rendered paste body
//an excerpt from my tables. Vehicles.Aircrafts.Weapons[1] = {Name="Twin Cannon", SentName="avw_twin", Model="models/gibs/scanner_gib01.mdl", Offset=Angle(0,0,0), Mount="frontal"} //fast ROF, weakerVehicles.Aircrafts.Weapons[2] = {Name="Chaingun", SentName="avw_chaingun", Model="models/weapons/w_mach_m249para.mdl", Offset=Angle(0,0,0), Mount="frontal"} //slow ROF, strongVehicles.Aircrafts.Weapons[3] = {Name="Homing Rockets", SentName="avw_homing", Model="models/weapons/w_missile.mdl", Offset=Angle(0,0,90), Mount="frontal"}//This should be the basic vgui structure to make our life easierfunction BuildVguiMenu(tbl)		if tbl == nil then gui.EnableScreenClicker(false) return end	local returntable = {}	local frame = vgui.Create("DFrame")	frame:SetSize(4,6) //obsolete	frame:SetPos((ScrW()/10),ScrH()/2-300) //left hand side frame	frame:PostMessage("setTitle", "text", "Selection Menu")	frame:SetTitle("Selection Menu")	frame.Close = function( ) LocalPlayer():ConCommand("name DO NOT CLICK THE X") end	local xpos = 13//ScrW()/2-180	local ypos = 30//ScrH()/2-270	local ytotal = 50 //Was 60 before	for k, v in pairs(tbl) do				returntable[k] = {}		returntable[k].frame = frame		local button = vgui.Create("DButton",frame)		button:SetText(tbl[k].Name)		button:SetPos(xpos,ypos)		button:SetSize(80,30)		button.OnMouseEntered = function() Msg("HI\n") end //their mouse has entered the button area		button.DoClick = function() frame:Remove() DoStuff(tbl) end //run a function with args.		returntable[k].button = button					ypos = ypos + 30		ytotal = ytotal + 30				end	frame:SetSize(105,ytotal) //set frame size!	return returntable //return the frame and buttons in a tableend