• VGUI Wont Open Gmod Lua
    6 replies, posted
[B]When i type !cards in the chat it doesn't seem to work, would appreciate any help[/B] [CODE] surface.CreateFont( "DermaLarge2x", { font = "DermaLarge", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name extended = false, size = 48, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = false, additive = false, outline = false, } ) local function DrawGUI() local DFrame = vgui.Create( "DFrame" ) DFrame:SetSize( ScrW(), ScrH() ) DFrame:Center() DFrame:MakePopup() DFrame:SetTitle( "" ) DFrame:SetDraggable(false) DFrame:ShowCloseButton( false ) function DFrame:Paint( w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0 ) ) end local bg = vgui.Create( "DImage", DFrame ) bg:SetPos(ScrW()/2 - ScrW()/2, ScrH()/2 - ScrH()/2) bg:SetSize( ScrW(), ScrH() ) bg:SetImage( "vgui/background.png" ) local close = vgui.Create("DButton",DFrame) close:SetSize(70,35) close:SetPos(ScrW()- 20 - close:GetWide(),20) close:SetText( "" ) close.DoClick = function() DFrame:Close() end function close:Paint(w,h) draw.RoundedBox(8,0,0,w,h,Color(0,0,0,100)) draw.SimpleText( "Exit", "Trebuchet24",18, 5,Color( 255, 255, 255, 255 )) end local DScrollPanel = vgui.Create( "DScrollPanel", DFrame ) DScrollPanel:SetSize( ScrW() - 20, ScrH() - 120 ) DScrollPanel:SetPos(ScrW()/2 - DScrollPanel:GetWide()/2,ScrH()/2 - DScrollPanel:GetTall()/2 + 60) local DescriptionBox = vgui.Create("DPanel",DScrollPanel) DescriptionBox:SetSize(500,300) DescriptionBox:SetPos(DScrollPanel:GetWide() - DescriptionBox:GetWide() - 100,40) function DescriptionBox:Paint(w,h) draw.RoundedBox( 0, 0, 0, w, h, Color(255,255,255,5)) draw.RoundedBox( 0, 0, 0, 6, h, Color(255,255,255,255)) draw.RoundedBox( 0, w-6, 0, 6, h, Color(255,255,255,255)) draw.RoundedBox( 0, 0, h-6, w, 6, Color(255,255,255,255)) draw.RoundedBox( 0, 0, 0, w, 6, Color(255,255,255,255)) end Description = vgui.Create( "DLabel", DescriptionBox ) Description:SetPos( 10, 10 ) local msg = string.sub( LocalPlayer():GetNWString("Description"), 1, 47 ) local msg_1 = string.sub( LocalPlayer():GetNWString("Description"), 48, 97 ) local msg_2 = string.sub( LocalPlayer():GetNWString("Description"), 98, 145 ) local msg_3 = string.sub( LocalPlayer():GetNWString("Description"), 193, 240 ) Description:SetFont("Trebuchet24") if string.len(LocalPlayer():GetNWString("Description")) >= 47 then Description:SetText( msg.."\n" ..msg_1.. "\n" ..msg_2.. "\n" ..msg_3.. "\n" ) else Description:SetText(msg) end Description:SizeToContents() Description:SetColor(Color(255,255,255)) hook.Add("Think","UpdateDescription",function() if DFrame:IsValid() then local msg = string.sub( LocalPlayer():GetNWString("Description"), 1, 47 ) local msg_1 = string.sub( LocalPlayer():GetNWString("Description"), 48, 97 ) local msg_2 = string.sub( LocalPlayer():GetNWString("Description"), 98, 145 ) local msg_3 = string.sub( LocalPlayer():GetNWString("Description"), 193, 240 ) if string.len(LocalPlayer():GetNWString("Description")) >= 47 then Description:SetText( msg.."\n" ..msg_1.. "\n" ..msg_2.. "\n" ..msg_3.. "\n" ) else Description:SetText(msg) end end end) local Counter_BR = vgui.Create("DLabel",DScrollPanel) Counter_BR:SetPos(300,ScrH()/2 - DScrollPanel:GetTall()/2+140) Counter_BR:SetFont("DermaLarge2x") Counter_BR:SetColor(Color(177,89,37)) local br = 0 for brk,brv in pairs(bronze_table) do if LocalPlayer():GetNWBool("wiz_card_"..brv) then br = br + 1 Counter_BR:SetText("Bronze: "..tostring(br).."/"..table.GetLastKey(bronze_table)) else br = br Counter_BR:SetText("Bronze: "..tostring(br).."/"..table.GetLastKey(bronze_table)) end end Counter_BR:SizeToContents() local Counter_SR = vgui.Create("DLabel",DScrollPanel) Counter_SR:SetPos(300,ScrH()/2 - DScrollPanel:GetTall()/2+100) Counter_SR:SetFont("DermaLarge2x") Counter_SR:SetColor(Color(243,246,251)) local sr = 0 for srk,srv in pairs(silver_table) do if LocalPlayer():GetNWBool("wiz_card_"..srv) then sr = sr + 1 Counter_SR:SetText("Silver: "..tostring(sr).."/"..table.GetLastKey(silver_table)) else sr = sr Counter_SR:SetText("Silver: "..tostring(sr).."/"..table.GetLastKey(silver_table)) end end Counter_SR:SizeToContents() local Counter_AU = vgui.Create("DLabel",DScrollPanel) Counter_AU:SetPos(300,ScrH()/2 - DScrollPanel:GetTall()/2+60) Counter_AU:SetFont("DermaLarge2x") Counter_AU:SetColor(Color(247,210,49)) local au = 0 for auk,auv in pairs(gold_table) do if LocalPlayer():GetNWBool("wiz_card_"..auv) then au = au + 1 Counter_AU:SetText("Gold: "..tostring(au).."/"..table.GetLastKey(gold_table)) else au = au Counter_AU:SetText("Gold: "..tostring(au).."/"..table.GetLastKey(gold_table)) end end Counter_AU:SizeToContents() local LastCard = vgui.Create("DImage",DScrollPanel) LastCard:SetSize(300,300) LastCard:SetPos(ScrW()/2 - LastCard:GetWide()/2,ScrH()/2 - LastCard:GetTall()/2 - 380) if LocalPlayer():GetNWInt("last_wiz_card") == 0 then LastCard:SetImage( "vgui/question.png" ) else LastCard:SetImage( "vgui/c"..LocalPlayer():GetNWInt("last_wiz_card")..".png" ) end local sbar = DScrollPanel:GetVBar() function sbar:Paint( w, h ) draw.RoundedBox(0,0,0,w,h,Color(0,0,0,100)) end function sbar.btnUp:Paint( w, h ) local bg = vgui.Create( "DImage", DScrollPanel:GetVBar().btnUp ) bg:SetPos(0,0) bg:SetSize( w, h ) bg:SetImage( "vgui/arrow_up.png" ) end function sbar.btnDown:Paint( w, h ) local bg = vgui.Create( "DImage", DScrollPanel:GetVBar().btnDown ) bg:SetPos(0,0) bg:SetSize( w, h ) bg:SetImage( "vgui/arrow_dn.png" ) end function sbar.btnGrip:Paint( w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 255, 255, 1 ) ) end local ButtonNum = 0 if ScrW() <= 1366 then ButtonNum = 8 else ButtonNum = 13 end local DHorizontalScroller = vgui.Create( "DHorizontalScroller", DScrollPanel ) DHorizontalScroller:SetSize(ButtonNum * 128,128) DHorizontalScroller:SetPos(ScrW()/2 - DHorizontalScroller:GetWide()/2,ScrH()/2 - 256/2 - 40) for i = 1, ButtonNum do local DImage = vgui.Create( "DImageButton", DHorizontalScroller ) if LocalPlayer():GetNWBool("wiz_card_"..i) then DImage:SetImage( "vgui/c"..i..".png" ) DImage.DoClick = function() for k,v in pairs (description_table) do if k <= i then LocalPlayer():SetNWString("Description",tostring(v))end end end else DImage:SetImage( "vgui/question.png" ) end DImage:SetSize(128,128) DHorizontalScroller:AddPanel( DImage ) end local DHorizontalScroller1 = vgui.Create( "DHorizontalScroller", DScrollPanel ) DHorizontalScroller1:SetSize(ButtonNum * 128,128) DHorizontalScroller1:SetPos(ScrW()/2 - DHorizontalScroller1:GetWide()/2,ScrH()/2 - 256/2 - 40 + 128 + 10) for i = ButtonNum+1, ButtonNum*2 do local DImage1 = vgui.Create( "DImageButton", DHorizontalScroller1 ) if LocalPlayer():GetNWBool("wiz_card_"..i) then DImage1:SetImage( "vgui/c"..i ..".png" ) DImage1.DoClick = function() for k,v in pairs (description_table) do if k <= i then LocalPlayer():SetNWString("Description",tostring(v))end end end else DImage1:SetImage( "vgui/question.png" ) end DImage1:SetSize(128,128) DHorizontalScroller1:AddPanel( DImage1 ) end local DHorizontalScroller2 = vgui.Create( "DHorizontalScroller", DScrollPanel ) DHorizontalScroller2:SetSize(ButtonNum * 128,128) DHorizontalScroller2:SetPos(ScrW()/2 - DHorizontalScroller2:GetWide()/2,ScrH()/2 - 256/2 - 40 + 128 + 128 + 10) for i = ButtonNum*2+1, ButtonNum*3 do local f = i + 2 local DImage2 = vgui.Create( "DImageButton", DHorizontalScroller2 ) if LocalPlayer():GetNWBool("wiz_card_"..i) then DImage2:SetImage( "vgui/c"..i ..".png" ) DImage2.DoClick = function() for k,v in pairs (description_table) do if k <= i then LocalPlayer():SetNWString("Description",tostring(v))end end end else DImage2:SetImage( "vgui/question.png" ) end DImage2:SetSize(128,128) DHorizontalScroller2:AddPanel( DImage2 ) end local DHorizontalScroller3 = vgui.Create( "DHorizontalScroller", DScrollPanel ) DHorizontalScroller3:SetSize(ButtonNum * 128,128) DHorizontalScroller3:SetPos(ScrW()/2 - DHorizontalScroller3:GetWide()/2,ScrH()/2 - 256/2 - 40 + 128 + 128 + 128 + 10) for i = ButtonNum*3+1, ButtonNum*4 do local f = i + 2 local DImage3 = vgui.Create( "DImageButton", DHorizontalScroller3 ) if LocalPlayer():GetNWBool("wiz_card_"..i) then DImage3:SetImage( "vgui/c"..i ..".png" ) DImage3.DoClick = function() for k,v in pairs (description_table) do if k <= i then LocalPlayer():SetNWString("Description",tostring(v))end end end else DImage3:SetImage( "vgui/question.png" ) end DImage3:SetSize(128,128) DHorizontalScroller3:AddPanel( DImage3 ) end local DHorizontalScroller4 = vgui.Create( "DHorizontalScroller", DScrollPanel ) DHorizontalScroller4:SetSize(ButtonNum * 128,128) DHorizontalScroller4:SetPos(ScrW()/2 - DHorizontalScroller4:GetWide()/2,ScrH()/2 - 256/2 - 40 + 128 + 128 + 128 + 128 + 10) for i = ButtonNum*4+1, ButtonNum*5 do local f = i + 2 local DImage4 = vgui.Create( "DImageButton", DHorizontalScroller4 ) if LocalPlayer():GetNWBool("wiz_card_"..i) then DImage4:SetImage( "vgui/c"..i..".png" ) DImage4.DoClick = function() for k,v in pairs (description_table) do if k <= i then LocalPlayer():SetNWString("Description",tostring(v))end end end else DImage4:SetImage( "vgui/question.png" ) end DImage4:SetSize(128,128) DHorizontalScroller4:AddPanel( DImage4 ) end local DHorizontalScroller5 = vgui.Create( "DHorizontalScroller", DScrollPanel ) DHorizontalScroller5:SetSize(ButtonNum * 128,128) DHorizontalScroller5:SetPos(ScrW()/2 - DHorizontalScroller5:GetWide()/2,ScrH()/2 - 256/2 - 40 + 128 + 128 + 128 + 128 + 128 + 10) for i = ButtonNum*5+1, ButtonNum*6 do local f = i + 2 local DImage5 = vgui.Create( "DImageButton", DHorizontalScroller5 ) if LocalPlayer():GetNWBool("wiz_card_"..i) then DImage5:SetImage( "vgui/c"..i..".png" ) DImage5.DoClick = function() for k,v in pairs (description_table) do if k <= i then LocalPlayer():SetNWString("Description",tostring(v))end end end else DImage5:SetImage( "vgui/question.png" ) end DImage5:SetSize(128,128) DHorizontalScroller5:AddPanel( DImage5 ) end local DHorizontalScroller6 = vgui.Create( "DHorizontalScroller", DScrollPanel ) DHorizontalScroller6:SetSize(ButtonNum * 128,128) DHorizontalScroller6:SetPos(ScrW()/2 - DHorizontalScroller6:GetWide()/2,ScrH()/2 - 256/2 - 40 + 128 + 128 + 128 + 128 + 128 + 128 + 10) for i = ButtonNum*6+1, ButtonNum*7 do local f = i + 2 local DImage6 = vgui.Create( "DImageButton", DHorizontalScroller6 ) if LocalPlayer():GetNWBool("wiz_card_"..i) then DImage6:SetImage( "vgui/c"..i..".png" ) DImage6.DoClick = function() for k,v in pairs (description_table) do if k <= i then LocalPlayer():SetNWString("Description",tostring(v))end end end else DImage6:SetImage( "vgui/question.png" ) end DImage6:SetSize(128,128) DHorizontalScroller6:AddPanel( DImage6 ) end local DHorizontalScroller7 = vgui.Create( "DHorizontalScroller", DScrollPanel ) DHorizontalScroller7:SetSize(ButtonNum * 128,128) DHorizontalScroller7:SetPos(ScrW()/2 - DHorizontalScroller7:GetWide()/2,ScrH()/2 - 256/2 - 40 + 128 + 128 + 128 + 128 + 128 + 128 + 128 + 10) for i = ButtonNum*7+1, ButtonNum*8 - 3 do local f = i + 2 local DImage7 = vgui.Create( "DImageButton", DHorizontalScroller7 ) if LocalPlayer():GetNWBool("wiz_card_"..i) then DImage7:SetImage( "vgui/c"..i..".png" ) DImage7.DoClick = function() for k,v in pairs (description_table) do if k <= i then LocalPlayer():SetNWString("Description",tostring(v))end end end else DImage7:SetImage( "vgui/question.png" ) end DImage7:SetSize(128,128) DHorizontalScroller7:AddPanel( DImage7 ) end end hook.Add( "OnPlayerChat", "OpenWizardGui", function( ply, text, team, isdead ) if (string.sub(text, 1, 6) == "!cards") && ply == LocalPlayer() then -- added an extra check DrawGUI() return true -- surpress the message end end )[/CODE] [QUOTE]PROBLEM WAS SOLVED[/QUOTE]
1) this is not gmod subforum 2) how could you code that and not be able to see the problem
[QUOTE=gonzalolog;51601473]1) this is not gmod subforum 2) how could you code that and not be able to see the problem[/QUOTE] It was for a private customer that paid for it and the problem was solved. garry's mod did not recognize the addon so i just changed the folder name and it worked fine
[QUOTE=Deathwalker99;51601643]It was for a private customer that paid for it and the problem was solved. garry's mod did not recognize the addon so i just changed the folder name and it worked fine[/QUOTE] Someone paid for that?
[QUOTE=LuckyLuke;51602927]Someone paid for that?[/QUOTE] Gmod forum has gone to shit last few years
[QUOTE=LuckyLuke;51602927]Someone paid for that?[/QUOTE] Paid for the addon not for the solution the addon is just a card collection system
Thread closed. Wrong forum and problem is fixed anyway.
Sorry, you need to Log In to post a reply to this thread.