Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Utils

Hierarchy

Index

Constructors

Protected constructor

Methods

Static assert

  • assert(assertion: unknown, message?: string): assertsassertion
  • Parameters

    • assertion: unknown
    • Optional message: string

    Returns assertsassertion

Static drawText2d

  • Parameters

    • text: string
    • Optional pos2d: IVector2
    • Optional font: GameFont
    • Optional scale: number
    • Optional color: RGBA
    • Optional outline: boolean
    • Optional dropShadow: boolean
    • Optional textAlign: TextAlign

    Returns EveryTick

Static drawText2dThisFrame

  • drawText2dThisFrame(text: string, pos2d?: IVector2, font?: GameFont, scale?: number, color?: RGBA, outline?: boolean, dropShadow?: boolean, textAlign?: TextAlign): void
  • Parameters

    • text: string
    • Optional pos2d: IVector2
    • Optional font: GameFont
    • Optional scale: number
    • Optional color: RGBA
    • Optional outline: boolean
    • Optional dropShadow: boolean
    • Optional textAlign: TextAlign

    Returns void

Static drawText3d

  • Parameters

    • text: string
    • pos3d: IVector3
    • Optional font: GameFont
    • Optional scale: number
    • Optional color: RGBA
    • Optional outline: boolean
    • Optional dropShadow: boolean
    • Optional textAlign: TextAlign

    Returns EveryTick

Static drawText3dThisFrame

  • drawText3dThisFrame(text: string, pos3d: IVector3, font?: GameFont, scale?: number, color?: RGBA, outline?: boolean, dropShadow?: boolean, textAlign?: TextAlign): void
  • Parameters

    • text: string
    • pos3d: IVector3
    • Optional font: GameFont
    • Optional scale: number
    • Optional color: RGBA
    • Optional outline: boolean
    • Optional dropShadow: boolean
    • Optional textAlign: TextAlign

    Returns void

Static getClosestObject

  • getClosestObject(options?: { pos?: IVector3; range?: number }): Object | null
  • Finds the closest object (if any) from alt.Object.all.

    pos - From which position to look for the nearest object. Defaults to local player position.

    range - In which range to search for the nearest object. Defaults to Infinity.

    Parameters

    • Optional options: { pos?: IVector3; range?: number }
      • Optional pos?: IVector3
      • Optional range?: number

    Returns Object | null

Static getClosestPlayer

  • getClosestPlayer(options?: { pos?: IVector3; range?: number }): Player | null
  • Finds the closest player (if any) from alt.Player.streamedIn.

    pos - From which position to look for the nearest player. Defaults to local player position.

    range - In which range to search for the nearest player. Defaults to Infinity.

    Parameters

    • Optional options: { pos?: IVector3; range?: number }
      • Optional pos?: IVector3
      • Optional range?: number

    Returns Player | null

Static getClosestVehicle

  • getClosestVehicle(options?: { pos?: IVector3; range?: number }): Vehicle | null
  • Finds the closest vehicle (if any) from alt.Vehicle.streamedIn.

    pos - From which position to look for the nearest vehicle. Defaults to local player position.

    range - In which range to search for the nearest vehicle. Defaults to Infinity.

    Parameters

    • Optional options: { pos?: IVector3; range?: number }
      • Optional pos?: IVector3
      • Optional range?: number

    Returns Vehicle | null

Static getClosestVirtualEntity

  • Finds the closest virtualEntity (if any) from alt.VirtualEntity.streamedIn.

    pos - From which position to look for the nearest virtualEntity. Defaults to local player position.

    range - In which range to search for the nearest virtualEntity. Defaults to Infinity.

    Parameters

    • Optional options: { pos?: IVector3; range?: number }
      • Optional pos?: IVector3
      • Optional range?: number

    Returns VirtualEntity | null

Static getClosestWorldObject

  • getClosestWorldObject(options?: { pos?: IVector3; range?: number }): Object | null
  • Finds the closest world object (if any) from {@link Object.allWorld alt.Object.allWorld}.

    pos - From which position to look for the nearest world object. Defaults to local player position.

    range - In which range to search for the nearest world object. Defaults to Infinity.

    Parameters

    • Optional options: { pos?: IVector3; range?: number }
      • Optional pos?: IVector3
      • Optional range?: number

    Returns Object | null

Static inspect

  • Returns a string representation of value that is intended for debugging.

    remarks

    Proxy or promise details (returned value, status) are not supported.

    Parameters

    Returns string

Static loadMapArea

  • loadMapArea(pos: IVector3, radius?: number, timeout?: number): Promise<void>
  • Loads the map area at a certain position and waits asynchronously until all parts in view area have been loaded.

    remarks

    Uses FocusData and newLoadSceneStartSphere.

    Parameters

    • pos: IVector3

      Coords of the map area.

    • Optional radius: number

      Radius of sphere to load. Defaults to 50.0.

    • Optional timeout: number

      The maximum milliseconds to wait, otherwise promise will be rejected. Defaults to 5000.

    Returns Promise<void>

Static registerPedheadshot3Base64

  • registerPedheadshot3Base64(ped: Player | number): Promise<string>
  • Combination of native.registerPedheadshot3 and alt.getHeadshotBase64

    Parameters

    Returns Promise<string>

Static registerPedheadshotBase64

  • registerPedheadshotBase64(ped: Player | number): Promise<string>
  • Combination of native.registerPedheadshot and alt.getHeadshotBase64

    Parameters

    Returns Promise<string>

Static registerPedheadshotTransparentBase64

  • registerPedheadshotTransparentBase64(ped: Player | number): Promise<string>
  • Combination of native.registerPedheadshotTransparentBase64 and alt.getHeadshotBase64

    Parameters

    Returns Promise<string>

Static requestAnimDict

  • requestAnimDict(animDict: string, timeout?: number): Promise<void>
  • Parameters

    • animDict: string
    • Optional timeout: number

    Returns Promise<void>

Static requestAnimSet

  • requestAnimSet(animSet: string, timeout?: number): Promise<void>
  • Parameters

    • animSet: string
    • Optional timeout: number

    Returns Promise<void>

Static requestClipSet

  • requestClipSet(clipSet: string, timeout?: number): Promise<void>
  • Parameters

    • clipSet: string
    • Optional timeout: number

    Returns Promise<void>

Static requestCutscene

  • requestCutscene(cutsceneName: string, flags: string | number, timeout?: number): Promise<void>
  • Parameters

    • cutsceneName: string
    • flags: string | number
    • Optional timeout: number

    Returns Promise<void>

Static requestModel

  • requestModel(model: string | number, timeout?: number): Promise<void>
  • Loads a model into memory asynchronously, like loadModelAsync but more safely.

    remarks

    If you can't load a specific model with this method, use loadModelAsync instead.

    Parameters

    • model: string | number
    • Optional timeout: number

    Returns Promise<void>

Static wait

  • wait(timeout: number): Promise<void>
  • Parameters

    • timeout: number

    Returns Promise<void>

Static waitFor

  • waitFor(callback: () => boolean, timeout?: number): Promise<void>
  • Waits for the callback to return true, otherwise the promise will be rejected after timeout

    Parameters

    • callback: () => boolean

      If callback returns true it resolves promise.

        • (): boolean
        • Returns boolean

    • Optional timeout: number

      The maximum milliseconds to wait, otherwise promise will be rejected. Defaults to 2000.

    Returns Promise<void>