From the reference libraryFiveM

Shared Lib

qbox/docs/resources/qbx_core/modules/lib/shared.mdx

Shared Lib

armsWithoutGloves.male

A set of male torso drawable variations that don't have gloves.
Used for qbx.isWearingGloves and backwards compatibility.

qbx.armsWithoutGloves.male

Type: table<integer, true>

armsWithoutGloves.female

A set of female torso drawable variations that don't have gloves.
Used for qbx.isWearingGloves and backwards compatibility.

qbx.armsWithoutGloves.female

Type: table<integer, true>

string.trim

Returns the given string with its trailing whitespaces removed.

qbx.string.trim(str)
  • str: string

Returns: string

string.capitalize

Returns the given string with its first character capitalized.

qbx.string.capitalize(str)
  • str: string

Returns: string

math.round

Rounds and returns the given number.

qbx.math.round(num, decimalPlaces)
  • num: number
  • decimalPlaces?: integer

Returns: number

table.size

Returns the number of items in a table. Useful for non-array tables.

qbx.table.size(tbl)
  • tbl: table

Returns: integer

table.mapBySubfield

Maps and returns the values of the given table by the given subfield.

qbx.table.mapBySubfield(tbl, subfield)
  • tbl: table
  • subfield: any

Returns: table<any, table[]>

local tble = {
  {
    myCategory = 'first',
    someValue = 1,
  },
  {
    myCategory = 'second',
    someValue = 2,
  },
}

local mapped = qbx.table.mapBySubfield(tble, 'myCategory')

print(json.encode(mapped))
-- Output: { "first": [{ myCategory: "first", someValue: 1 }], "second": [{ myCategory: "second", someValue: 2 }] }

getVehiclePlate

Returns the number plate of the given vehicle, or nil if the vehicle or plate does not exist.

qbx.getVehiclePlate(vehicle)
  • vehicle: integer

Returns: string?

generateRandomPlate

Generates and returns a random number plate with the given pattern.
Note that the generated plate may or may not be already used by an existing vehicle.

:::info For more info about the pattern see lib.string.random from ox_lib. :::

qbx.generateRandomPlate(pattern)
  • pattern?: string

Returns: string

getCardinalDirection

Returns the cardinal direction that the given entity is staring towards.

                North
    45°           0°           315°
      \    .- - - - - - -.    /
         X                 X
       .'   \           /   '.
      |        \     /        |
West  |           X           |  East
      |        /     \        |
       '.   /           \   .'
         X                 X
      /    '- - - - - - -'    \
    135°                      225°
                South

(art inspired by SET_PED_TURNING_THRESHOLDS)

qbx.getCardinalDirection(entity)
  • entity: integer

Returns: 'North' | 'South' | 'East' | 'West'

array.contains

Returns true if the given array contains the given value

qbx.array.contains(arr, value)
  • arr: table
  • value: any

Returns: boolean

Back to documentation