Gamemode.AcceptStream

From GMod Wiki

Revision as of 15:11, 17 February 2011 by BlackVoid (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Event Hook
Hook NameAcceptStream
SyntaxGM:AcceptStream( Player pl, String handler, Number id )
DescriptionCalled when a client wants to use datastream to communicate with the server.
ReturnsBoolean
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.AcceptStream]Gamemode.AcceptStream [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionAllows the player to send the stream.
Used onNewerServer.png
Code
 
function GM:AcceptStream ( pl, handler, id )
     return true
end
 
OutputThe stream is opened and the data will start streaming.

DescriptionHook version.
Used onNewerServer.png
Code
 
function AdminOnly( pl, handler, id )
     if !pl:IsAdmin( ) and table.HasValue( adminStreams, handler ) then return false end
     return true
end
hook.Add( "AcceptStream", "ASAdminOnly", AdminOnly );
 
OutputIf the client is sending an admin-only handler and they are not an admin, it will not allow the stream.


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox