Set velocity to zero before teleporting

This commit is contained in:
Vortrex
2021-04-22 09:25:56 -05:00
parent 4fe27bf27c
commit 1f6b8f52f9

View File

@@ -301,6 +301,7 @@ function getClosestVehicle(pos) {
function setLocalPlayerPosition(position) { function setLocalPlayerPosition(position) {
logToConsole(LOG_DEBUG, `[Asshat.Utilities] Setting position to ${position.x}, ${position.y}, ${position.z}`); 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; localPlayer.position = position;
} }
@@ -516,7 +517,7 @@ function processLocalPlayerSphereEntryExitHandling() {
let position = getLocalPlayerPosition(); let position = getLocalPlayerPosition();
getElementsByType(ELEMENT_MARKER).forEach(function(sphere) { getElementsByType(ELEMENT_MARKER).forEach(function(sphere) {
if(position.distance(sphere.position) <= sphere.radius) { if(getDistance(position, sphere.position) <= sphere.radius) {
if(!inSphere) { if(!inSphere) {
inSphere = sphere; inSphere = sphere;
triggerEvent("OnLocalPlayerEnterSphere", null, sphere); triggerEvent("OnLocalPlayerEnterSphere", null, sphere);
@@ -534,8 +535,9 @@ function processLocalPlayerSphereEntryExitHandling() {
function processJobRouteSphere() { function processJobRouteSphere() {
if(gta.game == GAME_GTA_SA) { if(gta.game == GAME_GTA_SA) {
let position = getLocalPlayerPosition();
if(jobRouteStopSphere != null) { if(jobRouteStopSphere != null) {
if(position.distance(jobRouteStopSphere.position) <= 2.0) { if(getDistance(position, jobRouteStopSphere.position) <= 2.0) {
enteredJobRouteSphere(); enteredJobRouteSphere();
} }
} }
@@ -619,3 +621,9 @@ function getAllowedSkinIndexBySkinId(skinId) {
} }
// =========================================================================== // ===========================================================================
function processWantedLevelReset() {
localPlayer.wantedLevel = 0;
}
// ===========================================================================