Skip to main content

Server

Functions​

GetOwnedHomes​

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

exports.bcs_housing:GetOwnedHomes(plyId)
  • plyId: string
    • player identifier or citizen id

Return:

GetHomesForSale​

Gets all the houses that is not owned

exports.bcs_housing:GetHomesForSale()

Return:

GetOwnedHomeKeys​

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

exports.bcs_housing:GetOwnedHomeKeys(plyId)
  • plyId: string
    • player identifier or citizen id

Return:

GetHomes​

Gets all existing homes

local homes = exports.bcs_housing:GetHomes()
for identifier, v in pairs(homes) do
print(identifier, v.name, v.complex, v.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, plyId, permission)
  • homeId: string
  • plyId: string
    • player identifier or citizen id
  • permission?: string
    • optional to check a permission for example Garage, Storage, Door 1

RevokeOwnership​

Remove a house owner

exports.bcs_housing:RevokeOwnership(homeId)
  • homeId: string

RevokePropertyByIdentifier​

exports.bcs_housing:RevokePropertyByIdentifier(plyId)
  • plyId: string
    • player identifier or citizen id

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

isPlayerInside​

local isInside = exports.bcs_housing:isPlayerInside(homeId, plyId)
  • homeId: string
  • plyId: number
    • Player server id

Return

  • boolean

Events​

Housing:server:CreateApartment​

    TriggerServerEvent("Housing:server:CreateApartment", homeId)

You can use this to assign or give someone that was newly spawned an apartment, check qb-spawn example