Skip to main content

Global Functions

HELIX provides a library of globally available utility functions that can be called from any Lua script context. These cover world management, player queries, pawn queries, vehicle management, entity manipulation, and distance calculations.


World Functions

FunctionParametersReturn TypeDescription
SetHUDVisibilityAspects: tablevoidSets the visibility of HUD aspects. The table can include keys: Healthbar, Inventory, Speedometer, WeaponState, Shortcuts (all boolean).

Player Functions

FunctionParametersReturn TypeDescription
GetAllPlayers--APlayerController[]Returns a table of all player controllers currently in the world.
GetPlayerPawnPlayer?: APlayerControllerAPawnReturns the pawn controlled by a player controller. If no player is specified, returns the local player's pawn.
GetLocalPlayer--APlayerControllerReturns the local player controller.
GetPlayersInAreaCoords: Vector, Radius?: numberAPlayerController[]Returns all players within a specified radius of the given coordinates.
GetClosestPlayerCoords: Vector, Radius?: numberAPlayerController, numberReturns the nearest player controller and the distance to them, or nil if none found.

Pawn Functions

FunctionParametersReturn TypeDescription
GetAllPawns--tableReturns an array of all character pawns currently in the world.
GetPawnsInAreaCoords: Vector, Radius?: numbertableReturns all pawns within a specified radius.
GetClosestPawnCoords: Vector, Radius?: numberAPawn, numberReturns the nearest pawn and distance, or nil if none found.
IsPedInAnyVehiclePawn: APawnbooleanReturns true if the pawn is currently inside a vehicle.
GetVehiclePedIsInPawn: APawnAVehicle or nilReturns the vehicle the pawn is in, or nil if not in a vehicle.

Vehicle Functions

FunctionParametersReturn TypeDescription
GetAllVehicles--HVehicle[]Returns an array of all vehicles currently in the world.
GetVehiclesInAreaCoords: Vector, Radius?: numberHVehicle[]Returns all vehicles within a specified radius.
GetClosestVehicleCoords: Vector, Radius?: numberHVehicle, numberReturns the nearest vehicle and distance, or nil if none found.
ClearAreaOfVehiclesCoords: Vector, Radius?: numbervoidDestroys all vehicles within a specified radius.
IsAreaClearOfVehiclesCoords: Vector, Radius?: numberbooleanReturns true if no vehicles are in the area.
DeleteVehicleVehicle: HVehiclebooleanDestroys a specific vehicle. Returns true on success.

Entity Functions

FunctionParametersReturn TypeDescription
GetEntityCoordsEntity: AActorVectorReturns the world location of an entity.
GetEntityRotationEntity: AActorRotatorReturns the world rotation of an entity.
GetEntityHeadingEntity: AActornumberReturns the yaw rotation (heading) of an entity in degrees.
SetEntityCoordsEntity: AActor, Coords: VectorvoidTeleports an entity to the specified world location.
SetEntityRotationEntity: AActor, Rotation: RotatorvoidSets the world rotation of an entity.
SetEntityHeadingEntity: AActor, Heading: numbervoidSets the yaw rotation (heading) of an entity in degrees.
DeleteEntityEntity: AActorvoidDestroys an entity, removing it from the world.
DoesEntityExistEntity: AActorbooleanReturns true if the entity is valid and exists in the world.
AttachActorToActorActor: AActor, TargetActor: AActor, Location?: Vector, Rotation?: Rotator, Socket?: string, AttachmentRules?: table, bDisableCollision?: booleanbooleanAttaches an actor to another actor, optionally at a named socket.
AttachActorToComponentActor: AActor, TargetComponent: USceneComponent, Location?: Vector, Rotation?: Rotator, Socket?: string, AttachmentRules?: table, bDisableCollision?: booleanbooleanAttaches an actor to a scene component, optionally at a named socket.
DetachActorActor: AActor, DetachmentRules?: tablevoidDetaches an actor from any parent.

Distance Functions

FunctionParametersReturn TypeDescription
GetDistanceBetweenCoordsCoords1: Vector, Coords2: VectornumberReturns the distance between two world positions.
GetDistanceBetweenActorsActor1: AActor, Actor2: AActornumber or nilReturns the distance between two actors, or nil if either is invalid.

Examples

// Global functions are accessed via Lua scripting.
// See the Lua tab for usage examples.

note

These global functions are designed to provide a familiar scripting experience for FiveM and GTA Online developers migrating to HELIX. Function names follow similar conventions where applicable.