46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
export default function tuningSync() {
|
|
mp.events.add('entityStreamIn', (entity: EntityMp) => {
|
|
if (!entity) {
|
|
return;
|
|
}
|
|
if (entity.isAVehicle()) {
|
|
|
|
var vehicle: VehicleMp = entity as VehicleMp;
|
|
|
|
var taxiLight = entity.getVariable("vehicleTaxiLight");
|
|
if (taxiLight) vehicle.setTaxiLights(taxiLight);
|
|
|
|
var mod18 = vehicle.getVariable('mod18');
|
|
var wheelType = vehicle.getVariable('wheelType');
|
|
mp.gui.chat.push("wheelType = " + wheelType);
|
|
|
|
if (wheelType !== undefined) {
|
|
vehicle.setWheelType(wheelType);
|
|
}
|
|
|
|
if (mod18 !== undefined) {
|
|
vehicle.toggleMod(18, mod18);
|
|
}
|
|
}
|
|
});
|
|
|
|
mp.events.add('vehicleToggleMod', (veh, slot, newval) => {
|
|
if (!veh) {
|
|
return;
|
|
}
|
|
if (slot == -2) {
|
|
veh.setWheelType(newval);
|
|
}
|
|
else {
|
|
veh.toggleMod(slot, newval);
|
|
}
|
|
|
|
});
|
|
|
|
mp.events.addDataHandler("vehicleTaxiLight", (entity: VehicleMp, state: boolean) => {
|
|
if (!entity) {
|
|
return;
|
|
}
|
|
entity.setTaxiLights(state);
|
|
});
|
|
} |