GM/AcceptInput

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
 
Line 2: Line 2:
 
|Description=Called when a map I/O event occurs.
 
|Description=Called when a map I/O event occurs.
  
See also {{ClassFunction|Entity|Fire}} and {{ClassFunction|Entity|Input}}.
+
See also {{ClassFunction|Entity|Fire}} and {{ClassFunction|Entity|Input}} for functions to fire Inputs on entities.
 
|Realm=Server
 
|Realm=Server
 
|Predicted=No
 
|Predicted=No

Latest revision as of 16:54, 14 August 2019

 GM:AcceptInput( )

Contents

Description

Called when a map I/O event occurs.

See also Entity:Fire and Entity:Input for functions to fire Inputs on entities.

Arguments

Entity ent

Entity that receives the input

Arguments

string input

The input name. Is not guaranteed to be a valid input on the entity.

Arguments

Entity activator

Activator of the input

Arguments

Entity caller

Caller of the input

Arguments

any value

Data provided with the input. Will be either a string, a number, a boolean or a nil.

Returns

boolean

Return true to prevent this input from being processed.

Examples

Example

This would block any input that the lua_run entity would receive.

hook.Add( "AcceptInput", "BlockLuaRun", function( ent, name, activator, caller, data )
    if ( ent:GetClass() == "lua_run" ) then
        return true
    end
end )


Personal tools
Navigation