Scripts
um-spawn

um-spawn

  • Select your framework

Framework

  • Make sure your qb-core version are not old

Installation

Firstly

  • delete qb-spawn or other-spawnn
  • import > spawnbookmarks.sql

Multicharacter

  • open config.lua > find spawnEventUI and replace event um-spawn:client:startSpawnUI
spawnEventUI = 'um-spawn:client:startSpawnUI'

Config (Important ones)

  • adjust it according to your own preferences
um = {}
 
um.debug = false
 
--  If you want the apartment start for new player, set it to true.
-- ?If you make it true, new user does not have an apartment, you force them to choose an apartment
um.forceApartmentStart = true
 
um.lang = 'en' -- tr,en,es,zh,fr,hi [or add locales > .lua]
 
um.main = {
    camera = {
        radius = 2.0, -- Camera distance from the character
        angle = 50, -- Camera angle
        point = 0.1, -- Camera point
        turning = true, -- If you want to turn the camera, set it to true.
    },
    ped = {
        status = true, -- If you want to show the character in the spawn menu, set it to true.
        opacity = false, -- Todo: next update
    },
    property = {
        apartmentStatus = true, -- If you want to show the apartment system, set it to true.
        houseStatus = true, -- If you want to show the house system, set it to true.
    },
    bookmark = {
        status = true, -- If you want to show the bookmark system, set it to true.
        money = {
            free = false, -- If you want to bookmark the free money, set it to true.
            amount = math.random(1000, 10000) or 500
        }
    },
    map = true, -- If you want to show other locations [paleto etc], set it to true.
}
 
um.weather = {
    sync = false, -- If you want to sync the weather, set it to true.
    sc = 'qb', -- cd , qb
    type = 'XMAS', -- https://docs.fivem.net/docs/game-references/weather-types/
    time = 23, -- 0 - 23
}

You have completed the installation âś…

Apartments

  • If you want to organise apartments bridge > apartments > coords.lua
 
if not um.main.property.apartmentStatus then return end
 
UM_apartments = {
    ['south'] = {
        type = 'apartment1',
        coords = vector4(-693.8, -1089.88, 13.69, 247.9),
        text = 'South Rockford Drive',
        features = {
            beds = '2 bd',
            bath = '2 ba',
            sqft = '2,300 sqft'
        },
        desc = 'An upscale dwelling featuring modern amenities and a desirable location, ideal for professionals and city enthusiasts.',
        star = 4,
        tag = "rent"
    },
    ['morningwood'] = {
        type = 'apartment2',
        coords = vector4(-1254.77, -404.6, 34.57, 124.53),
        text = 'Morningwood Blvd',
        features = {
            beds = '2 bd',
            bath = '2 ba',
            sqft = '1,800 sqft'
        },
        desc = 'A luxurious and prestigious residence, offering the finest amenities and a prime location for those who demand the best in urban living.',
        star = 5,
        tag = "rent"
    },
    ['integrity'] = {
        type = 'apartment3',
        coords = vector4(224.52, -625.15, 40.46, 248.28),
        text = 'Integrity Way',
        features = {
            beds = 'Studio',
            bath = '1 ba',
            sqft = '1,100 sqft'
        },
        desc = 'A comfortable and well-maintained apartment, offering a balance between convenience and affordability.',
        star = 3,
        tag = "rent"
    },
    ['tinsel'] = {
        type = 'apartment4',
        coords = vector4(-617.55, 5.74, 41.85, 359.29),
        text = 'Tinsel Towers',
        features = {
            beds = '1 bd',
            bath = '1 ba',
            sqft = '2,200 sqft'
        },
        desc = 'An upscale dwelling featuring modern amenities and a desirable location, ideal for professionals and city enthusiasts.',
        star = 5,
        tag = "rent"
    },
    ['fantastic'] = {
        type = 'apartment5',
        coords = vector4(311.69, -1080.13, 29.4, 100.58),
        text = 'Fantastic Plaza',
        features = {
            beds = 'Studio',
            bath = '1 ba',
            sqft = '800 sqft'
        },
        desc = 'A basic residence that provides essential amenities, suitable for those who prioritize budget over luxury.',
        star = 3,
        tag = "rent"
    },
}

Core

If you are not a developer, skip this step

  • If you want to organise framework bridge > framework > qb.lua
if GetResourceState('qb-core') ~= 'started' then return print('CORE?') end
 
QBCore = exports['qb-core']:GetCoreObject()
 
