From the reference libraryRedM

autodoc_framework_bridge_functions

jo_libs/modules/framework-bridge/autodoc/autodoc_framework_bridge_functions.md

autodoc_framework_bridge_functions

Constructor > <Badge type="server" text="Server" /> jo.framework.UserClass:get()

<br> <br> Creates and returns a new User instance for the specified player <br>

Constructor > <Badge type="server" text="Server" /> jo.framework.UserClass:get() > Syntax

jo.framework.UserClass:get(source)

Constructor > <Badge type="server" text="Server" /> jo.framework.UserClass:get() > Parameters

source : integer

The source ID of the player

Constructor > <Badge type="server" text="Server" /> jo.framework.UserClass:get() > Return Value

Type : UserClass

Return a User class object containing player data and methods

Constructor > <Badge type="server" text="Server" /> jo.framework.UserClass:get() > Example

local user = jo.framework.UserClass:get(source)
-- OR --
local user = jo.framework:getUser(source)

UserClass Methods > <Badge type="server" text="Server" /> UserClass:addMoney() > Syntax

UserClass:addMoney(amount, moneyType)

UserClass Methods > <Badge type="server" text="Server" /> UserClass:addMoney() > Parameters

amount : number

The amount of money to add

moneyType : integer

The type of currency: 0: dollar, 1: gold, 2: rol

UserClass Methods > <Badge type="server" text="Server" /> UserClass:addMoney() > Example

local source = 1
local amount = 100.0
local moneyType = 1
local user = jo.framework:getUser(source)
user:addMoney(amount, moneyType)


UserClass Methods > <Badge type="server" text="Server" /> UserClass:canBuy()

Checks if a player has sufficient funds of a specified currency type <br>

UserClass Methods > <Badge type="server" text="Server" /> UserClass:canBuy() > Syntax

UserClass:canBuy(price, moneyType, removeIfCan)

UserClass Methods > <Badge type="server" text="Server" /> UserClass:canBuy() > Parameters

price : number|table

The amount of money the player needs to have <br> if table: {money = 1, gold = 1, rol = 1}

moneyType : integer <BadgeOptional />

0: dollar, 1: gold, 2: rol <br> default:1

removeIfCan : boolean <BadgeOptional />

Remove the money if the player has enough <br> default:false

UserClass Methods > <Badge type="server" text="Server" /> UserClass:canBuy() > Return Value

Type : boolean

Return true if the player has more money than the amount

UserClass Methods > <Badge type="server" text="Server" /> UserClass:canBuy() > Example

local source = 1
local price = 20.4
local moneyType = 2
local user = jo.framework:getUser(source)
local hasEnoughGold = user:canBuy(price, moneyType)
print(hasEnoughGold)


UserClass Methods > <Badge type="server" text="Server" /> UserClass:getIdentifiers()

Retrieves all identifiers associated with the player <br>

UserClass Methods > <Badge type="server" text="Server" /> UserClass:getIdentifiers() > Syntax

UserClass:getIdentifiers()

UserClass Methods > <Badge type="server" text="Server" /> UserClass:getIdentifiers() > Return Value

Type : table

Return the player's identifiers <br> identifiers.identifier - Unique identifier of the player <br> identifiers.charid - Unique id of the player

UserClass Methods > <Badge type="server" text="Server" /> UserClass:getIdentifiers() > Example

local source = 1
local user = jo.framework:getUser(source)
local identifiers = user:getIdentifiers()
print(identifiers.identifier)
print(identifiers.charid)


UserClass Methods > <Badge type="server" text="Server" /> UserClass:getJob()

Returns the current job assigned to a player <br>

UserClass Methods > <Badge type="server" text="Server" /> UserClass:getJob() > Syntax

UserClass:getJob()

UserClass Methods > <Badge type="server" text="Server" /> UserClass:getJob() > Return Value

Type : string

Returns the job name of the player

UserClass Methods > <Badge type="server" text="Server" /> UserClass:getJob() > Example

local source = 1
local user = jo.framework:getUser(source)
local job = user:getJob()
print(job)


UserClass Methods > <Badge type="server" text="Server" /> UserClass:getJobGrade()

