Garry's Mod Wiki

GM:WeaponEquip

GM:WeaponEquip( Weapon weapon, Player owner )

Description

Called as a weapon entity is picked up by a player.

See also GM:PlayerDroppedWeapon.

At the time when this hook is called Entity:GetOwner will return NULL. The owner is set on the next frame
This will not be called when picking up a weapon you already have as the weapon will be removed and WEAPON:EquipAmmo will be called instead

Arguments

1 Weapon weapon
The equipped weapon.
2 Player owner
The player that is picking up the weapon.

Example

Drops the player's weapons as soon as they pick one up.

hook.Add( "WeaponEquip", "WeaponEquipExample", function( wep, ply ) timer.Simple( 0, function() ply:DropWeapon( wep ) end ) end )

Page Links


Special Pages


Wikis

?

Render Time: 80ms

DB GetPage 46
Generate Html 9
SaveChanges (1) 10
Render Body 0
Render Sidebar 13