Added error fix, when player leaves tuning menu and trys to tune vehicle
This commit is contained in:
@@ -83,6 +83,8 @@ const ItemsCollection = NativeUI.ItemsCollection;
|
|||||||
const Color = NativeUI.Color;
|
const Color = NativeUI.Color;
|
||||||
const ListItem = NativeUI.ListItem;
|
const ListItem = NativeUI.ListItem;
|
||||||
|
|
||||||
|
var mainMenu;
|
||||||
|
|
||||||
mp.events.add('showTuningInfo', () => {
|
mp.events.add('showTuningInfo', () => {
|
||||||
mp.game.ui.setTextComponentFormat('STRING');
|
mp.game.ui.setTextComponentFormat('STRING');
|
||||||
mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um dein Fahrzeug zu modifizieren');
|
mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um dein Fahrzeug zu modifizieren');
|
||||||
@@ -96,6 +98,10 @@ mp.events.add('hideTuningInfo', (unbind) => {
|
|||||||
mp.game.ui.clearHelp(true);
|
mp.game.ui.clearHelp(true);
|
||||||
mp.gui.chat.show(true);
|
mp.gui.chat.show(true);
|
||||||
|
|
||||||
|
if (typeof mainMenu !== "undefined" && unbind) {
|
||||||
|
mainMenu.Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (keyBound && unbind) {
|
if (keyBound && unbind) {
|
||||||
mp.keys.unbind(0x45, false, keyPressHandler);
|
mp.keys.unbind(0x45, false, keyPressHandler);
|
||||||
keyBound = false;
|
keyBound = false;
|
||||||
@@ -113,7 +119,7 @@ mp.events.add("showTuningMenu", () => {
|
|||||||
var localPlayer = mp.players.local;
|
var localPlayer = mp.players.local;
|
||||||
var localVehicle = localPlayer.vehicle;
|
var localVehicle = localPlayer.vehicle;
|
||||||
|
|
||||||
var mainMenu = new Menu("Fahrzeugwerkstatt", "Modifiziere dein Fahrzeug", new Point(50, 50));
|
mainMenu = new Menu("Fahrzeugwerkstatt", "Modifiziere dein Fahrzeug", new Point(50, 50));
|
||||||
|
|
||||||
carModTypes.forEach((modType) => {
|
carModTypes.forEach((modType) => {
|
||||||
if (localVehicle.getModSlotName(modType) !== "undefined") {
|
if (localVehicle.getModSlotName(modType) !== "undefined") {
|
||||||
@@ -168,6 +174,10 @@ mp.events.add("showTuningMenu", () => {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mp.events.add("playerLeaveVehicle", () => {
|
||||||
|
mp.events.call("hideTuningInfo", true);
|
||||||
|
});
|
||||||
|
|
||||||
function getSlotName(slot) {
|
function getSlotName(slot) {
|
||||||
var toReturn = "undefined";
|
var toReturn = "undefined";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user