Garry's Mod Wiki

GM:OnPhysgunFreeze

  GM:OnPhysgunFreeze( Entity weapon, PhysObj physobj, Entity ent, Player ply )

Description

Called when a player freezes an entity with the physgun.

This is not called for players or NPCs being held with the physgun.

Issue Tracker: 723

Arguments

1 Entity weapon
The weapon that was used to freeze the entity.
2 PhysObj physobj
Physics object of the entity.
3 Entity ent
The target entity.
4 Player ply
The player who tried to freeze the entity.

Example

Only allows admins to freeze things, by preventing the default base gamemode code from running due to how the hook library functions.
See hook.Add for explanation. The return value does not matter, as long as it is not nil, the base code will not run.

hook.Add( "OnPhysgunFreeze", "PhysFreeze", function( weapon, phys, ent, ply ) if not ply:IsAdmin() then return false end end )