Issue
NEW_LOAD_SCENE_START_SPHERE
never finishes loading if waited for in a loop when joining a server after disconnecting from it without closing the game.
I believe I am using this native correctly as demonstrated by the code below, similar to many Rockstar mission scripts.
Steps to Reproduce
- Disable the
spawnmanager
resource. - Create a Lua resource containing the following code. On my test server, this code runs after the client is activated.
local model = `g_m_y_famca_01`
RequestModel(model)
while not HasModelLoaded(model) do
Wait(0)
end
local playerID = PlayerId()
SetPlayerModel(playerID, model)
SetModelAsNoLongerNeeded(model)
local position = vector3(703.89, -993.87, 24.45)
RequestCollisionAtCoord(position.x, position.y, position.z)
local playerPedID = PlayerPedId()
SetEntityCoordsNoOffset(playerPedID, position.x, position.y, position.z, false, false, false)
NetworkResurrectLocalPlayer(position.x, position.y, position.z, 0, true, true)
while not HasCollisionLoadedAroundEntity(playerPedID) do
Wait(0)
end
SetFocusPosAndVel(position.x, position.y, position.z, 0.0, 0.0, 0.0)
NewLoadSceneStartSphere(position.x, position.y, position.z, 150.0, 0)
while not IsNewLoadSceneLoaded() do
Wait(0)
end
ClearFocus()
NewLoadSceneStop()
local rotation = vector3(12.94, 0.00, 77.51)
local camera = CreateCamWithParams('DEFAULT_SCRIPTED_CAMERA', position.x, position.y, position.z,
rotation.x, rotation.y, rotation.z, 40.0, true, 0)
RenderScriptCams(true, false, 0, true, true)
DoScreenFadeIn(1000)
while not IsScreenFadedIn() do
ThefeedHideThisFrame()
HideHudAndRadarThisFrame()
DisableAllControlActions(0)
SetLocalPlayerInvisibleLocally(true)
Wait(0)
end
RenderScriptCams(false, true, 1000, true, true)
DestroyCam(camera, false)
- Join the server and let the newly created resource spawn you in instead of
spawnmanager
. The scene will load, followed by a 1 second fade-in, after which you will be granted player control. - Disconnect from the server.
- Without restarting the game, join the server once again.
(alternatively, join the test server)
Observed Behavior
Upon joining, the IsNewLoadSceneLoaded
loop will never finish. Quitting the game and re-joining the server will lead to the scene loading as normal.
Expected Behavior
The IsNewLoadSceneLoaded
loop finishes normally as it did when joining the server for the first time.
Details
This issue occurs when using NEW_LOAD_SCENE_START
too.
I could not get the scene to load without the player ped existing, hence the extra.
Client update channel: Latest.
Server artifact version: 6645.