Last active
December 17, 2015 00:19
-
-
Save samuelmaddock/5520502 to your computer and use it in GitHub Desktop.
Alternate implementation of Garry's Mod view model hands without using player classes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GM:PostDrawViewModel( vm, ply, weapon ) | |
if ( !IsValid( weapon ) ) then return false end | |
if ( weapon.UseHands || !weapon:IsScripted() ) then | |
local hands = ply:GetHands() | |
if ( IsValid( hands ) ) then | |
hands:DrawModel() | |
end | |
end | |
if ( weapon.PostDrawViewModel == nil ) then return false end | |
return weapon:PostDrawViewModel( vm, weapon, ply ) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GM:PlayerSpawn( ply ) | |
local oldhands = ply:GetHands(); | |
if ( IsValid( oldhands ) ) then | |
oldhands:Remove() | |
end | |
local hands = ents.Create( "gmod_hands" ) | |
if ( IsValid( hands ) ) then | |
hands:DoSetup( ply ) | |
hands:Spawn() | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment