Garry's Mod Wiki


  boolean WEAPON:AcceptInput( string inputName, Entity activator, Entity called, string data )


Called when another entity fires an event to this entity.


1 string inputName
The name of the input that was triggered.
2 Entity activator
The initial cause for the input getting triggered.
3 Entity called
The entity that directly trigger the input.
4 string data
The data passed.


1 boolean
Should we suppress the default action for this input?


A workaround for weapons created by maps not taking into account spawnflags.

function SWEP:AcceptInput( name, activator, caller, data ) -- Check for input and spawnflag if ( name == "ConstraintBroken" && self:HasSpawnFlags( 1 ) ) then -- Freeze the weapon local phys = self:GetPhysicsObject() if ( IsValid( phys ) ) then phys:EnableMotion( false ) end -- Remove the spawnflag so it doesn't freeze the weapon when it is dropped local newflags = self:GetSpawnFlags(), bit.bnot( 1 ) ) self:SetKeyValue( "spawnflags", newflags ) end end