Set up custom command to bring up steam workshop page
6 replies, posted
I'm in the middle of making a content pack for my server and I was wondering how to make so when you type ingame like !content in chat it comes up with the steam workshop page what i have set. so can some please help thanks.
Combine this:
[url]http://wiki.garrysmod.com/page/GM/PlayerSay[/url]
With
[code]
ply:SendLua([[gui.OpenURL("http://www.google.co.uk")]])
[/code]
so would it be along this lines of this
hook.Add( "PlayerSay", "!contemt", function( ply:SendLua([[gui.OpenURL("http://www.google.co.uk")]]) )
if ( string.sub( text, 1, 4 ) == "!contemt" ) then--if ( the first 8 letters are !contemt continue
return "[Global] " .. string.sub( text, 5 ) --add [Global] infront of the players text ) then display
end
end )
[lua]
hook.Add("PlayerSay", "open_link", function( ply, text )
if ( text:lower() == "!content" ) then
ply:SendLua([[ gui.OpenURL("http://www.google.co.uk") ]])
end
end)
[/lua]
something more like that
and where would i save this new file
If you scroll down to the bottom of the gmod wiki, or check the top of maurits, it tells you where stuff belongs; either serverside, client or shared
Here you can see this is server side, meaning you'd want it in lua/autorun/server
I'd also recommend you read up on how hooks work, as well
lua/autorun/server/filename.lua should work.
Edit: ninja pug attacks
Sorry, you need to Log In to post a reply to this thread.