Move local player vehicle control state to vehicle.js

This commit is contained in:
Vortrex
2023-02-23 01:15:41 -06:00
parent 8532aa74ca
commit c225c4d130

View File

@@ -172,3 +172,26 @@ function removeVehiclesFromClient() {
} }
// =========================================================================== // ===========================================================================
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);
}
}
}
}
}
}
}
// ===========================================================================