Uniqers Scripts Docs
  • Docs
  • uniqers-marriage
  • uniqers-spawn
  • uniqers-multicharacter
  • uniqers-investments
  • uniqers-announces
  • Store
Powered by GitBook
On this page
  • How To install
  • Support & Updates & Questions

uniqers-spawn

How to install and all exports infos.

Previousuniqers-marriageNextuniqers-multicharacter

Last updated 3 days ago

How To install

FOR QBCORE/QBUS/CUSTOMQBCORES FRAMEWORK

First stop or delete qb-spawn script or what you use spawn script. after

open qb-apartments/client/main.lua To integrate both the first spawn and normal spawn functionality for QBCore, ensuring compatibility with all spawn-related features such as jobs, gangs, houses, and apartments, locate and modify the relevant sections of the code to support unified functionality.

RegisterNetEvent('apartments:client:setupSpawnUI', function(cData)
QBCore.Functions.TriggerCallback('apartments:GetOwnedApartment', function(result)
if result then
TriggerEvent('qb-spawn:client:setupSpawns', cData, false, nil)
TriggerEvent('qb-spawn:client:openUI', true)
TriggerEvent("apartments:client:SetHomeBlip", result.type)
else
if Apartments.Starting then
TriggerEvent('qb-spawn:client:setupSpawns', cData, true, Apartments.Locations)
TriggerEvent('qb-spawn:client:openUI', true)
else
TriggerEvent('qb-spawn:client:setupSpawns', cData, false, nil)
TriggerEvent('qb-spawn:client:openUI', true)
end
end
end, cData.citizenid)
end)

and save after open resources[qb]\qb-core\shared gang and job .lua for gang

ballas = {
label = 'Ballas',
grades = {
['0'] = { name = 'Recruit' },
['1'] = { name = 'Enforcer' },
['2'] = { name = 'Shot Caller' },
['3'] = { name = 'Boss', isboss = true },
},
spawnlocations = {
[1] = {x = 469.34469, y = -982.1764, z = 26.273393}
},
},    

like this,

and for job

police = {
label = 'Law Enforcement',
type = 'leo',
defaultDuty = true,
offDutyPay = false,
grades = {
['0'] = { name = 'Recruit', payment = 50 },
['1'] = { name = 'Officer', payment = 75 },
['2'] = { name = 'Sergeant', payment = 100 },
['3'] = { name = 'Lieutenant', payment = 125 },
['4'] = { name = 'Chief', isboss = true, payment = 150 },
},
spawnlocations = {
[1] = {x = 469.34469, y = -982.1764, z = 26.273393}
},
},

and open qb-apartments/config.lua

change this

Apartments.Locations = {
["apartment1"] = {
name = "apartment1",
label = "South Rockford Drive",
image = "img/imgap1.png",
price = "FREE",
description = "Information about the hotel can be written here.",
maplocation = "img/imgap1.jpg",
coords = {
enter = vector4(-667.02, -1105.24, 14.63, 242.32),
camcoords = vector4(-691.7783, -1098.214, 27.575319, 263.03857),
},
polyzoneBoxData = {
heading = 245,
minZ = 13.5,
maxZ = 16.0,
debug = false,
length = 1,
width = 3,
distance = 2.0,
created = false
}
},
["apartment2"] = {
name = "apartment2",
label = "Morningwood Blvd",
image = "img/imgap2.png",
price = "FREE",
description = "Information about the hotel can be written here.",
maplocation = "img/imgap2.jpg",
coords = {
enter = vector4(-1288.52, -430.51, 35.15, 124.81),
camcoords = vector4(-1260.244, -423.0414, 45.239257, 101.14539),
},
polyzoneBoxData = {
heading = 124,
minZ = 34.0,
maxZ = 37.0,
debug = false,
length = 1,
width = 3,
distance = 2.0,
created = false
}
},
["apartment3"] = {
name = "apartment3",
label = "Integrity Way",
image = "img/imgap3.png",
price = "FREE",
description = "Information about the hotel can be written here.",
maplocation = "img/imgap3.jpg",
coords = {
enter = vector4(269.73, -640.75, 42.02, 249.07),
camcoords = vector4(245.81562, -622.9107, 58.348945, 228.84838),
},
polyzoneBoxData = {
heading = 250,
minZ = 40,
maxZ = 43.5,
debug = false,
length = 1,
width = 1,
distance = 2.0,
created = false
}
},
["apartment4"] = {
name = "apartment4",
label = "Tinsel Towers",
image = "img/imgap4.png",
price = "FREE",
description = "Information about the hotel can be written here.",
maplocation = "img/imgap4.jpg",
coords = {
enter = vector4(-619.29, 37.69, 43.59, 181.03),
camcoords = vector4(-586.6358, 8.9766902, 63.2192, 358.14163),
},
polyzoneBoxData = {
heading = 180,
minZ = 41.0,
maxZ = 45.5,
debug = false,
length = 1,
width = 2,
distance = 2.0,
created = false
}
},
["apartment5"] = {
name = "apartment5",
label = "Fantastic Plaza",
image = "img/imgap5.png",
price = "FREE",
description = "Information about the hotel can be written here.",
maplocation = "img/imgap5.jpg",
coords = {
enter = vector4(291.517, -1078.674, 29.405, 270.75),
camcoords = vector4(313.55181, -1087.797, 52.274063, 68.456321),
},
polyzoneBoxData = {
heading = 270,
minZ = 28.5,
maxZ = 31.0,
debug = false,
length = 1,
width = 2,
distance = 2.0,
created = false
}
},
}

