I'm having problems with this, I thought I knew, and well I guess I don't. That or it's changed last time I did this (which is probably the case).
There is no error, it will not even be placed on the screen period. I've all the way I could try. Even trying to "HUDPaint" it (which causes crazy lag). Nothing. Here is what I'm trying to get the work.
[lua]
--[[---------------------------------------------------------
The Typical PlayerModel on HUD
-----------------------------------------------------------]]
local CamPos = Vector( 15, 4, 60 )
local LookAt = Vector( 0, 0, 60 )
local function PlayerModel()
--> Create
PlayerModel = vgui.Create( "DModelPanel" )
function PlayerModel:LayoutEntity( Entity ) return end
PlayerModel:SetModel( LocalPlayer():GetModel() )
PlayerModel:SetPos( 20, ScrH() - 80 )
PlayerModel:SetSize( 80, 80 )
PlayerModel:ParentToHUD()
PlayerModel.Entity:SetPos( PlayerModel.Entity:GetPos() - Vector( 0, 0, 4 ) )
PlayerModel:SetCamPos( CamPos )
PlayerModel:SetLookAt( LookAt )
timer.Create( "vizik_hud_update", 1, 0, function()
if LocalPlayer():GetModel() != PlayerModel.Entity:GetModel() then
--> Remove Panel
PlayerModel:Remove()
--> Create Panel
PlayerModel = vgui.Create( "DModelPanel" )
function PlayerModel:LayoutEntity( Entity ) return end
PlayerModel:SetModel( LocalPlayer():GetModel() )
PlayerModel:SetPos( 20, ScrH() - 80 )
PlayerModel:SetSize( 80, 80 )
PlayerModel:ParentToHUD()
PlayerModel.Entity:SetPos( PlayerModel.Entity:GetPos() - Vector( 0, 0, 4 ) )
PlayerModel:SetCamPos( CamPos )
PlayerModel:SetLookAt( LookAt )
end
end )
end
hook.Add( "InitPostEntity", "PlayerModel", PlayerModel )
end
[/lua]
Ignore the spacing.
I've used this code before and worked... now...nothing. Don't understand.
Any help will be appreciated :)
[editline]9th June 2016[/editline]
The only thing that will work is the obvious
[lua]
local Panel = vgui.Create( "DPanel" )
Panel:SetPos( 10, 10 )
Panel:SetSize( 200, 200 )
local icon = vgui.Create( "DModelPanel", Panel )
icon:SetSize( 200, 200 )
icon:SetModel( LocalPlayer():GetModel() )
[/lua]
But causes extreme lag.
Never put anything related with derma in a HUDPaint hook.
And you sure do[URL="https://facepunch.com/showthread.php?t=1521959"] talk a lot of shit[/URL] for someone who can't figure out how to add a model to a hud.
[QUOTE=Tupac;50485968]Never put anything related with derma in a HUDPaint hook.
And you sure do[URL="https://facepunch.com/showthread.php?t=1521959"] talk a lot of shit[/URL] for someone who can't figure out how to add a model to a hud.[/QUOTE]
I think i've already established it doesn't go with that. There was no reason to post here if your coming here acting like a 12 year old. You don't want to help? Leave.
[editline]10th June 2016[/editline]
Also that used to work. So something changed since last time I've messed with HUD. Not my fault.
[QUOTE=Vizik;50489359]I think i've already established it doesn't go with that. There was no reason to post here if your coming here acting like a 12 year old. You don't want to help? Leave.
[editline]10th June 2016[/editline]
Also that used to work. So something changed since last time I've messed with HUD. Not my fault.[/QUOTE]
He is right, I hope you know that
Jeez you caused a huge uproar. Though that doesn't mean you should be treated like ass, people need to just get over themselves.
Anyways again yes, don't use HUDPaint it will make your life a living hell while trying to use models. Looking at it, I don't see why it doesn't work. Remove the timer, not sure what your trying to achieve by that.
Sorry, you need to Log In to post a reply to this thread.