Fix: Player spawns properly#85
Open
DispersiaRoleplay wants to merge 3 commits intoqbcore-framework:mainfrom
Open
Fix: Player spawns properly#85DispersiaRoleplay wants to merge 3 commits intoqbcore-framework:mainfrom
DispersiaRoleplay wants to merge 3 commits intoqbcore-framework:mainfrom
Conversation
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
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.