Returns the current job grade assigned to a player <br>

UserClass Methods > <Badge type="server" text="Server" /> UserClass:getJobGrade() > Syntax

UserClass:getJobGrade()

UserClass Methods > <Badge type="server" text="Server" /> UserClass:getJobGrade() > Return Value

Type : number

Returns the job grade of the player


UserClass Methods > <Badge type="server" text="Server" /> UserClass:getMoney()

Gets the amount of money a player has of the specified type <br>

UserClass Methods > <Badge type="server" text="Server" /> UserClass:getMoney() > Syntax

UserClass:getMoney(moneyType)

UserClass Methods > <Badge type="server" text="Server" /> UserClass:getMoney() > Parameters

moneyType : integer

The type of currency: 0: dollar, 1: gold, 2: rol

UserClass Methods > <Badge type="server" text="Server" /> UserClass:getMoney() > Return Value

Type : number

Return the amount for this kind of money

UserClass Methods > <Badge type="server" text="Server" /> UserClass:getMoney() > Example

local source = 1
local user = jo.framework:getUser(source)
local dollar = user:getMoney(1)
local gold = user:getMoney(2)
print(dollar, gold)


UserClass Methods > <Badge type="server" text="Server" /> UserClass:getRPName()

Returns the roleplay name (first and last name) of the player <br>

UserClass Methods > <Badge type="server" text="Server" /> UserClass:getRPName() > Syntax

UserClass:getRPName()

UserClass Methods > <Badge type="server" text="Server" /> UserClass:getRPName() > Return Value

Type : string

Returns the formatted first and last name of the player

UserClass Methods > <Badge type="server" text="Server" /> UserClass:getRPName() > Example

local source = 1
local user = jo.framework:getUser(source)
local name = user:getRPName()
print(name)


UserClass Methods > <Badge type="server" text="Server" /> UserClass:giveGold() > Syntax

UserClass:giveGold(amount)

UserClass Methods > <Badge type="server" text="Server" /> UserClass:giveGold() > Parameters

amount : number

The amount of gold to add

UserClass Methods > <Badge type="server" text="Server" /> UserClass:giveGold() > Example

local source = 1
local goldAmount = 20.0
local user = jo.framework:getUser(source)
user:giveGold(goldAmount)


UserClass Methods > <Badge type="server" text="Server" /> UserClass:removeMoney() > Syntax

UserClass:removeMoney(amount, moneyType)

UserClass Methods > <Badge type="server" text="Server" /> UserClass:removeMoney() > Parameters

amount : number

The amount of money to remove

moneyType : integer

The type of currency: 0: dollar, 1: gold, 2: rol

UserClass Methods > <Badge type="server" text="Server" /> UserClass:removeMoney() > Example

local source = 1
local amount = 100.0
local moneyType = 1
local user = jo.framework:getUser(source)
user:removeMoney(amount, moneyType)

jo.framework Methods > <Badge type="client" text="Client" /> jo.framework:getMyIdentifiers()

A function to get the user identifiers <br>

jo.framework Methods > <Badge type="client" text="Client" /> jo.framework:getMyIdentifiers() > Syntax

jo.framework:getMyIdentifiers()

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:addItemInInventory()

Adds a specific item to a custom inventory with optional metadata and wait parameter <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:addItemInInventory() > Syntax

jo.framework:addItemInInventory(source, invId, item, quantity, metadata, needWait)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:addItemInInventory() > Parameters

source : integer

The source ID of the player

invId : string

The unique ID of the inventory

item : string

The name of the item

quantity : integer

The quantity of the item

metadata : table <BadgeOptional />

The metadata of the item

needWait : boolean <BadgeOptional />

If need to wait after the SQL insertion <br> default:false

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:addItemInInventory() > Example

local source = 1
local id = "locker:sheriff"
local item = "mdt_report"
local quantity = 1
local metadata = { id = 321 }
jo.framework:addItemInInventory(source, id, item, quantity, metadata)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:addMoney()

A function to give money to a player <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:addMoney() > Syntax

jo.framework:addMoney(source, amount, moneyType)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:addMoney() > Parameters

source : integer

The source ID of the player

amount : number

