• nil Table?b
    0 replies, posted
[CODE]-- Converting the old Gesture Menu to a new one, in VGUI-- Remade using Notepad++, GCompute, GMod Wiki and remade mostly on Metastruct. GestureMenu = {} function GestureMenu:Init() self.GMWindow = vgui.Create("DFrame") self.GMWindow:SetTitle("Gesture Menu") self.GMWindow:SetSize(312.5,235) self.GMWindow:SetPos(ScrW()/1.15-156.25,ScrH()/1.15-110) self.GMWindow:MoveTo(ScrW()+100,ScrH()/1.15-110,0,0) self.GMWindow:ShowCloseButton(false) self.GMWindow:SetDraggable(false) self.GMWindow:SetVisible(false) self.GMAPL = vgui.Create("DIconLayout",self.GMWindow) self.GMAPL:SetPos(10,32.5) self.GMAPL:SetSize(320,320) self.GMAPL:SetSpaceY(7.25) self.GMAPL:SetSpaceX(10) self.ActCommands={ {"becon","Come with me"}, {"dance","Normal Dance"}, {"muscle","Sexy Dance"}, {"wave","Hello"}, {"bow","Bow"}, {"laugh","Laugh"}, {"pers","Lion Pose"}, {"cheer","Cheer"}, {"agree","Agree"}, {"disagree","Disagree"}, {"zombie","Zombie Imitation"}, {"halt","Halt"}, {"group","Group"}, {"forward","Forward"}} self.GMAD={} self.GML={} for i=1,#self.ActCommands do local k,v = self.ActCommands[i][1],self.ActCommands[i][2] --local v2 = self.ActSequences[i] self.GMAP=self.GMAPL:Add("DPanel") self.GMAP:SetSize(24*3.75,9*3.75) self.GMAD[i]=self.GMAP:Add("DButton") self.GMAD[i]:SetSize(23*3.75,8*3.75) self.GMAD[i]:SetText(v) self.GMAD[i]:Center() self.GMAD[i].DoClick = function() RunConsoleCommand("act",k) end end self.Copyright = vgui.Create("DLabel",self.GMWindow) self.Copyright:SetBright(true) self.Copyright:SetPos(210,202.5) self.Copyright:SetText"By Tenrys" self.Copyright:SizeToContents() print"-- GESTURE MENU INITIALIZED ! MAKE SURE \"+g_menu\" IS BINDED TO A KEY. --" end function GestureMenu:Show() gui.EnableScreenClicker(true) GestureMenu.GMWindow:SetVisible(true) GestureMenu.GMWindow:MoveTo(ScrW()/1.15-156.25,ScrH()/1.15-110,0.3,0) -- Moves the window in the original position of it end function GestureMenu:Hide() timer.Simple(1.5,function() gui.EnableScreenClicker(false) end) GestureMenu.GMWindow:MoveTo(ScrW()+100,ScrH()/1.15-110,0.15,1.5) -- Hides it again after 3 seconds timer.Simple(1.65,function() self.GMWindow:SetVisible(false) end) end concommand.Add("+g_menu",function() GestureMenu:Show() end) concommand.Add("-g_menu",function() GestureMenu:Hide() end) GestureMenu:Init()[/CODE] What error it gives out: GMWindow is a nil value. Even when I do "PrintTable(GestureMenu)" it says it's a nil value, not a table. But, I did define the table? File name: gesturemenuinit.lua File path: [addon name]/lua/autorun/client/
Sorry, you need to Log In to post a reply to this thread.