Skip to content

Module: Character

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

━ What's the Objective?

This module provides a custom character management interface to integrate w/ your resources. For servers such as DayZ, Roleplay, RPG, Arenas where clients can create multiple character under their account, this module comes into the play!

━ APIs

⚠️ Disclaimer:

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

━ dbify.character.fetchAll() (Server)

@Objective: Fetches all existing characters.
local bool: state = dbify.character.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.character.fetchAll(
  thread: self,
  table: {
    --These are conditional datas that has to be used for the query
    {string: columnName, ~: columnValue},
  },
  ~: ...arguments
))

━ dbify.character.create() (Server)

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

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

━ dbify.character.delete() (Server)

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

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

━ dbify.character.setData() (Server)

@Objective: Sets character datas of a valid character.
--Syntax #1:
local bool: state = dbify.character.setData(
  int: characterID,
  table: {
    --These are columns that has to be updated w/ their respective values
    {string: columnName, ~: columnValue},
    ...
  },
  function: callback(bool: result, table: arguments),
  ~: ...arguments
)

--Syntax #2:
local bool: result, table: arguments = self:await(dbify.character.setData(
  thread: self,
  int: characterID,
  table: {
    --These are columns that has to be updated w/ their respective values
    {string: columnName, ~: columnValue},
    ...
  },
  ~: ...arguments
))

━ dbify.character.getData() (Server)

@Objective: Retrieves character datas of a valid character.
--Syntax #1:
local bool: state = dbify.character.getData(
  int: characterID,
  table: {
    --These are columns whose values are to be retrieved
    string: columnName,
    ...
  },
  function: callback(table: result, table: arguments),
  ~: ...arguments
)

--Syntax #2:
local table: result, table: arguments = self:await(dbify.character.getData(
  thread: self,
  int: characterID,
  table: {
    --These are columns whose values are to be retrieved
    string: columnName,
    ...
  },
  ~: ...arguments
))
Clone this wiki locally