🏡Apartments & Housing Implementation

This guide should help you setup the apartment and housing integration correctly, so you don't have any problem whatsoever placing computers inside apartments and houses/properties.

Why do I have to do this?

This is needed so the script can keep track of the players routing bucket, because when a computer is placed it gets the player routing bucket and that computer only spawns in that bucket.


QB-APARTMENTS

QBCore's apartments are supported by default and if you use other resource you will have to integrate it by following the qbcore' aps model.

The events below are used by default with qb-apartments so whenever a player enters and apartment or exits it, it spawn the desks in the new bucket.

-- What this basically does, is that when the player enters an apartment, it will update the desks because the player's routing bucket has changed.

-- This will spawn the desks in the apartment (if there is a desk in that routing bucket and apartment),
--      and when the player leaves the apartment, it will despawn the desks.

-- By default we provide code for qb-apartments, but you can easily change this to your own apartment system (if using any).
-- If you don't have an apartment system, you can comment the code below.

RegisterNetEvent("qb-apartments:client:EnteredApartment", function()
    TriggerEvent("bd-hacking:client:update-desks", Desks)
end)

RegisterNetEvent("qb-apartments:client:ExitedApartment", function()
    TriggerEvent("bd-hacking:client:update-desks", Desks)
end)

NOLAG_PROPERTIES

Nolags's properties are supported by default and if you use other resource you will have to integrate it by following the nolag's properties model.

The events below are used by default with nolag_properties so whenever a player enters and apartment or exits it, it spawn the desks in the new bucket.

The difference here is that NoLag supports server-sided events whenever a player enters or exits a property, so we have also included server side integration for both properties and apartments. :)

client/editable/housing/housing.lua

-- What this basically does, is that when the player enters house/property, it will update the desks because the player's routing bucket has changed.

-- This will spawn the desks in the house/property (if there is a desk in that routing bucket and house/property),
--      and when the player leaves the house/property, it will despawn the desks.

-- By default we provide code for qb-house/propertys, but you can easily change this to your own house/property system (if using any).
-- If you don't have an house/property system, you can comment the code below.


RegisterNetEvent("nolag_properties:client:enterProperty", function()
    TriggerEvent("bd-hacking:client:update-desks", Desks)
end)

RegisterNetEvent("nolag_properties:client:exitProperty", function()
    TriggerEvent("bd-hacking:client:update-desks", Desks)
end)

server/editable/housing/housing.lua

RegisterNetEvent('nolag_properties:server:enterProperty', function(propertyId)
    TriggerClientEvent("nolag_properties:client:enterProperty", source)
end)

RegisterNetEvent('nolag_properties:server:exitProperty', function(propertyId)
    TriggerClientEvent("nolag_properties:client:exitProperty", source)
end)

Last updated