Improved tuning, reimplemented /time (use /time -1 to resume time manager)

This commit is contained in:
hydrant
2018-12-15 16:21:02 +01:00
parent 2818fd3513
commit dd671df43a
3 changed files with 47 additions and 4 deletions

View File

@@ -6,6 +6,8 @@
var keyBound = false;
var disableInput = [75, 278, 279, 280, 281, 23, 59, 60, 71, 72, 74];
var carModTypes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 22, 25, 27, 28, 33, 34, 35, 38, 39, 40, 41, 42, 43, 44, 46, 48, 69];
var carModSlotName = [
@@ -119,6 +121,10 @@ mp.events.add('hideTuningInfo', (unbind) => {
mp.game.ui.clearHelp(true);
mp.gui.chat.show(true);
if (mp.players.local.vehicle) {
mp.players.local.vehicle.setLights(0);
}
if (typeof mainMenu !== "undefined" && unbind) {
mainMenu.Close();
globalData.InTuning = false;
@@ -140,6 +146,14 @@ function keyPressHandler() {
mp.events.callRemote("startPlayerTuning");
}
mp.events.add("render", () => {
if (globalData.InTuning) {
disableInput.forEach((input) => {
mp.game.controls.disableControlAction(1, input, true);
});
}
});
mp.events.add("showTuningMenu", () => {
mp.events.call("hideTuningInfo" , false);
mp.gui.chat.show(false);
@@ -147,6 +161,8 @@ mp.events.add("showTuningMenu", () => {
var localPlayer = mp.players.local;
var localVehicle = localPlayer.vehicle;
localVehicle.setLights(1);
if (typeof mainMenu !== "undefined" && mainMenu.Visible) {
return;
}
@@ -231,6 +247,7 @@ mp.events.add("showTuningMenu", () => {
}
if (modSlot === 22) {
localVehicle.setLights(2);
var hlColor = localVehicle.getVariable("headlightColor");
if (typeof hlColor !== "number" || isNaN(hlColor) || hlColor < 0 || hlColor === 255) {
currentMod = -1;
@@ -318,6 +335,7 @@ mp.events.add("showTuningMenu", () => {
if (modSlot === 18) return;
else if (modSlot === 22) {
localVehicle.setLights(1);
setHeadlightsColor(localVehicle, currentMod);
return;
}
@@ -329,6 +347,7 @@ mp.events.add("showTuningMenu", () => {
});
mainMenu.MenuClose.on(() => {
localVehicle.setLights(0);
globalData.InTuning = false;
mp.events.call("hideTuningInfo", false);
});