Hello, so currently i got it working with having the player's model on the hud without it making lag. But something i can't figure out is how to make it update, when the player's model is updated, right now i have to reload the script to make it update. I am at a loss.
[LUA]
local pmodel
local function PlayerModel( p )
pmodel = vgui.Create( "DModelPanel" )
pmodel:SetPos( ScrW() / 1200, y-100 )
pmodel:SetSize( 100,100 )
pmodel:SetModel( p:GetModel())
pmodel:SetCamPos(Vector(15,-10,62))
pmodel:SetLookAt(Vector(0,0,62))
end
function DrawHUD()
//PMODEL
if pmodel then
return
else
PlayerModel( LocalPlayer() )
end
end
hook.Add("HUDPaint", "DrawHUD", DrawHUD)
[/LUA]
[code]
local pmodel
local function PlayerModel( p )
pmodel = vgui.Create( "DModelPanel" )
pmodel:SetPos( ScrW() / 1200, y-100 )
pmodel:SetSize( 100, 100 )
pmodel:SetModel( p:GetModel() )
pmodel:SetCamPos( Vector( 15, -10, 62 ) )
pmodel:SetLookAt( Vector( 0, 0, 62 ) )
end
function DrawHUD
if pmodel then
if ( pmodel.Entity:GetModel() != LocalPlayer():GetModel() ) then
PlayerModel( LocalPlayer() )
end
return
else
PlayerModel( LocalPlayer() )
end
end
hook.Add("HUDPaint", "DrawHUD", DrawHUD)
[/code]
Untested, but you get the idea. pmodel.Entity is where clientside model for DModelPanel is stored.
[QUOTE=Robotboy655;44693583][code]
local pmodel
local function PlayerModel( p )
pmodel = vgui.Create( "DModelPanel" )
pmodel:SetPos( ScrW() / 1200, y-100 )
pmodel:SetSize( 100, 100 )
pmodel:SetModel( p:GetModel() )
pmodel:SetCamPos( Vector( 15, -10, 62 ) )
pmodel:SetLookAt( Vector( 0, 0, 62 ) )
end
function DrawHUD
if pmodel then
if ( pmodel.Entity:GetModel() != LocalPlayer():GetModel() ) then
PlayerModel( LocalPlayer() )
end
return
else
PlayerModel( LocalPlayer() )
end
end
hook.Add("HUDPaint", "DrawHUD", DrawHUD)
[/code]
Untested, but you get the idea. pmodel.Entity is where clientside model for DModelPanel is stored.[/QUOTE]
That updates the model, but it just creates a new pmodel on top.
[QUOTE=TheClassified;44694250]That updates the model, but it just creates a new pmodel on top.[/QUOTE]
[lua]
local pmodel
local function PlayerModel( p )
pmodel = vgui.Create( "DModelPanel" )
pmodel:SetPos( ScrW() / 1200, y-100 )
pmodel:SetSize( 100, 100 )
pmodel:SetModel( p:GetModel() )
pmodel:SetCamPos( Vector( 15, -10, 62 ) )
pmodel:SetLookAt( Vector( 0, 0, 62 ) )
end
function DrawHUD
if pmodel then
if ( pmodel.Entity:GetModel() != LocalPlayer():GetModel() ) then
pmodel:Remove()
PlayerModel( LocalPlayer() )
end
return
else
PlayerModel( LocalPlayer() )
end
end
hook.Add("HUDPaint", "DrawHUD", DrawHUD)
[/lua]
[QUOTE=HumbleTH;44694349][lua]
local pmodel
local function PlayerModel( p )
pmodel = vgui.Create( "DModelPanel" )
pmodel:SetPos( ScrW() / 1200, y-100 )
pmodel:SetSize( 100, 100 )
pmodel:SetModel( p:GetModel() )
pmodel:SetCamPos( Vector( 15, -10, 62 ) )
pmodel:SetLookAt( Vector( 0, 0, 62 ) )
end
function DrawHUD
if pmodel then
if ( pmodel.Entity:GetModel() != LocalPlayer():GetModel() ) then
pmodel:Remove()
PlayerModel( LocalPlayer() )
end
return
else
PlayerModel( LocalPlayer() )
end
end
hook.Add("HUDPaint", "DrawHUD", DrawHUD)
[/lua][/QUOTE]
That worked, tried it before. It didin't want to work. Must've placed it wrong. Thank you :)
Sorry, you need to Log In to post a reply to this thread.