The amount of money to add

moneyType : integer <BadgeOptional />

0: dollar, 1: gold, 2: rol <br> default:0

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:addMoney() > Return Value

Type : boolean

Return true if the money is successfully added

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:addMoney() > Example

local source = 1
local amount = 10.5
local moneyType = 0
local isAdded = jo.framework:addMoney(source,amount,moneyType)
print(isAdded)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:canUseItem()

Checks if a player has the required quantity of a specific item in their inventory and optionally removes it <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:canUseItem() > Syntax

jo.framework:canUseItem(source, item, amount, meta, remove)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:canUseItem() > Parameters

source : integer

The source ID of the player

item : string

The name of the item need to use

amount : integer

The quantity of the item

meta : table <BadgeOptional />

The metadata of the item

remove : boolean <BadgeOptional />

If the item has to be removed <br> default:false

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:canUseItem() > Return Value

Type : boolean

Return true if the player has enough quantity of the item

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:canUseItem() > Example

local source = 1
local item = "water"
local amount = 1
local canUseWater = jo.framework:canUseItem(source, item, amount, nil, nil)
print(canUseWater)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:canUserBuy()

Checks if a player has sufficient funds of a specified currency type <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:canUserBuy() > Syntax

jo.framework:canUserBuy(source, amount, moneyType, removeIfCan)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:canUserBuy() > Parameters

source : integer

The source ID of the player

amount : number

The amount of money the player needs to have <br> {money = 10.5, gold = 3, rol = 1.5}

moneyType : integer|string <BadgeOptional />

0: dollar, 1: gold, 2: rol <br> default:1

removeIfCan : boolean <BadgeOptional />

Remove the money if the player has enough <br> default:false

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:canUserBuy() > Return Value

Type : boolean

Returns true if the player has more money than the amount

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:canUserBuy() > Example

local price = 103
local source = 1
print(jo.framework:canUserBuy(source, 103))
-- Expected output : true if the player has more than $103


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:canUserPayWith()

A function that checks if a player can pay multiple prices <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:canUserPayWith() > Syntax

jo.framework:canUserPayWith(source, prices, removeIfCan)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:canUserPayWith() > Parameters

source : integer

The source ID of the player

prices : table

The prices to check

removeIfCan : boolean <BadgeOptional />

Remove the prices if the player can pay

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:canUserPayWith() > Return Value

Type : boolean,


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:createInventory()

Creates a custom inventory with configurable slots, weight limits, and item restrictions <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:createInventory() > Syntax

jo.framework:createInventory(invName, name, invConfig)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:createInventory() > Parameters

invName : string

Unique id of the inventory

name : string

Label of the inventory

invConfig : table

Configuration of the inventory

invConfig.maxSlots : integer - Max slot of the inventory

invConfig.maxWeight : float - Max weight of the inventory

invConfig.acceptWeapons : boolean - Whether the inventory accepts weapons <BadgeOptional />

invConfig.shared : boolean - If the inventory is shared between players <BadgeOptional />

invConfig.ignoreStackLimit : boolean - If the inventory can overcoming stack limits <BadgeOptional />

invConfig.whitelist : table - Restrict the list of items that can be put in the inventory <BadgeOptional />

invConfig.whitelistˌ_x_ˌitem : string - Name of the whitelisted item

invConfig.whitelistˌ_x_ˌlimit : integer - Stack limit of this item

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:createInventory() > Example

local id = "locker:sheriff"
local label = "Sheriff's locker"
local definition = {
  maxSlots = 100,
  maxWeight = 1000.0,
  acceptWeapons = false,
  shared = true,
  whitelist = {
    { item = "mdt_report", limit = 1000 }
  }
}
jo.framework:createInventory(id, label, definition)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:get()

Returns the name of the current active framework being used <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:get() > Syntax

jo.framework:get()

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:get() > Return Value

Type : string

Return the name of the current framework : <br> "VORP" or "RedEM" or "RedEM2023" or "qbr" or "rsg" or "qr" or "rpx"

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:get() > Example

local frameworkName = jo.framework:get()
print(frameworkName)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getItemsFromInventory()

Retrieves all items from a specific inventory with their quantities and metadata <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getItemsFromInventory() > Syntax