-- Server
if IsDuplicityVersion() then
 
    function GetPlayer(src)
        local attempts = 10
        local delay = 1000
 
        local player = QBCore.Functions.GetPlayer(src)
        while not player and attempts > 0 do
            Debug('Waiting for player data...')
            Wait(delay)
            player = QBCore.Functions.GetPlayer(src)
            attempts = attempts - 1
        end
 
        if not player then
            Debug('Failed to get player data after several attempts.')
            return nil
        end
 
        return player
    end
 
    function GetCitizenID(player)
        return player.PlayerData.citizenid or Debug('Failed to get CitizenID')
    end
 
end
 
-- Client
function GetPlayerDataQB()
    return QBCore.Functions.GetPlayerData() or Debug('Failed to get playerdata')
end
 
function GetLastLocation()
    return GetPlayerDataQB().position or Debug('Failed to get last location')
end
 
function GetInside()
    return GetPlayerDataQB().metadata["inside"] or nil or Debug('Failed to get inside meta')
end
 
function OnPlayerLoaded(bool)
    local resetInsideMeta = bool or false
    TriggerServerEvent('QBCore:Server:OnPlayerLoaded')
    TriggerEvent('QBCore:Client:OnPlayerLoaded')
    Debug('OnPlayerLoaded')
    if resetInsideMeta then
        TriggerServerEvent('qb-houses:server:SetInsideMeta', 0, false)
        TriggerServerEvent('qb-apartments:server:SetInsideMeta', 0, 0, false)
        TriggerServerEvent('ps-housing:server:resetMetaData')
        Debug('Reset Inside Meta')
    end
end
 
function InsideHouseorApartments()
    local meta = GetInside()
    if meta.house ~= nil then
        local houseId = meta.house
        TriggerEvent('qb-houses:client:LastLocationHouse', houseId)
        Debug('Player Inside House | ' .. '| ' .. houseId)
    elseif meta.apartment.apartmentType ~= nil or meta.apartment.apartmentId ~= nil then
        local apartmentType = meta.apartment.apartmentType
        local apartmentId = meta.apartment.apartmentId
        Debug('Player Inside Apartment | ' .. '| ' .. apartmentType .. ' | ' .. apartmentId)
        TriggerEvent('qb-apartments:client:LastLocationHouse', apartmentType, apartmentId)
    elseif meta.property_id ~= nil then
        local property_id = meta.property_id
        TriggerServerEvent('ps-housing:server:enterProperty', tostring(property_id))
    end
end

GetProperties

If you are not a developer, skip this step

  • Here is the general function of Properties main > client > functions.lua | line 98
-- The `GetProperties` function is a Lua function that retrieves the properties (apartments and houses)
-- owned by the player. It uses the `getPropertyStatusAndData` function to check the status of the
-- properties and retrieve the data associated with them.
function GetProperties()
    local function getPropertyStatusAndData(status, forceStart, defaultData, callbackName)
        if not status then return false, false end
 
        local result = lib.callback.await(callbackName)
        if result then
            if callbackName == 'getHouses' then
                local processedHouses = {}
                    for i = 1, (#result), 1 do
                        local houseData = result[i]
                        processedHouses[#processedHouses+1] = {
                            house = houseData.property_id or houseData.house,
                            label = houseData.street or houseData.house
                        }
                    end
                return processedHouses, false
            elseif callbackName == 'getBookmarks' then
                local processedBookmarks = {}
                for i = 1, (#result), 1 do
                    local bookmarksData = result[i]
                    processedBookmarks[#processedBookmarks+1] = {
                        label = bookmarksData.name,
                        image = bookmarksData.image,
                        location = bookmarksData.location
                    }
                end
                return processedBookmarks, false
            else
                TriggerEvent("apartments:client:SetHomeBlip", result.type)
                return result, false
            end
        end
 
        if forceStart then
            return defaultData, true
        end
 
        return false, false
    end
 
    local myApartments, forceApartAndUMApart = getPropertyStatusAndData(
        um.main.property.apartmentStatus,
        um.forceApartmentStart,
        UM_apartments,
        'getApartments'
    )
 
    local myHouses = getPropertyStatusAndData(
        um.main.property.houseStatus,
        nil,
        nil,
        'getHouses'
    )
 
    local myBookmarks = getPropertyStatusAndData(
        um.main.bookmark.status,
        nil,
        nil,
        'getBookmarks'
    )
 
    return myApartments, myHouses, myBookmarks, forceApartAndUMApart
end

Event

  • Event to access or open the spawn menu

  • Client

TriggerEvent('um-spawn:client:startSpawnUI')
  • Server
TriggerClientEvent('um-spawn:client:startSpawnUI', source)

Server.cfg

ensure oxmysql
ensure ox_lib
--------------
ensure qb-core
ensure [qb]
ensure [standalone]
--------------
ensure um-spawn