Hello do anyone, what the command to create an !content command. So like whenever someone types !content in chat a URL pop ups where they can download the server addons.
GM/PlayerSay
Net Library Usage
LUA If Then Else
gui.OpenURL
That's all you need
hook.Add( "PlayerSay", "Content", function( ply, text, public )
if ( string.lower( text ) == "!content" )
local button = vgui.Create( "Content )
button:SetSize( 125, 90 )
button:Center()
button:SetText( "Workshop Collection!" )
button.DoClick = function()
gui.OpenURL( "URL Link" )
end
Would this work?
Nope, that is a server side function that you are hooking on, and you are trying to create a derma which can only created on the client side.
Also "Content" is not a valid panel type afaik.
And you forgot the ')' at the end of the hook and you forgot the then in your if statement.
If you are using PlayerSay you will have to network to the client side to create a derma panel.
Alternatively you can use GM/OnPlayerChat which works clientside, not recommended though.
Well im kinda a LUA noob, so i do not know how to set up a command like what.
Read this:
GM/OnPlayerChat
States
Net Library Usage
We are not going to code, you will thank us once you found what you were looking for since you learned the most hard start up thing in gmod lua
Sorry, you need to Log In to post a reply to this thread.