簡體   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