Garry's Mod Wiki

WEAPON:PreDrawViewModel

  boolean WEAPON:PreDrawViewModel( Entity vm, Weapon weapon, Player ply, number flags )

Description

Allows you to modify viewmodel while the weapon in use before it is drawn.

This hook relies on default implementation of GM:PreDrawViewModel. If it appears to not work, it may have been overwritten/broken by the currently active gamemode or other addons.

See also WEAPON:ViewModelDrawn and WEAPON:PostDrawViewModel.

This is a rendering hook which provides a 3d rendering context.

Arguments

1 Entity vm
This is the view model entity before it is drawn.
2 Weapon weapon
This is the weapon that is from the view model.
3 Player ply
The the owner of the view model.
4 number flags
The STUDIO_ flags for this render operation.

Returns

1 boolean
Return true to prevent the default action of rendering the view model. PostDrawViewModel will NOT be called in this scenario.