jo.framework:getItemsFromInventory(invId)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getItemsFromInventory() > Parameters

invId : string

The unique ID of the inventory

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getItemsFromInventory() > Return Value

Type : table

Return the list of items with structure : <br> item.amount : integer - The amount of the item<br> item.id : integer - The id of the item<br>item.item : string - The name of the item<br>item.metadata : table - The metadata of the item<br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getItemsFromInventory() > Example

local source = 1
local id = "locker:sheriff"
local items = jo.framework:getItemsFromInventory(source, id)
for key, item in pairs(items) do
  print(item.item)
end


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getJob()

Returns the current job assigned to a player <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getJob() > Syntax

jo.framework:getJob(source)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getJob() > Parameters

source : integer

The source ID of the player

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getJob() > Return Value

Type : string

Return the job name of the player

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getJob() > Example

local source = 1
print(jo.framework:getJob(source))


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getRPName()

Returns the roleplay name (first and last name) of the player <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getRPName() > Syntax

jo.framework:getRPName(source)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getRPName() > Parameters

source : integer

The source ID of the player

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getRPName() > Return Value

Type : string

Return the formatted first and last name of the player

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getRPName() > Example

local source = 1
print(jo.framework:getRPName(source))


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getSourceFromIdentifiers()

Retrieves the source ID from identifiers <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getSourceFromIdentifiers() > Syntax

jo.framework:getSourceFromIdentifiers(identifier, charid)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getSourceFromIdentifiers() > Parameters

identifier : string

The identifier to search for

charid : string

The character ID to search for

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getSourceFromIdentifiers() > Return Value

Type : integer|boolean

Return the source ID if found, otherwise return false


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUser()

Retrieves a player's full UserClass object containing all player data and methods <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUser() > Syntax

jo.framework:getUser(source)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUser() > Parameters

source : integer

The source ID of the player

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUser() > Return Value

Type : UserClass

Return a User class object containing player data and methods

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUser() > Example

local source = 1
local user = jo.framework:getUser(source)
print(user:getRPName())


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUserClothes()

Retrieves a player's clothing data with standardized category names <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUserClothes() > Syntax

jo.framework:getUserClothes(source)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUserClothes() > Parameters

source : integer

The source ID of the player

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUserClothes() > Return Value

Type : table

Return the list of clothes with standardized categories and properties

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUserClothes() > Example

local source = 1
local clothes = jo.framework:getUserClothes(source)
log(clothes)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUserIdentifiers()

Retrieves all identifiers associated with a player <br> Shortcut for jo.framework.UserClass:getIdentifiers() method <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUserIdentifiers() > Syntax

jo.framework:getUserIdentifiers(source)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUserIdentifiers() > Parameters

source : integer

The source ID of the player

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUserIdentifiers() > Return Value

Type : table

Return the player's identifiers <br> identifiers.identifier - Unique identifier of the player <br> identifiers.charid - Unique id of the player

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUserIdentifiers() > Example

local source = 1
local identifiers = jo.framework:getUserIdentifiers(source)
print(identifiers.charid)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUserSkin()

Retrieves a player's skin data with standardized properties and formatting <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUserSkin() > Syntax

jo.framework:getUserSkin(source)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUserSkin() > Parameters

source : integer

The source ID of the player

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUserSkin() > Return Value

Type : table

Return the skin data

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getUserSkin() > Example

local source = 1
local skin = jo.framework:getUserSkin(source)
log(skin)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:giveItem()

Adds an item to a player's inventory with optional metadata <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:giveItem() > Syntax

jo.framework:giveItem(source, item, quantity, meta)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:giveItem() > Parameters

source : integer

The source ID of the player

item : string

The name of the item

quantity : integer

The amount of the item to give

meta : table <BadgeOptional />

The metadata of the item

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:giveItem() > Return Value

Type : boolean

Return true if the item is successfully given

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:giveItem() > Example

local source = 1
local item = "water"
local amount = 1
local itemGave = jo.framework:giveItem(source, item, amount)
print(itemGave)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:is()

Compares the current framework with a specified framework name <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:is() > Syntax

jo.framework:is(name)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:is() > Parameters

