Custom Gamemode, player arms not rendering in 1st person
2 replies, posted
Hi I'm getting fairly into my new gamemode now, but I notice that the majority of weapons (weapon_pistol, weapon_smg, ...) draw without player arms in first person.
Is there something I'm supposed to be calling to enable player arms since GMOD 13?
Picture: (The deagle is a custom swep, but same for other weapons too. Just testing some destructible door stuff)
[IMG]http://i.imgur.com/0UJU93v.jpg[/IMG]
Really appreciate it, thanks!
In GM:PostDrawViewModel do
[code]
if ( weapon.UseHands || !weapon:IsScripted() ) then
local hands = LocalPlayer():GetHands()
if ( IsValid( hands ) ) then hands:DrawModel() end
end
[/code]
And in GM:PlayerSpawn do
[code]
local oldhands = ply:GetHands()
if ( IsValid( oldhands ) ) then oldhands:Remove() end
local hands = ents.Create( "gmod_hands" )
if ( IsValid( hands ) ) then
ply:SetHands( hands )
hands:SetOwner( ply )
-- Which hands should we use?
local cl_playermodel = ply:GetInfo( "cl_playermodel" )
local info = player_manager.TranslatePlayerHands( cl_playermodel )
if ( info ) then
hands:SetModel( info.model )
hands:SetSkin( info.skin )
hands:SetBodyGroups( info.body )
end
-- Attach them to the viewmodel
local vm = ply:GetViewModel( 0 )
hands:AttachToViewmodel( vm )
vm:DeleteOnRemove( hands )
ply:DeleteOnRemove( hands )
hands:Spawn()
[/code]
This is exactly what I wanted. Thanks so much!
Sorry, you need to Log In to post a reply to this thread.