Garry's Mod Wiki

GM:PlayerDroppedWeapon

  GM:PlayerDroppedWeapon( Player or NPC owner, Weapon wep )

Description

Called when a weapon is dropped by a player via Player:DropWeapon. Despite its name, this hook is also called for NPC weapon drops.

Also called when a weapon is removed from a player via Player:StripWeapon.

See also GM:WeaponEquip for a hook when a player picks up a weapon.

The weapon's Entity:GetOwner will be NULL at the time this hook is called.

WEAPON:OnDrop will be called before this hook is.

Arguments

1 Player or NPC owner
The player or NPC who owned this weapon before it was dropped.
2 Weapon wep
The weapon that was dropped.

Example

Print in the chat when a player drop his weapons

hook.Add("PlayerDroppedWeapon", "PrintWhenDrop", function(owner, wep) PrintMessage( HUD_PRINTTALK, owner:Nick() .. " dropped " .. wep:GetPrintName() ) end)
Output: Player1 drop AR2