and done if u want you can use your custom apartment use FirstLoadAP() and if u want use custom create character codes use FirstLoad() at config.

FOR ESX/OLDESX/CUSTOMESX FRAMEWORK

First stop or delete your spawn script. after ESX basically has no apartment scripts, gang scripts, or house scripts, so you can't use spawns in those features. If you have these scripts, you can use them. If you are using one of these 3 scripts, contact us so we can make it compatible with the spawn script so you can use these features. If you are using multichar on your server, replace the spawn function codes with these codes. If there is no multichar, replace the codes how your character spawns and the code you use to spawn with these 2 codes below.

for client TriggerEvent for server part TriggerClientEvent

TriggerEvent('qb-spawn:client:setupSpawns', Player, false, nil)
TriggerEvent('qb-spawn:client:openUI', true)

Your character will now be able to use the spawn system.

Since it does not use the esx apartment system to create a new character, the character is born in a designated place and created there. Therefore, you can continue to use the character script you are using or the character creation system in any script, or you can use the codes of that system in the config.

function FirstLoad() -- for esx first create screen if u have apertment system for esx you can use this or contact us. -- add your codes here. end

You can add it to this function. In this way, character creation codes also work in spawn. If you are using a special apartment system, contact us and we will add that system to the spawn script.

FOR QBX FRAMEWORK

First stop or delete qbx_spawn script or what you use spawn script. after QBX basically has no house scripts, so you can't use spawns in those features. If you have these scripts, you can use them. If you are using one of these scripts, contact us so we can make it compatible with the spawn script so you can use these features. If you are using multichar on your server, replace the spawn function codes with these codes. If there is no multichar, replace the codes how your character spawns and the code you use to spawn with these 2 codes below.

for client TriggerEvent for server part TriggerClientEvent

    TriggerClientEvent('qb-spawn:client:setupSpawns', src, Player, false, nil)
    TriggerClientEvent('qb-spawn:client:openUI', src, true)
	

after open resources[qbx]\qbx_core\shared gang and job .lua

add this code your gang and jobs table.

spawnlocations = {
[1] = {x = 469.34469, y = -982.1764, z = 26.273393}
},

like this, for gang

['lostmc'] = {
label = 'The Lost MC',
grades = {
[0] = {
name = 'Recruit'
},
[1] = {
name = 'Enforcer'
},
[2] = {
name = 'Shot Caller'
},
[3] = {
name = 'Boss',
isboss = true,
bankAuth = true
},
},
spawnlocations = {
[1] = {x = 469.34469, y = -982.1764, z = 26.273393}
},
},

like this, for job

['police'] = {
label = 'LSPD',
type = 'leo',
defaultDuty = true,
offDutyPay = false,
grades = {
[0] = {
name = 'Recruit',
payment = 50
},
[1] = {
name = 'Officer',
payment = 75
},
[2] = {
name = 'Sergeant',
payment = 100
},
[3] = {
name = 'Lieutenant',
payment = 125
},
[4] = {
name = 'Chief',
isboss = true,
bankAuth = true,
payment = 150
},
},
spawnlocations = {
[1] = {x = 469.34469, y = -982.1764, z = 26.273393}
},
},

