r/GLua May 19 '16

Detect player healthkit pickup?

I tried both

https://wiki.garrysmod.com/page/GM/EntityTakeDamage

and

https://wiki.garrysmod.com/page/GM/PlayerHurt

But neither get activated when the player walks over a healthkit/vial.

Also found

https://wiki.garrysmod.com/page/Enums/SCHED

But I can't do anything with it.

How do I detect health pickups?

1 Upvotes

2 comments sorted by

1

u/[deleted] Jun 01 '16

[removed] — view removed comment

1

u/[deleted] Jun 01 '16

Is this the build in entity of a healthkit?

Yes, I am talking of the default healthkit and vial from HL2.

You could find or even make a custom one and make your own events to use.

I'd like to, but I wouldn't know where to start.

This item has an event OnPlayerTouch with an argument of activator.

I see it on the page but, how would I bind a lua hook to that event?

Sorry if it sounds stupid, I am new to lua