Setup cruise control stuff (unfinished)

This commit is contained in:
Vortrex
2022-09-24 06:12:30 -05:00
parent 5942cdf5f2
commit 7349ab041d
3 changed files with 12 additions and 3 deletions

View File

@@ -167,6 +167,9 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
//logToConsole(LOG_DEBUG, `[AGRP.Event] Local player exited vehicle`);
//sendNetworkEventToServer("agrp.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
cruiseControlEnabled = false;
cruiseControlSpeed = 0.0;
if (localPlayer != null) {
if (ped == localPlayer) {
if (areServerElementsSupported()) {
@@ -190,7 +193,7 @@ function onPedExitingVehicle(event, ped, vehicle, seat) {
if (localPlayer != null) {
if (ped == localPlayer) {
cruiseControl = false;
cruiseControlEnabled = false;
cruiseControlSpeed = 0.0;
}
}
@@ -202,12 +205,15 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
logToConsole(LOG_DEBUG, `[AGRP.Event] Ped entered vehicle`);
//sendNetworkEventToServer("agrp.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
cruiseControlEnabled = false;
cruiseControlSpeed = 0.0;
if (localPlayer != null) {
if (ped == localPlayer) {
if (areServerElementsSupported()) {
if (inVehicleSeat == 0) {
//setVehicleEngine(vehicle.id, false);
setVehicleEngine(vehicle.id, false);
//setLocalPlayerControlState(false, false);
if (!inVehicle.engine) {
parkedVehiclePosition = inVehicle.position;
parkedVehicleHeading = inVehicle.heading;

View File

@@ -100,4 +100,7 @@ let currencyString = "${AMOUNT}";
let mapChangeWarning = false;
let cruiseControlEnabled = false;
let cruiseControlSpeed = 0.0;
// ===========================================================================

View File

@@ -136,7 +136,7 @@ function toggleLocalVehicleCruiseControl() {
return false;
}
cruiseControl = !cruiseControl;
cruiseControlEnabled = !cruiseControlEnabled;
cruiseControlSpeed = getVehicleSpeed(vehicle);
}