i would like to have a webpage open when a client types in a command in either chat or console.
In Example
Client types: !forums
A webpage opens to my sites forums.
Client can post and read the forums.
Client closes page
Client types: !rules
A webpage opens to the rules (also on website)
i just need the basic code. enough so that i can just input the web addresses into the lua file.
im pretty good at figuring out lua but i have to see it in action first. so just one of those will work and i could edit it to fit what i want
Something like this?
Im typing from in thread so dont QQ.
[lua]
concommand.Add("openforum", function ( ply, cmd, args)
local URL = "yourwebsite.com"
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetSize( ScrW()-50, ScrH()-50 )
DermaPanel:Center()
DermaPanel:SetTitle( "Forum" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( false )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
HTML = vgui.Create("HTML", DermaPanel)
HTML:SetPos(10,30)
HTML:SetSize(DermaPanel:GetWide()-20, DermaPanel:GetTall()-60)
HTML:OpenURL(URL)
end)
[/lua]
[B]Untested but should work.[/B]
that looks about right. now if i wanted different sites for different commands would i just copy and paste that again in the same lua?
You can use that along with
[lua]
if CLIENT then print("You suck at lua this is SERVER-SIDE ROAR!") return end
hook.Add("PlayerSay","TextHelp", function(ply,text)
if string.sub(1,7) == "!forums" then
ply:ConCommand("!forums")
elseif string.sub(1,6) == "!rules" then
ply:ConCommand("!rules")
end
end)
[/lua]
So if they type
!forums
It'll work, But if they type..
hello !forums
It won't work.
Sorry, you need to Log In to post a reply to this thread.