Hello guys. I tried to use the GMOD official tutorial to make playerhands visible, but did not work. So how can I do to make player hands visible with his current model?
ply:SetupHands() on PlayerSpawn?
[QUOTE=NiandraLades;46668967]ply:SetupHands() on PlayerSpawn?[/QUOTE]
Only this? I tried this with and then use another function (garry's mod lua tutorial)
[code]
local oldhands = self:GetHands()
if ( IsValid( oldhands ) ) then oldhands:Remove() end
local hands = ents.Create( "gmod_hands" )
if ( IsValid( hands ) ) then
self:SetHands( hands )
hands:SetOwner( self )
-- Which hands should we use?
local cl_playermodel = self: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 = self:GetViewModel( 0 )
hands:AttachToViewmodel( vm )
vm:DeleteOnRemove( hands )
self:DeleteOnRemove( hands )
hands:Spawn()
end
[/code]
Taken from my GSurvival gamemode, which I believe I took this code from TTT
[QUOTE=LUModder;46672321][code]
local oldhands = self:GetHands()
if ( IsValid( oldhands ) ) then oldhands:Remove() end
local hands = ents.Create( "gmod_hands" )
if ( IsValid( hands ) ) then
self:SetHands( hands )
hands:SetOwner( self )
-- Which hands should we use?
local cl_playermodel = self: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 = self:GetViewModel( 0 )
hands:AttachToViewmodel( vm )
vm:DeleteOnRemove( hands )
self:DeleteOnRemove( hands )
hands:Spawn()
end
[/code]
Taken from my GSurvival gamemode, which I believe I took this code from TTT[/QUOTE]
This is old, use player:SetupHands()
[QUOTE=Robotboy655;46674890]This is old, use player:SetupHands()[/QUOTE]
But only this? player:SetupHands, or there's more code?
As I said, ply:SetupHands() on PlayerSpawn.
you should also make sure to do it after you set the playermodel
[QUOTE=Arizard;46675880]you should also make sure to do it after you set the playermodel[/QUOTE]
GM:PlayerSetModel is called after playerspawn?
[QUOTE=Nicksf13;46683977]GM:PlayerSetModel is called after playerspawn?[/QUOTE]
That is correct if you did not override GM:PlayerSpawn or if you did and manually calling the hook.
[QUOTE=Robotboy655;46684058]That is correct if you did not override GM:PlayerSpawn or if you did and manually calling the hook.[/QUOTE]
So you think it's better to call this function "ply:SetupHands()" in the GM:PlayerSetModel? Because I override PlayerSpawn and GM:PlayerSerModel
Call it after you call SetModel on the player.
[QUOTE=Robotboy655;46685432]Call it after you call SetModel on the player.[/QUOTE] TY
Sorry, you need to Log In to post a reply to this thread.