name : string

The name of the framework to check against <br> Supported frameworks : <br> "VORP" or "RedEM" or "RedEM2023" or "qbr" or "rsg" or "qr" or "rpx"

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:is() > Return Value

Type : boolean

Return true if the current framework matches the name

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:is() > Example

local isVORP = jo.framework:is('VORP')
print(isVORP)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:listenItemRemoved()

Listen when an item is removed of the player inventory <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:listenItemRemoved() > Syntax

jo.framework:listenItemRemoved(...)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:listenItemRemoved() > Parameters

item : string|function

The name of the item

callback : function

The function fired after remove the item <br> 1st argument: source <br> 2nd argument: the quantity removed <br> 3rd argument: metadata of the item <br> 4th argument: reason of the removal


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:mergeInventoriesConfiguration() > Syntax

jo.framework:mergeInventoriesConfiguration(...)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:mergeInventoriesConfiguration() > Parameters

... : table

The inventory configurations to merge

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:mergeInventoriesConfiguration() > Return Value

Type : table

The merged inventory configuration


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:onCharacterSelected()

Callback when a character is selected <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:onCharacterSelected() > Syntax

jo.framework:onCharacterSelected(cb)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:onCharacterSelected() > Parameters

cb : function

The callback function triggered when the character is selected

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:onCharacterSelected() > Example

jo.framework:onCharacterSelected(function(source)
  print('A new player select his character', source)
end)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:openInventory() > Syntax

jo.framework:openInventory(source, invName)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:openInventory() > Parameters

source : integer

The source ID of the player

invName : string

The unique ID of the inventory

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:openInventory() > Example

local source = 1
local id = "locker:sheriff"
jo.framework:openInventory(source, id)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:refundUserWith()

A function to refund a player with multiple prices <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:refundUserWith() > Syntax

jo.framework:refundUserWith(source, prices)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:refundUserWith() > Parameters

source : integer

The source ID of the player

prices : table

The prices to refund

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:refundUserWith() > Return Value

Type : nil


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:registerUseItem()

Registers an item as usable and attaches a callback function that executes when the item is used <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:registerUseItem() > Syntax

jo.framework:registerUseItem(item, closeAfterUsed, callback)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:registerUseItem() > Parameters

item : string

The name of the item

closeAfterUsed : boolean <BadgeOptional />

If the inventory needs to be closed after using the item <br> default:true

callback : function

The function fired after use the item <br> 1st argument: source <br> 2nd argument: metadata of the item

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:registerUseItem() > Example

jo.framework:registerUseItem('water', true, function(source, metadata)
  TriggerServerEvent('drinkWater', source)
  jo.framework:removeItem(source, 'water', 1, metadata)
end)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:removeInventory()

Removes an inventory from the server cache, useful for reloading inventory data from the database <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:removeInventory() > Syntax

jo.framework:removeInventory(invName)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:removeInventory() > Parameters

invName : string

Unique id of the inventory

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:removeInventory() > Example

local id = "locker:sheriff"
jo.framework:removeInventory(id)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:removeItem()

A function to remove an item from a player's inventory if they have enough quantity <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:removeItem() > Syntax

jo.framework:removeItem(source, item, quantity, meta)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:removeItem() > Parameters

source : integer

The source ID of the player

item : string

The name of the item to remove

quantity : integer

The quantity of the item to remove

meta : table <BadgeOptional />

The metadata of the item

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:removeItem() > Return Value

Type : boolean

Return true if the item is successfully removed

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:removeItem() > Example

local source = 1
local item = "water"
local quantity = 2
local meta = {}
local isRemoved = jo.framework:removeItem(source, item, quantity, meta)
print(isRemoved)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:removeMoney()

A function to remove money from a player's account <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:removeMoney() > Syntax

jo.framework:removeMoney(source, amount, moneyType)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:removeMoney() > Parameters

source : integer

The source ID of the player

amount : number

The amount of money to remove

moneyType : integer <BadgeOptional />

0: dollar, 1: gold, 2: rol <br> default:0

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:removeMoney() > Return Value

Type : boolean

Return true if the money is successfully removed

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:removeMoney() > Example

