[HELP] Attach Model To Playermodels Head How do I change Angle
1 replies, posted
Hello I am trying to create a hat store in DarkRP
I'm pretty confident in the store part but not the hat part
How do I create a hat
I have tried this code but I cannot seem to rotate the horsie head model
if someone could explain how i can rotate the model to face upwards that would be helpful
Snapshot:
[IMG]http://i.imgur.com/GYNpavs.jpg[/IMG]
Also the scale is a little off
[CODE]
local hats = { }
local function CreateHat( pl, model )
SafeRemoveEntity( pl.Hat )
local hat
hat = ClientsideModel( model, RENDERGROUP_OPAQUE )
hat:SetNoDraw( true )
pl.Hat = hat
hat.Owner = pl
table.insert( hats, hat )
end
local function CleanHats( )
local k, v
for k, v in pairs( hats ) do
if not IsValid( v ) then
hats[ k ] = nil
elseif not IsValid( v.Owner ) then
SafeRemoveEntity( v )
hats[ k ] = nil
end
end
end
local function DrawHats( )
local k, v, pos, ang
CleanHats( )
for k, v in ipairs( player.GetAll( ) ) do
if not v:Alive( ) and IsValid( v.Hat ) then
SafeRemoveEntity( v.Hat )
v = v:GetRagdollEntity( )
end
if not IsValid( v.Hat ) then
CreateHat( v, "models/horsie/horsiemask.mdl" )
end
pos, ang = v:GetBonePosition( 6 )
v.Hat:SetPos( pos )
v.Hat:SetAngles( ang )
v.Hat:DrawModel( )
end
end
hook.Add( "PostDrawOpaqueRenderables", "Draw Hats.PostDrawOpaqueRenderables", DrawHats )[/CODE]
*bump*
Sorry, you need to Log In to post a reply to this thread.