Garry's Mod Wiki

Revision Difference

WEAPON:Holster#517542

<function name="Holster" parent="WEAPON" type="hook"> <ishook>yes</ishook> <description> Called when weapon tries to holster. <bug issue="2854">This is called twice for every holster clientside, one in [prediction](/gmod/Prediction) and one not.</bug> <bug issue="2854">This is called twice for every holster clientside, one in <page>Prediction</page> and one not.</bug> <bug issue="3133">Before <page>WEAPON:OnRemove</page> is called, this function is only called serverside.</bug> </description> <realm>Shared</realm> <predicted>Yes</predicted> <args> <arg name="weapon" type="Entity">The weapon we are trying switch to.</arg> </args> <rets> <ret name="" type="boolean">Return true to allow weapon to holster</ret> </rets> </function> <example> <description>Returns the weapon switched to when when the weapon is being holstered.</description> <code> function SWEP:Holster( wep ) if not IsFirstTimePredicted() then return end LocalPlayer():ChatPrint("Switched to: "..(wep.PrintName or wep:GetClass())) end </code> <output> Switched to Toolgun Switched to weapon_crowbar </output> </example>