From 1f6b8f52f9d152c582581f99d32a7630c3674b2d Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Thu, 22 Apr 2021 09:25:56 -0500 Subject: [PATCH] Set velocity to zero before teleporting --- scripts/client/utilities.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js index ad05325c..f4e13ec4 100644 --- a/scripts/client/utilities.js +++ b/scripts/client/utilities.js @@ -301,6 +301,7 @@ function getClosestVehicle(pos) { function setLocalPlayerPosition(position) { logToConsole(LOG_DEBUG, `[Asshat.Utilities] Setting position to ${position.x}, ${position.y}, ${position.z}`); + localPlayer.velocity = toVector3(0.0, 0.0, 0.0); localPlayer.position = position; } @@ -516,7 +517,7 @@ function processLocalPlayerSphereEntryExitHandling() { let position = getLocalPlayerPosition(); getElementsByType(ELEMENT_MARKER).forEach(function(sphere) { - if(position.distance(sphere.position) <= sphere.radius) { + if(getDistance(position, sphere.position) <= sphere.radius) { if(!inSphere) { inSphere = sphere; triggerEvent("OnLocalPlayerEnterSphere", null, sphere); @@ -534,8 +535,9 @@ function processLocalPlayerSphereEntryExitHandling() { function processJobRouteSphere() { if(gta.game == GAME_GTA_SA) { + let position = getLocalPlayerPosition(); if(jobRouteStopSphere != null) { - if(position.distance(jobRouteStopSphere.position) <= 2.0) { + if(getDistance(position, jobRouteStopSphere.position) <= 2.0) { enteredJobRouteSphere(); } } @@ -618,4 +620,10 @@ function getAllowedSkinIndexBySkinId(skinId) { return -1; } +// =========================================================================== + +function processWantedLevelReset() { + localPlayer.wantedLevel = 0; +} + // =========================================================================== \ No newline at end of file