An NPC that runs a command when you press E on it

Hello everyone.

What I’m after is a simple entity that is an citizen NPC that spawns at a specifc world position (x, y, z) and runs a console command when you press E on it. If anyone can create one or point me in the right direction that would be helpful.

Create an entity that has the citizen model with the idle animation and use the ENT:Use() function

Could you possibly write it up for me?

EDIT: Sorry but i can no longer do this request as i have had enough of life.

K. Can anyonelse help me?

Edit: I’ve managed to do it all except for the animation. How do I set animations?

You use self:SendAnimation(ACT_IDLE) thats what i would use.

entities/ts2_usi/init.lua:30: attempt to call method ‘SendAnimation’ (a nil value)

I have it in ENT:Initialize()

You could try SetAnimation instead.

ACT_IDLE may need to be a string if I’m correct.


Isn’t that error message saying that the function does not exist?
And I haven’t found anything about SendAnimation on the wiki.

Correct. I got that before.


But this does happen in Gmod 9

:v: :v: :v: :goon: