Skip to main content

Client Exports V3

Functions​

GetOwnedHomes​

Gets the player owned houses, excluding the key access to other player owned houses.

exports.bcs_housing:GetOwnedHomes()

Return:

GetRealestateHomes​

Gets all the houses created by a realestate

exports.bcs_housing:GetRealestateHomes(job)
  • job: string
    • The realestate job name

Return:

GetOwnedHomeKeys​

Gets the player owned houses including the key access to other player owned houses

exports.bcs_housing:GetOwnedHomeKeys()

Return:

GetHomes​

Gets all existing homes

local homes = exports.bcs_housing:GetHomes()
for identifier, v in pairs(homes) do
print(identifier, v.properties.name, v.properties.complex, v.properties.entry)
end

Return:

GetHome​

Get the house by the identifier

exports.bcs_housing:GetHome(homeId)
  • homeId: string
    • The house identifier

Return:

LockHome​

Locks or Unlocks the house, only for IPL or Shell type

exports.bcs_housing:LockHome(homeId)
  • homeId: string
    • The house identifier

isLocked​

Get the lock status of the house

local lock = exports.bcs_housing:isLocked(homeId)
  • homeId: string
    • The house identifier

Return:

  • boolean

GetKeyList​

Gets the house keys

local keys = exports.bcs_housing:GetKeyList(homeId)
for keyName, v in pairs(keys) do
--- v is a list of permission name
print(keyName, json.encode(v))
end
  • homeId: string
    • The house identifier

Return:

  • table: Array of key for the house

GetKeyHolders​

Gets the house key holders

local keyHolders = exports.bcs_housing:GetKeyHolders(homeId)
for identifier, v in pairs(keyHolders) do
print(identifier, v.name, v.key)
end
  • homeId: string
    • The house identifier

Return:

  • table: Array of key holder for the house

AddKeyHolder​

Add a key holder

exports.bcs_housing:AddKeyHolder(homeId, target, keyName)
  • homeId: string
    • The house identifier
  • target: number
  • keyName: string
    • the key name must exists within the key list

RemoveKeyHolder​

exports.bcs_housing:RemoveKeyHolder(homeId, identifier)
  • homeId: string
    • The house identifier
  • identifier: string
    • The target identifier / citizenid

HasKey​

Check if the player has a key to the house

local have = exports.bcs_housing:HasKey(homeId, permission)
  • homeId: string
  • permission?: string
    • optional to check a permission for example Garage, Storage, Door 1

SetWaypoint​

Sets a waypoint gps to the house

exports.bcs_housing:SetWaypoint(homeId)

GetPlayersInside​

local players = exports.bcs_housing:GetPlayersInside(homeId)
for _, id in pairs(players) do
print(id) -- number server id
end
  • homeId: string

Return

  • table<number>: Player server id

  • homeId: string

Statebags​

isInsideHome​

---@field isInside boolean
local isInside = LocalPlayer.state.isInsideHome

This state will check if a player is inside a home

isInsideArea​

---@field inArea boolean
local inArea = LocalPlayer.state.isInsideArea

This state will check if a player is inside an area like outside the house (frontyard) or in an MLO

CurrentHome​

---@field inArea homeObj
local home = LocalPlayer.state.CurrentHome

Returns a home object