I just started my god server and I want to create a chat command that will open up your steam browser with my Workshop collection link.
Could you help me?
Thanks in advance : )
hook.Add( "PlayerSay", "Killurself", function( ply, text, public ) text = string.lower( text ) -- Make the chat message entirely lowercase if ( text == "/facepunch" ) then -- Command gui.OpenURL("https://facepunch.com") -- URL return "" end end )
Wrong. PlayerSay is server-side and gui.OpenURL is client-side. Won’t work.
[lua]hook.Add( “OnPlayerChat”, “Dontkillurself”, function( ply, text )
if ( text:lower() == “/facepunch” ) then – Command
gui.OpenURL(“https://facepunch.com”) – URL
Put somewhere in lua/autorun/client/… in the case you don’t know what to do at this point.
Thank you guys very mutch, I tried it and it worked. : )