Aero LogoAero Docs

Event System (`[AeroEvent]`)

Leverage Aero's high-performance circular-buffer dispatcher and register handlers dynamically using attributes.

The Modern Event Pipeline

FiveM's standard event system in C# relies on registering strings in the event handler dictionary. This introduces overhead due to delegate registration and allocations.

Aero introduces a custom Circular-Buffer Event Dispatcher. Native and net events are intercepted and processed inside pre-allocated structural buffers. This drastically reduces Garbage Collection (GC) pressure and maintains high tick rates.

Note: The legacy IEvent interface is obsolete. Handlers should now be declared using the modern [AeroEvent] method attribute system.

Using `[AeroEvent]` Attribute

To hook an event handler, declare a public method inside any class in your plugin and decorate it with [AeroEvent(typeof(EventType))]. The method signature must accept the matching event struct as its single parameter.

using Aero.Events;
using Aero.API.Events.Network;
using Aero.API.Events.Combat;
using Aero.API.Features;

public class GameEventsListener
{
    // Automatically hooked on startup by Aero Engine
    [AeroEvent(typeof(PlayerEnteringEvent))]
    public void OnPlayerEntering(PlayerEnteringEvent e)
    {
        Log.Info($"Player {e.PlayerName} (ID: {e.PlayerId}) has joined!");
    }

    [AeroEvent(typeof(PlayerDeathAdvancedEvent))]
    public void OnPlayerDied(PlayerDeathAdvancedEvent e)
    {
        Log.Warn($"Player ID {e.VictimId} was killed by {e.KillerId} with weapon hash {e.WeaponHash}");
    }
}

Available Core Events

Aero exposes typed event structures representing major native and network callbacks:

Event StructCategoryDescription
PlayerEnteringEventNetworkTriggered when a player starts entering the server.
PlayerLeftEventNetworkTriggered when a player disconnects from the session.
PlayerDeathAdvancedEventCombatDetailed combat info including victim, killer, and weapon hash.
ExplosionEventCombatTriggered upon any network explosion entity creation.
EntityCreatedEventNetworkTriggered when any vehicle, ped, or object is network spawned.