Garry's Mod Wiki

GM:PlayerDroppedWeapon

GM:PlayerDroppedWeapon( Player owner, Weapon wep )

Description

Called when a weapon is dropped by a player via Player:DropWeapon.

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 owner
The player 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() .. " drop " .. wep:GetPrintName()) end)
Output: Player1 drop AR2

Page Links


Special Pages


Wikis

?

Render Time: 30ms

DB GetPage 4
Generate Html 5
SaveChanges (1) 8
Render Body 0
Render Sidebar 12