繁体   English   中英

Garry的Mod Derma-HTML和包含

[英]Garry's Mod Derma - HTML and containing

我的Lua遇到问题。 我正在使用要在网站上托管的HTML为服务器制作MOTD

如图所示,我已经设置好相框和相应的标签

这里

但这是我的问题

IMG

当您通过按“ accept”退出MOTD ,代码中设置的页面保持显示状态,并像地狱般侵入您的屏幕。 我的代码如下:

function Welcome ()
    MainMenu = vgui.Create( "DFrame" )
    MainMenu:SetPos( 350, 100 )
    MainMenu:SetSize( 1200, 900 )
    MainMenu:SetTitle( "Welcome Menu" )
    MainMenu:SetBackgroundBlur( true )
    MainMenu:SetVisible( true )
    MainMenu:SetDraggable( true )
    MainMenu:ShowCloseButton( false )
    MainMenu:MakePopup()

    PropertySheet = vgui.Create( "DPropertySheet")
    PropertySheet:SetParent( MainMenu )
    PropertySheet:SetPos( 5, 30 )
    PropertySheet:SetSize( 1190, 820 )

    local DermaButton = vgui.Create( "DButton", DermaPanel )
    DermaButton:SetText( "Agree" )
    DermaButton:SetSize( 165, 30 )
    DermaButton:SetPos( 590, 860 )
    DermaButton:SetParent( MainMenu )

    DermaButton.DoClick = function()
        MainMenu:Close()
        RunConsoleCommand( "say", "I have read and agree with the rules")
    end

    local DermaButton = vgui.Create( "DButton", DermaPanel )
    DermaButton:SetText( "Disagree" )
    DermaButton:SetSize( 165, 30 )
    DermaButton:SetPos( 420, 860 )
    DermaButton:SetParent( MainMenu )

    DermaButton.DoClick = function()
        MainMenu:Close()
        surface.PlaySound( "buttons/button8.wav" )
        RunConsoleCommand( "say", "I disagree with the rules, I will now be disconnected.")
        RunConsoleCommand( "disconnect" )
    end

    local TabOne = vgui.Create( "DPanel" )
    TabOne:SetVisible( true )
    local HTML = vgui.Create("HTML")
    HTML:SetPos(50,50)
    HTML:SetSize(ScrW() - 100, ScrH() - 100)
    HTML:OpenURL("http://www.garrysmod.com")

    local TabThree = vgui.Create( "DPanel" )
    TabThree:SetVisible( true )

    local HTML = vgui.Create("HTML")
    HTML:SetPos(50,50)
    HTML:SetSize(ScrW() - 100, ScrH() - 100)
    HTML:OpenURL("http://www.garrysmod.com")

    local TabTwo = vgui.Create( "DPanel" )
    TabTwo:SetVisible( true )

    local HTML = vgui.Create("HTML")
    HTML:SetPos(50,50)
    HTML:SetSize(ScrW() - 100, ScrH() - 100)
    HTML:OpenURL("http://www.garrysmod.com")

    local TabFour = vgui.Create( "DPanel" )
    TabThree:SetVisible( true )

    local HTML = vgui.Create("HTML")
    HTML:SetPos(50,50)
    HTML:SetSize(ScrW() - 100, ScrH() - 100)
    HTML:OpenURL("http://www.garrysmod.com")

    local TabFive = vgui.Create( "DPanel" )
    TabThree:SetVisible( true )

    local HTML = vgui.Create("HTML")
    HTML:SetPos(50,50)
    HTML:SetSize(ScrW() - 100, ScrH() - 100)
    HTML:OpenURL("http://www.garrysmod.com")

    PropertySheet:AddSheet( "Home", TabOne, "gui/silkicons/heart",
        false, false, "Welcome to the server!" )

    PropertySheet:AddSheet( "Rules", TabTwo, "gui/silkicons/script",
        false, false, "Server rules!" )

    PropertySheet:AddSheet( "Group", TabThree, "gui/silkicons/group",
        false, false, "Group page!" )

    PropertySheet:AddSheet( "Ranks", TabFour, "gui/silkicons/flag_blue",
        false, false, "Ranks and donations!" )

    PropertySheet:AddSheet( "Admins", TabFive, "gui/silkicons/shield",
        false, false, "Your admin squad!" )
end

concommand.Add("OpenMotd", Welcome )

如果您需要快速与我联系,可以在Steam上的Steamcommunity.com/id/PonyTerrance上找到我。

之所以发生这种情况,是因为您没有在代码中的任何地方关闭HTML对象。

还要记住,您正在使用相同的变量名创建多个HTML对象-为每个变量名选择一个唯一的变量名,或者简单地创建一个HTML对象,然后删除正在创建HTML对象的其他代码段。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM