Two questions

First, I want to render a view of a model on the client’s HUD. I tried using this:
if not(PlyModel) then
PlyModel = vgui.Create(“DModelPanel”)
PlyModel:SetPos(10, ScrH() - 410)
PlyModel:SetSize(400, 400)
PlyModel.LayoutEntity = function() end

inside of HUDPaint, but that gives me the error:

ClientsideModel cannot be called while rendering

Second, is there a way to run a server command from the client?
I need a player to be unfrozen when client variables are true, and I’m currently using a concommand, but that means it can be done any time from the console.

For the first problem, create the panel outside of the HUDPaint hook (DModelPanel uses ClientsideModel and garry blocked that from being called inside render hooks)

Alright, but is there a way I could have parts of the HUD be drawn behind it, and other parts in front of it?

I think its layered on the last thing to be called is at the front so if you want stuff to be a background use


as its called before hudpaint

The issue with running server commands from the client is that you have no control over when the client will do something. You have to assume that the client has the ability to run this command at any time. So, you should make it dependent on serverside variables as to when they can run it.

I tried:

PlyModel = vgui.Create(“DModelPanel”)
PlyModel:SetPos(0, ScrH() - 410)
PlyModel:SetSize(600, 600)
PlyModel.LayoutEntity = function() end

function BattleScreenBG()
draw.TexturedQuad({x = 0, y = 0, w = ScrW(), h = ScrH(), texture = surface.GetTextureID(“battlescreen/BG”)})
hook.Add(“HUDPaintBackground”, “BattleScreenBG”, BattleScreenBG)

function BattleScreen()
//Blah blah
hook.Add(“HUDPaint”, “BattleScreen”, BattleScreen)
But it was still on top of the things in BattleScreen().

I dunno how, but by messing with the CamPos, LookAt, Size, and Pos, I got it to look like it’s underneath of it, so I don’t need that anymore.

How would I move it to the left, lower than 0? EDIT: Figured this out.

How would I manage client-side variables from the server? By assigning them from the server with Ply.Var?

When I tried to animate my DModelPanel with:

All he does is acts like he’s holding a crowbar, he doesn’t swing.
Yes, I’ve checked, the model has the animation.

How would I manage client-side variables from the server? By assigning them from the server with Ply.Var?

  1. Did you try PlyModel.Entity:SetPlaybackRate?

  2. You’d wanna use networked variables for that (ent:Set/GetNWString/Bool/Number/etc)

The model still won’t animate.
This is what it looks like:

Bump. No problems with networked variables so far.

Are you sure the model has a “Swing” as an animation?


I tried doing
[lua] lua_run_cl PlyModel:SetAnimated(ACT_MELEE_ATTACK_SWING_GESTURE) function PlyModel:LayoutEntity() self:RunAnimation() end [/lua]
From console, but that made the model do the walk animation.

function PlyModel:LayoutEntity()



There is no function “SetAnimation”.
I was trying to do it like the example on **[DModelPanel.SetAnimSpeed](**

According to the wiki **[DModelPanel.SetAnimated](** takes a bool.
What would seem most logical to me was if :RunAnimation would take the ACT_ enum as parameter, you should try that even though it’s not on the wiki.

Nope, all that did was run the walk animation.