Garry's Mod Wiki

WEAPON:Holster

boolean WEAPON:Holster( Entity weapon )
This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.

Description

Called when weapon tries to holster.

This will only be called serverside when using Player:SelectWeapon as that function immidiately switches the weapon out of prediction.
This is called twice for every holster clientside, one in Prediction and one not.

Issue Tracker: 2854
Before WEAPON:OnRemove is called, this function is only called serverside.

Issue Tracker: 3133

Arguments

1 Entity weapon
The weapon we are trying switch to.

Returns

1 boolean
Return true to allow weapon to holster.

This will not have an effect if weapon was switched away from using Player:SetActiveWeapon

Example

Returns the weapon switched to when when the weapon is being holstered.

function SWEP:Holster( wep ) if not IsFirstTimePredicted() then return end LocalPlayer():ChatPrint("Switched to: "..(wep.PrintName or wep:GetClass())) end
Output: Switched to Toolgun Switched to weapon_crowbar

Page Links


Special Pages


Wikis

?

Render Time: 83ms

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