local source = 1
local amount = 10.5
local moneyType = 0
local isRemoved = jo.framework:removeMoney(source, amount, moneyType)
print(isRemoved)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:revertClothes()

Converts standardized clothing data back to framework-specific format <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:revertClothes() > Syntax

jo.framework:revertClothes(standard)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:revertClothes() > Parameters

standard : table

The standardized clothes data

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:revertClothes() > Return Value

Type : table

Return clothes data with framework-specific keys

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:revertClothes() > Example

local clothes = {hats = {hash = 0x123455}}
local frameworkData = jo.framework:revertClothes(clothes)
log(frameworkData)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:revertSkin()

Converts standardized skin data back to framework-specific format <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:revertSkin() > Syntax

jo.framework:revertSkin(standard)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:revertSkin() > Parameters

standard : table

The standardized skin data

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:revertSkin() > Return Value

Type : table

Return skin data with framework-specific keys

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:revertSkin() > Example

local skin = {headIndex = 1, skinTone = 2}
local frameworkSkin = jo.framework:revertSkin(skin)
log(frameworkSkin)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:standardizeClothes()

Converts framework-specific clothing data to a standardized format <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:standardizeClothes() > Syntax

jo.framework:standardizeClothes(clothes)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:standardizeClothes() > Parameters

clothes : table

The framework-specific clothes data

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:standardizeClothes() > Return Value

Type : table

Return clothes data with standardized keys and structure

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:standardizeClothes() > Example

local clothes = { Hat = 0x12345}
local standard = jo.framework:standardizeClothes(clothes)
log(standard)
-- Expected output: `{hat = {hash = 0x12345}}`


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:standardizeSkin()

Converts framework-specific skin data to a standardized format <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:standardizeSkin() > Syntax

jo.framework:standardizeSkin(skin)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:standardizeSkin() > Parameters

skin : table

The framework-specific skin data

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:standardizeSkin() > Return Value

Type : table

Return skin data with standardized keys for components, overlays, and expressions

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:standardizeSkin() > Example

local skin = { eyes = 0x1234}
local standard = jo.framework:standardizeSkin(skin)
log(standard)
-- Expected output: `{eyesIndex: 2}`


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:updateUserClothes()

Save new clothes. <br> The function has two ways to work: <br>

  • With 2 arguments to save multiple clothes <br>
  • With 3 arguments to save one piece of clothing <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:updateUserClothes() > Syntax

jo.framework:updateUserClothes(...)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:updateUserClothes() > Parameters

source : integer

The source ID of the player

clothes : table

The list of clothes to apply or the category name

value : table <BadgeOptional />

The clothing data if updating a single category

overwrite : boolean <BadgeOptional />

If true, the new value overwrites the previous clothes. Else, it's merged

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:updateUserClothes() > Example

local source = 1
local clothes = {
  pants = { hash = 2450348132 },
  boots = { hash = 3596743543 }
}
jo.framework:updateUserClothes(source, clothes)
-- OR  --
local source = 1
local category = pants
local clothes = { hash = 2450348132 }
jo.framework:updateUserClothes(source, category, clothes)


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:updateUserSkin()

Save new skin values. <br> The function has two ways to work: <br>

  • With 3 arguments to save multiple skin data <br>
  • With 4 arguments to save only one skin data <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:updateUserSkin() > Syntax

jo.framework:updateUserSkin(...)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:updateUserSkin() > Parameters

source : integer

The source ID of the player

skinData : table

The list of skin data with category for key and skin data for value

category : string

The category of the skin data

data : table

The skin data

overwrite : boolean <BadgeOptional />

If true, the new value overwrites the previous skin. Else, it's merged

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:updateUserSkin() > Example

local source = 1
local skin = {
  head = 394785690,
  torso = 345823423
}
local overwrite = false
jo.framework:updateUserSkin(source, skin, overwrite)
-- OR --
local source = 1
local category = "head"
local data = 394785690
local overwrite = false
jo.framework:updateUserSkin(source, category, data, overwrite)


jo.framework Methods > <Badge type="shared" text="Shared" /> jo.framework:getItemData() > Syntax

jo.framework:getItemData(item)

