From 3f15265fe9865bcdef3f9a64bd0c230f90a44481 Mon Sep 17 00:00:00 2001 From: Dispersia Roleplay <155019886+DispersiaRoleplay@users.noreply.github.com> Date: Mon, 7 Apr 2025 18:56:29 +0300 Subject: [PATCH 1/2] Create ua.lua using main en.lua was translated to Ukrainian language. I have you personally loaded this code into an updated qbcore project and checked all it's functionality This code fit the style guidelines This PR fit the contribution guidelines --- locales/ua.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 locales/ua.lua diff --git a/locales/ua.lua b/locales/ua.lua new file mode 100644 index 0000000..18a28e8 --- /dev/null +++ b/locales/ua.lua @@ -0,0 +1,12 @@ +local Translations = { + ui = { + last_location = "Останнє місце", + confirm = "Підтвердити", + where_would_you_like_to_start = "Звідки ви бажаєте розпочати?", + } +} + +Lang = Lang or Locale:new({ + phrases = Translations, + warnOnMissing = true +}) From 5b376b48270bc93ebd711f4d9ba0bab93b3ab888 Mon Sep 17 00:00:00 2001 From: Dispersia Roleplay <155019886+DispersiaRoleplay@users.noreply.github.com> Date: Wed, 7 May 2025 20:11:13 +0300 Subject: [PATCH 2/2] Fix: Player spawns properly This PR resolves a bug where players were incorrectly spawning at the character preview location instead of their actual last known position. Problem: The original implementation called QBCore:Server:OnPlayerLoaded, QBCore:Client:OnPlayerLoaded, and PostSpawnPlayer() outside the asynchronous QBCore.Functions.GetPlayerData callback. As a result, the spawn sequence would proceed before the player's data (including coordinates) was fully loaded, leading to the player remaining at the default camera or preview location. Solution: The fix moves all spawn-related logic inside the GetPlayerData callback to ensure: The player ped is fully created. The correct position and heading are available before teleporting. Housing or apartment metadata is handled after coordinate placement. The spawn function is only triggered once all required data is ready. Tested: Verified correct spawning in last known position. Verified teleportation to apartments and houses functions correctly. No regression observed in normal or new character spawn types. --- client.lua | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/client.lua b/client.lua index d343dc8..52325a0 100644 --- a/client.lua +++ b/client.lua @@ -172,24 +172,25 @@ RegisterNUICallback('spawnplayer', function(data, cb) local insideMeta = PlayerData.metadata['inside'] if type == 'current' then PreSpawnPlayer() + QBCore.Functions.GetPlayerData(function(pd) ped = PlayerPedId() SetEntityCoords(ped, pd.position.x, pd.position.y, pd.position.z) SetEntityHeading(ped, pd.position.a) FreezeEntityPosition(ped, false) - end) - - if insideMeta.house ~= nil then - local houseId = insideMeta.house - TriggerEvent('qb-houses:client:LastLocationHouse', houseId) - elseif insideMeta.apartment.apartmentType ~= nil or insideMeta.apartment.apartmentId ~= nil then - local apartmentType = insideMeta.apartment.apartmentType - local apartmentId = insideMeta.apartment.apartmentId - TriggerEvent('qb-apartments:client:LastLocationHouse', apartmentType, apartmentId) - end - TriggerServerEvent('QBCore:Server:OnPlayerLoaded') - TriggerEvent('QBCore:Client:OnPlayerLoaded') - PostSpawnPlayer() + + local insideMeta = pd.metadata and pd.metadata['inside'] or {} + + if insideMeta.house then + TriggerEvent('qb-houses:client:LastLocationHouse', insideMeta.house) + elseif insideMeta.apartment and insideMeta.apartment.apartmentType and insideMeta.apartment.apartmentId then + TriggerEvent('qb-apartments:client:LastLocationHouse', insideMeta.apartment.apartmentType, insideMeta.apartment.apartmentId) + end + + TriggerServerEvent('QBCore:Server:OnPlayerLoaded') + TriggerEvent('QBCore:Client:OnPlayerLoaded') + PostSpawnPlayer() + end) elseif type == 'house' then PreSpawnPlayer() TriggerEvent('qb-houses:client:enterOwnedHouse', location)