Housing

Housing and motel integration overrides for ak47_multicharacter.

Supports qb-houses, qb-apartments, ak47_housing, and snipe-motel natively. Custom housing scripts can be integrated via custom/client.lua and custom/server.lua.

Client Overrides

Configure client spawn hooks in custom/client.lua.

Initial Spawn

Handles spawning a player inside their starting apartment or motel.

function Custom_SpawnInsideApartment()
    -- exports["my_custom_motel"]:SpawnInsideApartment()
end

Creating an Apartment

Executes when a player completes character creation and selects an apartment.

function Custom_CreateApartment(appType, label)
    -- TriggerServerEvent("my_apartments:server:CreateApartment", appType, label)
end

Last Location Spawning

Spawns the player back inside their last visited property upon login.

function Custom_SpawnLastLocationHouse(houseId)
    -- TriggerEvent('my_housing:client:EnterHouse', houseId)
end

function Custom_SpawnLastLocationApartment(apartmentType, apartmentId)
    -- TriggerEvent('my_apartments:client:EnterApartment', apartmentType, apartmentId)
end

Entering Owned Houses

Triggers when a player selects a property from the My Houses menu.

function Custom_EnterOwnedHouse(location)
    -- TriggerEvent('my_housing:client:EnterOwnedHouse', location)
end

Server Overrides

Configure server data fetching in custom/server.lua.

Loading House Configurations

Loads property coordinates and transmits them to the client interface.

function Custom_LoadHouseData(source)
    local src = source
    -- Fetch property coordinates and trigger client event
end

Fetching Owned Houses

Queries player-owned properties to populate the spawn selector interface.

function Custom_GetOwnedHouses(source, cid)
    local myHouses = {}
    local houses = MySQL.query.await('SELECT * FROM my_custom_houses WHERE owner = ?', {cid})
    if houses then
        for i = 1, #houses do
            myHouses[#myHouses+1] = {
                house = houses[i].house_id,
                label = "Property: " .. houses[i].house_name
            }
        end
    end
    return myHouses
end