Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var itemname = value5.split(" /");
  2.  
  3.                     const items = allItems.find(item => item.name === itemname[0]);
  4.                     var addItem = items.name;
  5.                     var itemAmount = value4;
  6.                     var itemweight = items.weight * parseInt(itemAmount);
  7.                     var price = items.price * parseInt(itemAmount);
  8.  
  9.                     var newweight = player.inventoryweight + parseFloat(itemweight);
  10.                     var newmoney = player.money - parseFloat(price);
  11.  
  12.                     if(newmoney >= 0) {
  13.                         if(newweight <= 50) {
  14.                             player.notify("Du hast " + itemAmount + "x " + addItem + " für " + price.toFixed(2) +  "$ ~g~gekauft!");
  15.                        
  16.                            
  17.                             player.inventoryweight = parseFloat(newweight)
  18.                             player.inventory[addItem] = player.inventory[addItem] + parseInt(itemAmount) || parseInt(itemAmount)                   
  19.                             player.money = newmoney;
  20.  
  21.                             toClient.updateMoney(player);
  22.                         } else {
  23.                             player.notify("Zu wenig Platz!")
  24.                         }
  25.  
  26.                     } else {
  27.                         player.notify("Zu wenig Geld dabei!")
  28.                     }
  29.                 break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement