Drawing on ents.Create entity.

I want to use ENT:Draw() function on entity created with ents.Create is it possible or there a way to do like this?

I’m pretty sure you can use the variable that you put on ents.Create and just do

function var:Draw()
    --do something

Be wary though because it will override the default Draw function for the entity.

ents.Create returns the created entity. Just override the your_entity:Draw() function.

I couldn’t do it. Because ents.create is serverside thing and Draw() function is clientside and ents.create was inside of a hook so no hope then.

Better way to figure this out is what entity are you trying to create? Are you trying to create a SENT that you have access to the code for?

It’s like a drop system when a player dies. But the created entity always changes (like ak47, m4a1, food).

Well if you’re trying to alter their DRAW functions then you’ll have to do so clientside, or edit the files themselves.

But this all depends on what you’re trying to do - if it’s just dropped items you could always simply just draw over them using Cam3D2D.

I know how what is Cam3D2D. Problem is ents.create in server. I think it’s dead end.


GM:OnEntityCreated clientside then.

[editline]6th October 2017[/editline]

It would be better if you gave more detail about what you’re trying to do, and if this is a SENT or engine entity.

It’s drop system basically. Its drop(spawns) whatever entity class given by user. So I will try your suggestion.