I wanted a little portrait of the model the client has at the bottom left so I used this
[CODE]hook.Add( "InitPostEntity", "hud_portrait", function()
local portrait = vgui.Create( "DModelPanel" )
portrait:SetPos( 10, ScrH() - 80 )
portrait:SetSize( 60, 70 )
portrait:SetModel( LocalPlayer():GetModel() )
portrait.Think = function()
portrait:SetModel( LocalPlayer():GetModel() )
end
portrait.LayoutEntity = function()
return false
end
portrait:SetFOV( 40 )
portrait:SetCamPos( Vector( 25, -15, 62 ) )
portrait:SetLookAt( Vector( 0, 0, 62 ) )
portrait.Entity:SetEyeTarget( Vector( 200, 200, 100 ) )
end )[/CODE]
But nothing shows?
Idk if you can use InitPostEntity for that.
Use HUDPaint imo and check if its already been created, instead of portrait.Think just use HUDPaint to set model
[QUOTE=Klaes4Zaugen;50811050]Idk if you can use InitPostEntity for that.
Use HUDPaint imo and check if its already been created, instead of portrait.Think just use HUDPaint to set model[/QUOTE]
Thanks it worked!
ehh, you shouldn't create the panel constantly, check if the panel already exists, and if it does, then return end.
I told him to check if its already created, it's his problem if he didn't adjust it.
I removed the hook due to it making it constantly but the HUD will not show up no more with the error:
[ERROR] addons/darkrpmodification/lua/darkrp_modules/hudreplacement/cl_hudreplacement.lua:197: Tried to use a NULL entity!
1. GetModel - [C]:-1
2. unknown - addons/darkrpmodification/lua/darkrp_modules/hudreplacement/cl_hudreplacement.lua:197
3. doInclude - [C]:-1
4. loadModules - gamemodes/darkrp/gamemode/libraries/modificationloader.lua:102
5. Call - gamemodes/darkrp/gamemode/libraries/modificationloader.lua:147
6. unknown - gamemodes/darkrp/gamemode/cl_init.lua:53
[editline]1st August 2016[/editline]
[QUOTE=Klaes4Zaugen;50811618]I told him to check if its already created, it's his problem if he didn't adjust it.[/QUOTE]
[QUOTE=whitestar;50811352]ehh, you shouldn't create the panel constantly, check if the panel already exists, and if it does, then return end.[/QUOTE]
Any ideas?
I told you to check if its been created. If you check that and if true then return end it wouldn't keep making em
[QUOTE=Klaes4Zaugen;50812438]I told you to check if its been created. If you check that and if true then return end it wouldn't keep making em[/QUOTE]
No, I fixed that part I believe it just is saying GetModel is a NULL entity?
[editline]1st August 2016[/editline]
[QUOTE=Klaes4Zaugen;50812438]I told you to check if its been created. If you check that and if true then return end it wouldn't keep making em[/QUOTE]
Got an example of the code for that? As, I think I am going to try that as this other idea of mine is producing errors.
[lua]
local avatar;
*hook*
if ( !IsValid( avatar ) ) then
*create avatar*
else
avatar:SetModel( LocalPlayer():GetModel() ):
end
end)
[/lua]
Sorry, you need to Log In to post a reply to this thread.