From c225c4d130bd2f5626d635d13482787b6c8fee96 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Thu, 23 Feb 2023 01:15:41 -0600 Subject: [PATCH] Move local player vehicle control state to vehicle.js --- scripts/client/vehicle.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scripts/client/vehicle.js b/scripts/client/vehicle.js index 5d185e08..259c64dd 100644 --- a/scripts/client/vehicle.js +++ b/scripts/client/vehicle.js @@ -171,4 +171,27 @@ function removeVehiclesFromClient() { getServerData().vehicles.splice(0); } +// =========================================================================== + +function processLocalPlayerVehicleControlState() { + if (areServerElementsSupported()) { + if (localPlayer.vehicle != null) { + if (doesEntityDataExist(localPlayer.vehicle, "v.rp.engine")) { + if (getEntityData(localPlayer.vehicle, "v.rp.engine") == false) { + setImmediate(function () { + localPlayer.vehicle.engine = getEntityData(localPlayer.vehicle, "v.rp.engine"); + }); + + if (!getEntityData(localPlayer.vehicle, "v.rp.engine")) { + if (typeof localPlayer.vehicle.velocity != "undefined") { + localPlayer.vehicle.velocity = toVector3(0.0, 0.0, 0.0); + localPlayer.vehicle.turnVelocity = toVector3(0.0, 0.0, 0.0); + } + } + } + } + } + } +} + // =========================================================================== \ No newline at end of file