after open qbx_properties/server/property.lua and paste this code

RegisterNetEvent('uniqers:qbx:login:apart', function(cid)
local src = source
local property = MySQL.single.await('SELECT * FROM properties WHERE owner = ?', {cid})
local id = property.id
local propertyCoords = json.decode(property.coords)
propertyCoords = vec3(propertyCoords.x, propertyCoords.y, propertyCoords.z)


local player = exports.qbx_core:GetPlayerByCitizenId(cid)


citizenid[src] = player.PlayerData.citizenid

local interactions = {}
local isInteriorShell = tonumber(property.interior) ~= nil
local stashes = json.decode(property.stash_options)
for i = 1, #stashes do
    local stashCoords = isInteriorShell and CalculateOffsetCoords(propertyCoords, stashes[i].coords) or stashes[i].coords
    interactions[#interactions+1] = {
        type = 'stash',
        coords = vec3(stashCoords.x, stashCoords.y, stashCoords.z)
    }
    exports.ox_inventory:RegisterStash(string.format('qbx_properties_%s', property.property_name), string.format('Property: %s', property.property_name), stashes[i].slots, stashes[i].maxWeight, property.owner)
end

if isInteriorShell then
    TriggerClientEvent('qbx_properties:client:createInterior', src, tonumber(property.interior), vec3(propertyCoords.x, propertyCoords.y, propertyCoords.z - ShellUndergroundOffset))
end

local interactData = json.decode(property.interact_options)
for i = 1, #interactData do
    local coords = isInteriorShell and CalculateOffsetCoords(propertyCoords, interactData[i].coords) or interactData[i].coords
    interactions[#interactions+1] = {
        type = interactData[i].type,
        coords = vec3(coords.x, coords.y, coords.z)
    }
    if interactData[i].type == 'exit' then
        SetEntityCoords(GetPlayerPed(src), coords.x, coords.y, coords.z, false, false, false, false)
    end
end

local decorations = json.decode(property.decorations)
for i = 1, #decorations do
    decorations[i].coords = CalculateOffsetCoords(propertyCoords, decorations[i].coords) or vec3(decorations[i].coords.x, decorations[i].coords.y, decorations[i].coords.z)
end
TriggerClientEvent('qbx_properties:client:loadDecorations', src, decorations)

enteredProperty[src] = id
insideProperty[id] = insideProperty[id] or {}
insideProperty[id][#insideProperty[id] + 1] = src
for i = 1, #insideProperty[id] do
    TriggerClientEvent('qbx_properties:client:concealPlayers', insideProperty[id][i], insideProperty[id])
end

TriggerClientEvent('qbx_properties:client:updateInteractions', src, interactions, type(property.rent_interval) == 'number')
end)

and done

if u want you can use your custom apartment use FirstLoadAP() and if u want use custom create character codes use FirstLoad() at config.

also if u use 0r-apartment

open your 0r-apartment config file

and add your apartments this values

name = 1, -- this is id your apartment id
image = "img/imgap4.png",
price = "FREE",
description = "Information about the hotel can be written here.",
maplocation = "img/imgap4.jpg",
coords = {
enter = vector4(-619.29, 37.69, 43.59, 181.03),
camcoords = vector4(-586.6358, 8.9766902, 63.2192, 358.14163),
},

for example

[1] = {
    name = 1,
    label = "Shelly Apart",
	image = "img/imgap4.png",
	price = "FREE",
	description = "Information about the hotel can be written here.",
	maplocation = "img/imgap4.jpg",
    tint = 55,
    coords = { enter = vec4(278.6257, -1118.3618, 29.4197, 179.6273), camcoords = vector4(-586.6358, 8.9766902, 63.2192, 358.14163) },
    blip = {
        active = true,
        title = "Shelly Apart #1",
        sprite = 476,
        color = 2,
        scale = 0.8,
        coords = vec3(278.202209, -1124.268188, 29.380981)
    },
},

Support & Updates & Questions

https://discord.gg/MyrGhbf9tM