diff --git a/shared/js/events/script.js b/shared/js/events/script.js index 00b7da1f0..2fdba719b 100644 --- a/shared/js/events/script.js +++ b/shared/js/events/script.js @@ -6,3 +6,15 @@ Event.register(alt.Enums.EventType.COLSHAPE_EVENT, "ColShapeEvent"); Event.register(alt.Enums.EventType.EXPLOSION_EVENT, "Explosion"); Event.register(alt.Enums.EventType.FIRE_EVENT, "FireStart"); Event.register(alt.Enums.EventType.START_PROJECTILE_EVENT, "ProjectileStart"); + +// Custom ColShape events +Event.register(alt.Enums.CustomEventType.ENTITY_ENTER_COLSHAPE, "EntityColShapeEnter", true); +Event.register(alt.Enums.CustomEventType.ENTITY_LEAVE_COLSHAPE, "EntityColShapeLeave", true); +alt.Events.onColShapeEvent(({ entity, colShape, state }) => { + const type = state ? alt.Enums.CustomEventType.ENTITY_ENTER_COLSHAPE : alt.Enums.CustomEventType.ENTITY_LEAVE_COLSHAPE; + const data = { + entity, + colShape + }; + Event.invoke(type, data, true); +}); diff --git a/shared/src/Event.h b/shared/src/Event.h index 9c3bf61a6..4a8ac0a5f 100644 --- a/shared/src/Event.h +++ b/shared/src/Event.h @@ -15,6 +15,9 @@ namespace js { NONE, + ENTITY_ENTER_COLSHAPE, + ENTITY_LEAVE_COLSHAPE, + SIZE };