[CODE]hook.Add( "PlayerSay", "Crate", function( ply, text, public )
text = string.lower( text )
DFrame1 = vgui.Create( "DFrame" )
if ( text == "!crate" ) then
DFrame1:SetPos( 5, 5 )
DFrame1:SetSize( 500, 500 )
DFrame1:SetTitle( "Startup" )
DFrame1:SetVisible( true )
DFrame1:SetDraggable( false )
DFrame1:ShowCloseButton( true )
DFrame1:MakePopup()
return ""
end
end )[/CODE]
I was trying to make a DFrame that opens up when a player types !crate. But the hook dosent seem to work! Please help!
PlayerSay is a serverside hook. Anything to do with vgui is clientside. Use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/OnPlayerChat]GM:OnPlayerChat[/url] instead.
[editline]19th June 2016[/editline]
Alternatively, you could use the net library, but to save yourself from unnecessary networking, it's probably best to use OnPlayerChat.
Sorry, you need to Log In to post a reply to this thread.