Skip to main content

Client Decorators

Class Decorators

DecoratorDescriptionDetails
@Controller()Marks a class as a client-side controller for UI, input, and client events.Details

Method Decorators

DecoratorArgumentsDescriptionDetails
@OnNet()eventName: stringSubscribes to a network event (server → client).Details
@OnRPC()eventName: stringSubscribes to an RPC call from the server. Returns a value.Details
@OnLibraryEvent()libraryName: string, eventName: stringListens to client-side library domain events emitted through library.emit(...).Details
@LocalEvent()eventName: stringSubscribes to a local (client-only) event for internal communication.Details
@OnGameEvent()eventName: stringListens to GTA V native game events (damage, explosions, entity interactions).Details
@OnTick()Executes on every client tick. Avoid heavy computations to prevent FPS drops.Details
@Interval()ms: numberExecutes at a fixed time interval. Prefer over OnTick when possible.Details
@Key()key: stringBinds the method to a keyboard key press.Details
@OnView()callbackName: stringRegisters a NUI callback handler (bridge between UI and gameplay logic).Details
@Export()exportName?: stringExposes the method as a FiveM client export.Details
@OnResourceStart()Runs when the resource starts.Details
@OnResourceStop()Runs when the resource stops.Details

Design Notes

  • Client controllers are event-driven, not request-driven.
  • Prefer @Interval() over @OnTick() when possible to reduce CPU usage.
  • @LocalEvent() is the recommended way to communicate between client systems.
  • @OnGameEvent() is powerful but low-level — use it only when FiveM-native events are insufficient.
  • NUI communication is explicit and isolated through @OnView().