Commands & Exports

This section lists all available commands, exports, and events included in the script. You’ll find client-side, server-side, and shared functions designed to help developers integrate, extend, or interact with the system easily within their own scripts or frameworks.


Commands

This section lists all available commands included in the script. Each command is designed to simplify administration, player interaction, or debugging tasks. You’ll find detailed descriptions, usage examples, and permission requirements to help you manage and customize your server efficiently.

Command
Description

/houseMenu

Open your home menu to manage furniture, storage, and settings.

/hireRenter

Admin only — remove a tenant from the property.

/realestate

Open the real estate menu to manage and view available properties.

/resetentrycoords

Reset all interior door coordinates to their default positions.


Client Exports

This section provides all available client exports for the script. These functions allow you to interact directly with the system from the client side, enabling custom features, UI interactions, and integrations with other resources. Each export includes a short description and usage example for easy implementation.

inDecorate

The inDecorate export allows you to check if a player is currently in decoration mode. This is useful for managing or restricting specific actions while decoration mode is active.


How to Use

To check whether the player is in decoration mode, use the following code:

local inDecorate = exports['qs-housing']:inDecorate()
print("Is the player in decoration mode? " .. tostring(inDecorate))

This will return a boolean value (true or false) indicating whether the player is in decoration mode. You can then use this information to implement custom logic, such as blocking certain actions or triggering events during decoration.

GetClosestHouse

The GetClosestHouse export allows you to determine whether the player is near a house. This can be useful for triggering house-related interactions or verifying proximity for specific actions.


How to Use

To check if a player is near a house, use the following code:

local closestHouse = exports['qs-housing']:GetClosestHouse()
if closestHouse then
    print("Closest house identifier: " .. closestHouse)
else
    print("No house nearby.")
end

This will return the identifier of the closest house if one is nearby or nil if no house is detected. You can use this information to execute house-specific logic or display relevant information to the player.

getCurrentHouse

The getCurrentHouse export allows you to retrieve the identifier of the house the player is currently inside. This is useful for managing house-specific features, such as editing or interacting with the house's interior.


How to Use

To get the current house the player is in, you can use the following code:

local currentHouse = exports['qs-housing']:getCurrentHouse()
if currentHouse then
    print("Player is in house: " .. currentHouse)
else
    print("Player is not inside any house.")
end

This export will return the identifier of the current house if the player is inside one, or nil if the player is not in any house. You can utilize this for custom scripts or house-related actions.

getHouseList

The getHouseList export allows you to retrieve the full list of houses defined in the configuration file (Config.Houses). This is particularly useful if you need to access or manipulate the house data programmatically within your scripts.


How to Use

To get the complete list of houses, you can use the following code:

local houseList = exports['qs-housing']:getHouseList()
for houseId, houseData in pairs(houseList) do
    print("House ID: " .. houseId)
    print("House Details: " .. json.encode(houseData, { indent = true }))
end

This export will return a table containing all the houses configured in your asset. Each house entry will include details such as its ID, location, and any other custom configurations defined in Config.Houses. You can use this data for tasks like listing available houses, debugging, or creating custom features.

GetCurrentHouseUpgrades

The GetCurrentHouseUpgrades export allows you to retrieve the list of upgrades for the house you are currently inside. This is useful for accessing and managing the specific upgrades applied to a house.


How to Use

To get the list of upgrades for the current house, you can use the following code:

local upgrades = exports['qs-housing']:GetCurrentHouseUpgrades()

if upgrades and next(upgrades) then
    print("Upgrades for the current house:")
    for upgrade, details in pairs(upgrades) do
        print(upgrade, json.encode(details, { indent = true }))
    end
else
    print("No upgrades found for the current house or you are not inside a house.")
end

This export will return a table containing the upgrades for the current house. If no upgrades exist or you are not inside a house, it will return an empty table. You can use this data to display, modify, or manage house upgrades programmatically.

enterHouse

The enterHouse export allows you to programmatically force the local player to enter a specific house. This can be used in scripts to trigger entry into properties either as a regular access or as a visitor.


How to Use

To make the player enter a specific house, use the following code:

exports['qs-housing']:enterHouse('house-1', true)
  • houseId (string): The unique identifier of the house you want the player to enter. This must match an existing house defined in your Config.Houses.

  • isVisit (boolean): Set to true if the entry should be treated as a visit (guest mode), or false for a normal entry (owner or authorized access).

GetHouseData

The GetHouseData export lets you fetch the configuration data of a house when you already know its identifier.


How to Use

local houseId = exports['qs-housing']:GetClosestHouse()

if houseId then
    local houseData = exports['qs-housing']:getHouseData(houseId)
    if houseData then
        print("House locked: " .. tostring(houseData.locked))
    end
else
    print("No house nearby.")
end

This returns the configuration table of the specified house, or nil if no data is available.


Server Exports

This section provides all available server exports for the script. These functions allow developers to interact with the system from the server side, manage data, trigger actions, and integrate with other resources. Each export includes a clear description and a practical example to simplify its implementation.

getHouseRoutingId

The getHouseRoutingId export allows you to retrieve the Routing Bucket ID of a house instance. This is useful for checking if a specific house is currently active (someone is inside) or to manage instance-based logic inside houses.


How to Use

To get the routing ID of a house, use the following code:

local routingId = exports['qs-housing']:getHouseRoutingId('house')
if not routingId then
    print('Nobody is home!')
end

print('Routing ID:', routingId)

Here’s an example of a command that checks if a specific house is occupied:

RegisterCommand('checkhouserouting', function()
    local routingId = exports['qs-housing']:getHouseRoutingId('house')

    if not routingId then
        print('Result: Nobody is currently inside the house.')
    else
        print('Result: House is occupied. Routing ID:', routingId)
    end
end)

This example checks if the house identified by 'house' has an active routing bucket. If no one is inside (routingId is nil), it prints that nobody is home. If there is an active routing bucket, it prints the routingId, indicating the house is currently being used.

handleRentPayment

The housing:handleRentPayment event is triggered each time a rent payment is processed for a property. This allows external scripts to track rent-related activity or perform custom actions such as logging, rewards, or penalties.

Event Parameters

  • house: The name or ID of the house being rented.

  • identifier: The identifier (usually Steam or Rockstar ID) of the player making the payment.

  • payed: A boolean indicating if the rent was successfully paid (true) or not (false).


How to Use

To listen for rent payment events in your script, use the following pattern:

AddEventHandler('housing:handleRentPayment', function(house, identifier, payed)
    if payed then
        print(('[Rent Paid] Player %s has paid rent for house %s.'):format(identifier, house))
    else
        print(('[Rent Failed] Player %s failed to pay rent for house %s.'):format(identifier, house))
    end
end)

Here’s an example of how you could log all successful rent payments to a file:

AddEventHandler('housing:handleRentPayment', function(house, identifier, payed)
    if payed then
        local logMessage = os.date('[%Y-%m-%d %H:%M:%S]') ..
            (' Rent paid for %s by %s\n'):format(house, identifier)

        SaveResourceFile('my-logger', 'rent_logs.txt', logMessage, -1)
    end
end)

This code listens for rent payments and writes successful transactions to a text file for later review.