jo.framework Methods > <Badge type="shared" text="Shared" /> jo.framework:getItemData() > Parameters

item : string

The name of the item

jo.framework Methods > <Badge type="shared" text="Shared" /> jo.framework:getItemData() > Return Value

Type : table|false

The item data or false if not found


jo.framework Methods > <Badge type="shared" text="Shared" /> jo.framework:getItems()

A function to get the list of items <br>

jo.framework Methods > <Badge type="shared" text="Shared" /> jo.framework:getItems() > Syntax

jo.framework:getItems()

jo.framework Methods > <Badge type="shared" text="Shared" /> jo.framework:getItems() > Return Value

Type : table

The list of items

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:onCharacterSelected() > Parameters

cb : function

The callback function triggered when the character is selected, contains (source:integer, isNew:boolean)


Constructor > <Badge type="server" text="Server" /> jo.framework.UserClass:get()

Creates and returns a new User instance for the specified player <br>

UserClass Methods > <Badge type="server" text="Server" /> UserClass:addMoney() > Parameters

amount : number

The amount of money to add

moneyType : integer

The type of currency: 0: dollar, 1: gold, 2: rol


UserClass Methods > <Badge type="server" text="Server" /> UserClass:getIdentifiers() > Return Value

Type : table

Return the player's identifiers <br> identifiers.identifier - Unique identifier of the player <br> identifiers.charid - Unique id of the player


UserClass Methods > <Badge type="server" text="Server" /> UserClass:getJob() > Return Value

Type : string

Returns the job name of the player


UserClass Methods > <Badge type="server" text="Server" /> UserClass:getMoney() > Return Value

Type : number

Return the amount for this kind of money


UserClass Methods > <Badge type="server" text="Server" /> UserClass:getRPName() > Return Value

Type : string

Returns the formatted first and last name of the player


jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:onCharacterSelected() > Parameters

cb : function

The callback function triggered when the character is selected, contains (source:integer, isNew:boolean)

jo.framework Methods > <Badge type="shared" text="Shared" /> jo.framework:getItems() > Return Value

Type : table

The list of items


jo.framework Methods > <Badge type="shared" text="Shared" /> jo.framework:loadInventoryFiles() > Syntax

jo.framework:loadInventoryFiles(file)

UserClass Methods > <Badge type="server" text="Server" /> UserClass:removeMoney() > Parameters

amount : number

The amount of money to remove

moneyType : integer

The type of currency: 0: dollar, 1: gold, 2: rol


UserClass Methods > <Badge type="server" text="Server" /> UserClass:setJob()

Sets the current job assigned to a player <br>

UserClass Methods > <Badge type="server" text="Server" /> UserClass:setJob() > Syntax

UserClass:setJob(job, grade)

UserClass Methods > <Badge type="server" text="Server" /> UserClass:setJob() > Parameters

job : string

The name of the job

grade : number

The grade of the job

UserClass Methods > <Badge type="server" text="Server" /> UserClass:setJob() > Return Value

Type : boolean

Returns the combined result of the job and grade assignment

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getItemCount()

Gets the quantity of a specific item in a player's inventory <br>

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getItemCount() > Syntax

jo.framework:getItemCount(source, item, meta)

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getItemCount() > Parameters

source : integer

The source ID of the player

item : string

The name of the item

meta : table <BadgeOptional />

The metadata of the item

jo.framework Methods > <Badge type="server" text="Server" /> jo.framework:getItemCount() > Return Value

Type : integer

Return the total quantity of the item in the player's inventory


jo.framework Methods > <Badge type="shared" text="Shared" /> jo.framework:addItemDataToPrice()

A function to add inventory item data to every item cost inside a price <br>

jo.framework Methods > <Badge type="shared" text="Shared" /> jo.framework:addItemDataToPrice() > Syntax

jo.framework:addItemDataToPrice(price)

jo.framework Methods > <Badge type="shared" text="Shared" /> jo.framework:addItemDataToPrice() > Parameters

price : table

The price to augment

jo.framework Methods > <Badge type="shared" text="Shared" /> jo.framework:addItemDataToPrice() > Return Value

Type : table

The mutated price


Back to documentation