Garry's Mod Wiki

Revision Difference

GM:OnPhysgunFreeze#511163

<function name="OnPhysgunFreeze" parent="GM" type="hook">⤶ <ishook>yes</ishook>⤶ <description>⤶ Called when a player freezes an entity with the physgun.⤶ ⤶ <bug issue="723">This is not called for players or NPCs being held with the physgun.</bug>⤶ </description>⤶ <realm>Server</realm>⤶ <predicted>No</predicted>⤶ <args>⤶ <arg name="weapon" type="Entity">The weapon that was used to freeze the entity.</arg>⤶ <arg name="physobj" type="PhysObj">Physics object of the entity.</arg>⤶ <arg name="ent" type="Entity">The target entity.</arg>⤶ <arg name="ply" type="Player">The player who tried to freeze the entity.</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="boolean">Allows you to override whether the player can freeze the entity</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Only allows admins to freeze things.</description>⤶ <code>⤶ hook.Add( "OnPhysgunFreeze", "PhysFreeze", function( weapon, phys, ent, ply )⤶ ⤶ if ( !ply:IsAdmin() ) then⤶ ⤶ return false⤶ ⤶ end⤶ ⤶ end )⤶ </code>⤶ ⤶ </example>