Odd new clientside error...

Hey everyone,

I haven’t played GMOD in a while, but while on my servers, from time to time me and other players get this line of LUA spammed repeatedly until we log:

[lua\includes\util.lua:211] Entity:Remove cannot be called while rendering

I understand what it is saying I suppose, but I’m wondering how I would go about fixing it on the servers that I code… Anyone know anything about this or how to prevent it?

Thanks in advance!

  • S

It has something to do with spawnicons and modelpanels their SetModel’s being set too soon? I’m not quite sure about that though…

I guess a lazy solution would be to set all :Remove() calls in the render hook on a 0 second timer liek so
[lua]
ent:Remove() --changes to
timer.Simple(0,ent.Remove,ent) --this
[/lua]

[editline]20th November 2010[/editline]

Actually we have a utility function, use this instead
[lua]
SafeRemoveEntityDelayed(ent,0)
[/lua]

[editline]20th November 2010[/editline]

The delay is so it will wait 'til the next frame and remove the entity in the proper way (outside of the render part)

Excellent, thanks a bunch for looking into this Ralle105! :slight_smile: