Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var itemname = value5.split(" /");
- const items = allItems.find(item => item.name === itemname[0]);
- var addItem = items.name;
- var itemAmount = value4;
- var itemweight = items.weight * parseInt(itemAmount);
- var price = items.price * parseInt(itemAmount);
- var newweight = player.inventoryweight + parseFloat(itemweight);
- var newmoney = player.money - parseFloat(price);
- if(newmoney >= 0) {
- if(newweight <= 50) {
- player.notify("Du hast " + itemAmount + "x " + addItem + " für " + price.toFixed(2) + "$ ~g~gekauft!");
- player.inventoryweight = parseFloat(newweight)
- player.inventory[addItem] = player.inventory[addItem] + parseInt(itemAmount) || parseInt(itemAmount)
- player.money = newmoney;
- toClient.updateMoney(player);
- } else {
- player.notify("Zu wenig Platz!")
- }
- } else {
- player.notify("Zu wenig Geld dabei!")
- }
- break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement