Garry's Mod Wiki

Revision Difference

WEAPON:PreDrawViewModel#567686

<function name="PreDrawViewModel" parent="WEAPON" type="hook"> <description>Allows you to modify viewmodel while the weapon in use before it is drawn. This hook only works if you haven't overridden <page>GM:PreDrawViewModel</page>.</description>⤶ <description>Allows you to modify viewmodel while the weapon in use before it is drawn.⤶ This hook relies on default implementation of <page>GM:PreDrawViewModel</page>. If it appears to not work, it may have been overwritten/broken by the currently active gamemode or other addons.⤶ ⤶ See also <page>WEAPON:ViewModelDrawn</page> and <page>WEAPON:PostDrawViewModel</page>.⤶ ⤶ <rendercontext hook="true" type="3D"></rendercontext>⤶ </description>⤶ <realm>Client</realm> <args> <arg name="vm" type="Entity">This is the view model entity before it is drawn.</arg> <arg name="weapon" type="Weapon">This is the weapon that is from the view model.</arg> <arg name="ply" type="Player">The the owner of the view model.</arg> <arg name="flags" type="number" added="2025.12.16">The <page text="STUDIO_">Enums/STUDIO</page> flags for this render operation.</arg> </args> <rets> <ret name="" type="boolean">Return `true` to prevent the default action of rendering the view model. `PostDrawViewModel` will NOT be called in this scenario.</ret> </rets> </function>