i would add this in client data, so if the user opens the menu, and click enter the error "you dont have enough money" dont show up (manually fix if user switch one car)
before fix:
ui.IndexChange.on((index) => {
mp.players.local.vehicleShop.model = data[Object.keys(data)[index + 1]].hash;
mp.players.local.vehicleShop.price = data[Object.keys(data)[index + 1]].price;
});
ui.ItemSelect.on((item, index) => {
mp.events.callRemote("buyVehicleShop", carShopType, JSON.stringify({ "model": mp.players.local.vehicleShop.model, "price": mp.players.local.vehicleShop.price }));
});
after fix:
ui.IndexChange.on((index) => {
mp.players.local.vehicleShop.model = data[Object.keys(data)[index + 1]].hash;
mp.players.local.vehicleShop.price = data[Object.keys(data)[index + 1]].price;
});
ui.ItemSelect.on((item, index) => {
mp.players.local.vehicleShop.model = data[Object.keys(data)[index + 1]].hash;
mp.players.local.vehicleShop.price = data[Object.keys(data)[index + 1]].price;
mp.events.callRemote("buyVehicleShop", carShopType, JSON.stringify({ "model": mp.players.local.vehicleShop.model, "price": mp.players.local.vehicleShop.price }));
});