Skip to main content

Functions

HELIX provides a library of global functions that can be used in Lua packages! Consider these to be "shortcut" functions making your scripting experience better!

🌎 World Functions

SetHUDVisibility

Sets the visibility of each HUD aspect.

  • Aspects: table<string, boolean> - String indexed table of HUD aspects, and their values to update.

    • Healthbar: boolean - (Optional)
    • Inventory: boolean - (Optional)
    • Speedometer: boolean - (Optional)
    • WeaponState: boolean - (Optional)
    • Shortcuts: boolean - (Optional)
  • returns: nil


🎮 Player Functions

GetAllPlayers

Get all player controllers currently in the world.


GetPlayerPawn

Get the pawn controlled by a player controller. If no player is specified, returns the local player's pawn.

  • Player: APlayerController - The player controller to get the pawn for (default nil)

  • returns: APawn - The pawn controlled by the player, or nil if none exists


GetLocalPlayer

Get the local player controller.


GetPlayersInArea

Get all players within a specified radius of the given coordinates.

  • Coords: Vector - The center point to search from

  • Radius: number - The radius to search within (default nil - searches entire world)

  • returns: APlayerController[] - A table of player controllers within the area


GetClosestPlayer

Find the nearest player to the specified coordinates, optionally within a maximum radius.

  • Coords: Vector - The center point to search from

  • Radius: number - The maximum radius to search within (default nil - searches entire world)

  • returns: APlayerController, number - The closest player controller and the distance to them, or nil if none found


🚶 Pawn Functions

GetAllPawns

Get all character pawns currently in the world.

  • returns: table - An array of all character pawns

GetPawnsInArea

Get all pawns within a specified radius of the given coordinates.

  • Coords: Vector - The center point to search from

  • Radius: number - The radius to search within (default nil)

  • returns: table - An array of pawns within the area


GetClosestPawn

Find the nearest pawn to the specified coordinates, optionally within a maximum radius.

  • Coords: Vector - The center point to search from

  • Radius: number - The maximum radius to search within (default nil)

  • returns: APawn | nil, number | nil - The closest pawn and the distance to them, or nil, nil if none found


IsPedInAnyVehicle

Check if a pawn is currently inside a vehicle.

  • Pawn: APawn - The pawn to check

  • returns: boolean - True if the pawn is in a vehicle, false otherwise


GetVehiclePedIsIn

Get the vehicle that a pawn is currently inside.

  • Pawn: APawn - The pawn to check

  • returns: AVehicle | nil - The vehicle the pawn is in, or nil if not in a vehicle


🚗 Vehicle Functions

GetAllVehicles

Get all vehicles currently in the world.


GetVehiclesInArea

Get all vehicles within a specified radius of the given coordinates.

  • Coords: Vector - The center point to search from

  • Radius: number - The radius to search within (default nil)

  • returns: HVehicle[] - An array of vehicles within the area


GetClosestVehicle

Find the nearest vehicle to the specified coordinates, optionally within a maximum radius.

  • Coords: Vector - The center point to search from

  • Radius: number - The maximum radius to search within (default nil)

  • returns: HVehicle | nil, number | nil - The closest vehicle and the distance to it, or nil, nil if none found


ClearAreaOfVehicles

Destroy all vehicles within a specified radius of the given coordinates.

  • Coords: Vector - The center point of the area to clear
  • Radius: number - The radius of the area to clear (default nil)

IsAreaClearOfVehicles

Check if an area has no vehicles within a specified radius of the given coordinates.

  • Coords: Vector - The center point of the area to check

  • Radius: number - The radius of the area to check (default nil)

  • returns: boolean - True if no vehicles are in the area, false otherwise


DeleteVehicle

Destroy a specific vehicle, removing it from the world.

  • Vehicle: HVehicle - The vehicle to destroy

  • returns: boolean - True if the vehicle was successfully destroyed, false otherwise


📍 Entity Functions

GetEntityCoords

Get the world location of an entity.

  • Entity: AActor - The entity to get the location of

  • returns: Vector - The world location of the entity


GetEntityRotation

Get the world rotation of an entity.

  • Entity: AActor - The entity to get the rotation of

  • returns: Rotator - The world rotation of the entity


GetEntityHeading

Get the yaw rotation (heading) of an entity.

  • Entity: AActor - The entity to get the heading of

  • returns: number - The yaw rotation in degrees


SetEntityCoords

Teleport an entity to the specified world location.

  • Entity: AActor - The entity to teleport
  • Coords: Vector - The world location to teleport to

SetEntityRotation

Set the world rotation of an entity.

  • Entity: AActor - The entity to rotate
  • Rotation: Rotator - The world rotation to set

SetEntityHeading

Set the yaw rotation (heading) of an entity.

  • Entity: AActor - The entity to rotate
  • Heading: number - The yaw rotation in degrees to set

DeleteEntity

Destroy an entity, removing it from the world.

  • Entity: AActor - The entity to destroy

DoesEntityExist

Check if an entity is valid and exists in the world.

  • Entity: AActor - The entity to check

  • returns: boolean - True if the entity exists and is valid, false otherwise


AttachActorToActor

Attaches the RootComponent of this Actor to the supplied actor, optionally at a named socket.

  • Actor: AActor - The Actor to attach

  • TargetActor: AActor - The Actor to attach to, becoming the parent Actor

  • Location: Vector - The relative location to use after attachment. (default Vector(0, 0, 0))

  • Rotation: Rotator - The relative rotation to use after attachment. (default Rotator(0, 0, 0))

  • Socket: string - The socket/bone name to attach to. (default '')

  • AttachmentRules: table<string, AttachmentRule> - A table of attachment behaviour for each rule type. (default AttachmentRule.KeepRelative)

  • bDisableCollision: boolean - (default true)

  • returns: boolean


AttachActorToComponent

Attaches the RootComponent of this Actor to the supplied component, optionally at a named socket.

  • Actor: AActor - The Actor to attach

  • TargetComponent: USceneComponent - The component to attach to

  • Location: Vector - The relative location to use after attachment. (default Vector(0, 0, 0))

  • Rotation: Rotator - The relative rotation to use after attachment. (default Rotator(0, 0, 0))

  • Socket: string - The socket/bone name to attach to on the target component. (default '')

  • AttachmentRules: table<string, AttachmentRule> - A table of attachment behaviour for each rule type. (default AttachmentRule.KeepRelative)

  • bDisableCollision: boolean - (default true)

  • returns: boolean


DetachActor

Detaches the RootComponent of this Actor from any SceneComponent it is currently attached to.


📏 Distance Functions

GetDistanceBetweenCoords

Calculate the distance between two world positions.

  • Coords1: Vector - The first position

  • Coords2: Vector - The second position

  • returns: number - The distance between the two positions


GetDistanceBetweenActors

Calculate the distance between two actors.

  • Actor1: AActor - The first actor

  • Actor2: AActor - The second actor

  • returns: number | nil - The distance between the two actors, or nil if either actor is invalid