start car shop
This commit is contained in:
49
Client/Business/cardealer.js
Normal file
49
Client/Business/cardealer.js
Normal file
@@ -0,0 +1,49 @@
|
||||
const NativeUI = require('nativeui');
|
||||
const Menu = NativeUI.Menu;
|
||||
const UIMenuItem = NativeUI.UIMenuItem;
|
||||
const UIMenuListItem = NativeUI.UIMenuListItem;
|
||||
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
|
||||
const UIMenuSliderItem = NativeUI.UIMenuSliderItem;
|
||||
const BadgeStyle = NativeUI.BadgeStyle;
|
||||
const Point = NativeUI.Point;
|
||||
const ItemsCollection = NativeUI.ItemsCollection;
|
||||
const Color = NativeUI.Color;
|
||||
const ListItem = NativeUI.ListItem;
|
||||
|
||||
const moneyFormat = require("moneyformat");
|
||||
|
||||
var shopMenu;
|
||||
|
||||
mp.events.add('ShopVehicle_OpenMenu', (businessName, price) => {
|
||||
var veh = mp.players.local.vehicle;
|
||||
mp.gui.chat.show(false);
|
||||
shopMenu = new Menu("Fahrzeugkauf", "Kaufe ein neues Auto", new Point(50, 50));
|
||||
|
||||
var carItem = new UIMenuItem("Fahrzeugname");
|
||||
carItem.SetRightLabel(mp.game.ui.getLabelText(mp.game.vehicle.getDisplayNameFromVehicleModel(veh.model)));
|
||||
shopMenu.AddItem(carItem);
|
||||
|
||||
var shopItem = new UIMenuItem("Autohaus");
|
||||
shopItem.SetRightLabel(businessName);
|
||||
shopMenu.AddItem(shopItem);
|
||||
|
||||
var priceItem = new UIMenuItem("Preis");
|
||||
priceItem.SetRightLabel("~g~$~s~ "+ moneyFormat(price));
|
||||
shopMenu.AddItem(priceItem);
|
||||
|
||||
var saveItem = new UIMenuItem("Kaufen");
|
||||
saveItem.BackColor = new Color(0, 100, 0);
|
||||
saveItem.HighlightedBackColor = new Color(0, 150, 0);
|
||||
shopMenu.AddItem(saveItem);
|
||||
|
||||
var cancelItem = new UIMenuItem("Abbrechen");
|
||||
cancelItem.BackColor = new Color(213, 0, 0);
|
||||
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
|
||||
shopMenu.AddItem(cancelItem);
|
||||
|
||||
shopMenu.MenuClose.on(() => {
|
||||
mp.gui.chat.show(true);
|
||||
})
|
||||
|
||||
shopMenu.Open();
|
||||
});
|
||||
@@ -68,8 +68,10 @@ mp.events.add("toggleUi", (show) => {
|
||||
// return ('$' + num.toFixed(2).replace('.', ',').replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1.'));
|
||||
//}
|
||||
|
||||
const moneyFormat = require("moneyformat");
|
||||
|
||||
mp.events.add("updateMoney", (money) => {
|
||||
playerMoney = money.toLocaleString("de-DE", { minimumFractionDigits: 0 });
|
||||
playerMoney = moneyFormat(money);
|
||||
});
|
||||
|
||||
mp.events.add("render", () => {
|
||||
|
||||
@@ -43,3 +43,4 @@ require('./Tuning/sync.js');
|
||||
require('./Tuning/sirensilence.js');
|
||||
|
||||
require('./Business/main.js');
|
||||
require('./Business/cardealer.js');
|
||||
|
||||
3
Client/moneyformat/index.js
Normal file
3
Client/moneyformat/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
exports = function (money) {
|
||||
return money.toLocaleString("de-DE", { minimumFractionDigits: 0 });
|
||||
};
|
||||
Reference in New Issue
Block a user