DModelPanel and pointshop item issues

I seem to be having an issue with getting my model in DModelPanel.

With any default gmod/hl2/css etc model it’s fine, however with the one cutsom model on my server it displays an error, even though the model itself isn’t an error.

Any ideas why?

Code:



local xx, yy = 145, 147;
local function DrawPlayerModel()
       
        PlayerModel = vgui.Create("DModelPanel")
        function PlayerModel:LayoutEntity( Entity ) return end
        PlayerModel:SetModel( LocalPlayer():GetModel() )
        PlayerModel:SetPos(0, ScrH() - 180)
        PlayerModel:SetSize(xx,yy)
        PlayerModel:SetCamPos(Vector( 20, 0, 65 ))
        PlayerModel:SetLookAt(Vector( 0, 0, 65 ))
       
        timer.Create( "UpdatePlayerModel", 0.5, 0, function()
                if LocalPlayer():GetModel() != PlayerModel.Entity:GetModel() then
                        PlayerModel:Remove()
                        PlayerModel = vgui.Create("DModelPanel")
                        function PlayerModel:LayoutEntity( Entity ) return end         
                        PlayerModel:SetModel( LocalPlayer():GetModel())
                        PlayerModel:SetPos(0, ScrH() - 175)
                        PlayerModel:SetSize(xx,yy)
                        PlayerModel:SetCamPos(Vector( 20, 0, 65 ))
                        PlayerModel:SetLookAt(Vector( 0, 0, 65 ))
                end
        end)
       
end
hook.Add("InitPostEntity", "DrawPlayerModel", DrawPlayerModel) 


edit:

Was going to post this is pointshop thread but may as well kill two birds with one stone. I’m trying to set the colour of an item in the pointshop using :SetColor() however it doesn’t seem to do anything.


 
function ITEM:ModifyClientsideModel(ply, model, pos, ang)
	local Size = Vector(0.46000000834465,0.46000000834465,0.40999999642372)
	local mat = Matrix()
	mat:Scale(Size)
	model:EnableMatrix('RenderMultiply', mat)

        model:SetColor(255, 20, 200, 250)
	model:SetMaterial('') 
        

	local MAngle = Angle(280.17001342773,186.25999450684,0)
	local MPos = Vector(0.61000001430511,-7.5,0)

	pos = pos + (ang:Forward() * MPos.x) + (ang:Up() * MPos.z) + (ang:Right() * MPos.y)
	ang:RotateAroundAxis(ang:Forward(), MAngle.p)
	ang:RotateAroundAxis(ang:Up(), MAngle.y)
	ang:RotateAroundAxis(ang:Right(), MAngle.r)

	return model, pos, ang   
end 


It was suggested I used a colour tab;e but that didn’t change the issue.

Thanks.

(I tried posting this twice on Problems own thread but got no replies so apologies)

Well for a start Entity:SetColor takes a color structure and not 4 integers.

[editline]18th July 2014[/editline]

The only SetColor method I know of that takes 4 integers is surface.SetDrawColor. Also, since Garry’s Mod 13, the entity you are coloring also needs to have its RenderMode set to RENDERMODE_TRANSCOLOR (I think).

Thanks for the reply, I’ve checked the render mode and that’s fine. I’ll give it a whirl, silly for not checking documentation.

Does anyone have a solution to the DModelPanel issue?

What issue?

have the players model displaying in the HUD, for all default gmod/hl2/css models it’s fine, but for the one custom model on my server (when the player is on the deaths team) the model in the HUD is an error, but the model its self is not.

Have you made sure that the people who are seeing an error in the DModelPanel actually have the model on their client? (Just because you can see it, doesnt mean others can)

Yup, and it’#s an error for me too.

No offence but your code is actually pretty rubbish. Its probably not the problem but it certainly doesnt help with debugging.

You have an unnecessary timer that is creating NEW DModelPanels every half second without even removing the old one for god knows what reason.

The timer runs so often due to pointshop models, team models etc changing rather allot thus it needs to update regularly. Removing the old one? How do you mean?

I get a similar error. The custom citizen models on my darkrp server show fine in third person, but in a DModelPanel they are errors. GMod legs are also errors. Anyone know a fix?

Sorry to bump but this is happening with my code too. Any fixes?

I don’t think I ever got a solution working, I only ever got an error with one custom model, the rest where fine. Is this your problem also?

Yes. It is the same problem except with all of my custom models except one.