Skip to content

Commit

Permalink
Update CommonFunctions.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
QuadrupleTurbo committed Mar 4, 2023
1 parent cdad06f commit f1bb6c3
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions vMenu/CommonFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,27 @@ public static async Task TeleportToCoords(Vector3 pos, bool safeModeDisabled = f
// it seem to load the world ANY faster than without, but whatever.
RequestCollisionAtCoord(pos.X, pos.Y, z);

// Set focus for that area.
SetFocusPosAndVel(pos.X, pos.Y, pos.Z, 0, 0, 0);

// Start to load the scene.
NewLoadSceneStart(pos.X, pos.Y, pos.Z, pos.X, pos.Y, pos.Z, 50f, 0);

// Reset the timer.
tempTimer = GetGameTimer();

// Wait for the scene to be loaded with a timeout.
while (!IsNewLoadSceneLoaded() && Game.GameTime - tempTimer < 10000) // Can take up to 10 seconds
{
await BaseScript.Delay(0);
}

// Clear the focus for that area.
ClearFocus();

// Important! This step was missing before, not setting this would cause areas outside the scene to become unrendered aka "city mud" would appear.
NewLoadSceneStop();

// If the player is in a vehicle, teleport the vehicle to this new position.
if (inVehicle())
{
Expand Down Expand Up @@ -664,27 +685,6 @@ public static async Task TeleportToCoords(Vector3 pos, bool safeModeDisabled = f
Game.PlayerPed.IsPositionFrozen = false;
}

// Set focus for that area.
SetFocusPosAndVel(pos.X, pos.Y, pos.Z, 0, 0, 0);

// Start to load the scene.
NewLoadSceneStart(pos.X, pos.Y, pos.Z, pos.X, pos.Y, pos.Z, 50f, 0);

// Reset the timer.
tempTimer = GetGameTimer();

// Wait for the scene to be loaded with a timeout.
while (!IsNewLoadSceneLoaded() && Game.GameTime - tempTimer < 10000) // Can take up to 10 seconds
{
await BaseScript.Delay(0);
}

// Clear the focus for that area.
ClearFocus();

// Important! This step was missing before, not setting this would cause areas outside the scene to become unrendered aka "city mud" would appear.
NewLoadSceneStop();

// Fade screen in and reset the camera angle.
DoScreenFadeIn(500);
SetGameplayCamRelativePitch(0.0f, 1.0f);
Expand Down

0 comments on commit f1bb6c3

Please sign in to comment.