Garry's Mod Wiki

Player:DrawViewModel

  Player:DrawViewModel( boolean draw, number vm = 0 )

Description

Show/Hide the player's weapon's viewmodel.

Arguments

1 boolean draw
Should draw
2 number vm = 0
Which view model to show/hide, 0-2.

Example

Create a ConVar object on the client realm to enable/disable the viewmodel.

local cvarObject = CreateClientConVar("nogun", "1", true, false, "Hide the current viewmodel.") -- Create the ConVar object hook.Add("HUDPaint", "draw_viewmodel", function() LocalPlayer():DrawViewModel( cvarObject:GetBool() ) -- Call ConVar:GetBool() inside the parameters of DrawViewModel end)