Skip to content

Module: Vehicle

Аниса edited this page Jun 16, 2022 · 22 revisions

━ What's the Objective?

This module provides a custom vehicle management interface to integrate w/ your resources. For servers such as DayZ, Roleplay, RPG, Arenas where saving vehicle makes sense, this module comes into the play!

━ APIs

⚠️ Disclaimer:

Syntax #2 should only be used in conjunction w/ thread

━ dbify.vehicle.fetchAll() (Server)

@Objective: Fetches all existing vehicles.
--Syntax #1:
local bool: state = dbify.vehicle.fetchAll(
  table: {
    --These are conditional datas that has to be used for the query
    {string: columnName, ~: columnValue},
  },
  function: callback(table: result, table: arguments),
  ~: ...arguments
)

--Syntax #2:
local table: result, table: arguments = self:await(dbify.vehicle.fetchAll(
  thread: self,
  table: {
    --These are conditional datas that has to be used for the query
    {string: columnName, ~: columnValue},
  },
  ~: ...arguments
))

━ dbify.vehicle.create() (Server)

@Objective: Creates a new vehicle.
--Syntax #1:
local bool: state = dbify.vehicle.create(
  function: callback(int: vehicleID, table: arguments),
  ~: ...arguments
)

--Syntax #2:
local int: vehicleID, table: arguments = self:await(dbify.vehicle.create(
  thread: self,
  ~: ...arguments
))

━ dbify.vehicle.delete() (Server)

@Objective: Deletes an existing vehicle.
--Syntax #1:
local bool: state = dbify.vehicle.delete(
  int: vehicleID,
  function: callback(bool: result, table: arguments),
  ~: ...arguments
)

--Syntax #2:
local bool: result, table: arguments = self:await(dbify.vehicle.delete(
  thread: self,
  int: vehicleID,
  ~: ...arguments
))

━ dbify.vehicle.setData() (Server)

@Objective: Sets vehicle datas of a valid vehicle.
dbify.vehicle.setData(vehicleID, {
    --These are vehicle datas to be updated
    {dataName1, dataValue1},
    {dataName2, dataValue2},
    ...
}, callback(result, arguments)
    print(tostring(result))
    print(toJSON(arguments))
end, ...)

━ dbify.vehicle.getData() (Server)

@Objective: Retrieves vehicle datas of a valid vehicle.
dbify.vehicle.getData(vehicleID, {
    --These are vehicle datas to be retrieved
    dataName1,
    dataName2,
    ...
}, callback(result, arguments)
    print(toJSON(result))
    print(toJSON(arguments))
end, ...)
Clone this wiki locally