• Make a hook to open a VGUI?
    2 replies, posted
I am comfused open making a hook to open this vgui this is what I have so far [CODE] concommand.Add("!compliment", DermaPanel) hook.Add( "PlayerSay", "!compliment", function (ply, text, public) text = string.lower( text ) if ( text == "!compliment") then end end) local DermaPanel = vgui.Create( "DFrame" ) DermaPanel:SetPos( 50,50 ) DermaPanel:SetSize( 250, 300 ) DermaPanel:SetTitle( "Compliment A Staff Member" ) DermaPanel:SetVisible( true ) DermaPanel:SetDraggable( true ) DermaPanel:ShowCloseButton( true ) DermaPanel:SetMouseInputEnabled(true) DermaPanel:SetKeyboardInputEnabled(true) DermaPanel:MakePopup()[/CODE]
[code] concommand.Add("compliment", DermaPanel) hook.Add( "PlayerSay", "!compliment", function (ply, text, public) text = string.lower( text ) if ( text == "!compliment") then local DermaPanel = vgui.Create( "DFrame" ) DermaPanel:SetPos( 50,50 ) DermaPanel:SetSize( 250, 300 ) DermaPanel:SetTitle( "Compliment A Staff Member" ) DermaPanel:SetVisible( true ) DermaPanel:SetDraggable( true ) DermaPanel:ShowCloseButton( true ) DermaPanel:SetMouseInputEnabled(true) DermaPanel:SetKeyboardInputEnabled(true) DermaPanel:MakePopup() end end) [/code] Untested, because I can't right now.
You can't create vgui panels in a PlayerSay hook because a PlayerSay hook is serverside and vgui is clientside. I honestly don't understand why people still have this problem- I've seen at least 5 threads asking the exact same thing, so here's the solution again: [CODE] hook.Add( "OnPlayerChat", "!compliment", function(ply, text, team, dead) text = string.lower( text ) if ( text == "!compliment") and ply == LocalPlayer() then local DermaPanel = vgui.Create( "DFrame" ) DermaPanel:SetPos( 50,50 ) DermaPanel:SetSize( 250, 300 ) DermaPanel:SetTitle( "Compliment A Staff Member" ) DermaPanel:SetVisible( true ) DermaPanel:SetDraggable( true ) DermaPanel:ShowCloseButton( true ) DermaPanel:SetMouseInputEnabled(true) DermaPanel:SetKeyboardInputEnabled(true) DermaPanel:MakePopup() end end) [/CODE]
Sorry, you need to Log In to post a reply to this thread.