Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

updated several commands to v5 #404

Merged
merged 9 commits into from
Apr 2, 2023
Prev Previous commit
Next Next commit
fix liveryCommand & fullTune overwriting livery
  • Loading branch information
Dav-Renz committed Apr 2, 2023
commit 1afcc88dbdd0fa9e56bdf661e30f97931ec852e6
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,16 @@ function setLivery(player: alt.Player, livery: number) {
return;
}

const liveryState: Partial<VehicleState> = { livery };
if (vehicle.modKit == 0 && vehicle.modKitsCount > 0) {
Athena.vehicle.tuning.applyTuning(vehicle, { modkit: 1 });
}

if (vehicle.modKit == 0) {
Athena.player.emit.message(player, LocaleController.get(LOCALE_KEYS.VEHICLE_HAS_NO_MOD_KIT));
return;
}

Athena.vehicle.tuning.applyState(vehicle, liveryState);
Athena.vehicle.tuning.applyTuning(vehicle, { mods: [{ id: 48, value: livery }] });
Athena.vehicle.controls.updateLastUsed(vehicle);
Athena.vehicle.controls.update(vehicle);

Expand Down Expand Up @@ -202,12 +209,16 @@ Athena.systems.messenger.commands.register(
for (let i = 0; i < 70; ++i) {
const maxId = vehicle.getModsCount(i);

if (i == 48) {
continue;
}

if (maxId > 0) {
Athena.vehicle.tuning.applyTuning(vehicle, { mods: [{ id: i, value: maxId }] });
Athena.vehicle.controls.updateLastUsed(vehicle);
Athena.vehicle.controls.update(vehicle);
}
}
Athena.vehicle.controls.updateLastUsed(vehicle);
Athena.vehicle.controls.update(vehicle);
},
);

Expand Down