| Frankie |
09-11-2008 02:32 AM |
I was really bored so I made this. It supports multiple items sold. I stopped testing it once I got to the rupee and weapon check, but the command works fine.
Up for grabs, wasn't really making it specifically for Gulthex, I was just really bored and thought I would try it.
PHP Code:
function onPlayerChats() { if (player.chat.starts("buy")) { this.saleItems = { {"headbob", 100, "Event/Headbob"}, {"anotheritem", 250, "Event/Item"}, {"dance item", 50, "Event/Dance"} };
for (temp.i: this.saleItems) { if (player.chat.substring(4) == temp.i[0]) { this.buyItem(temp.i[0], temp.i[1], temp.i[2]); break; } } } }
function buyItem(itemName, itemPrice, itemWeapon) { if (player.findWeapon(temp.itemWeapon) != false) { return; } if (player.rupees < temp.itemPrice) { player.chat = "You don't have enough money!"; return; } player.rupees -= temp.itemPrice; player.addWeapon(temp.itemWeapon; player.chat = "You have bought" SPC temp.itemName SPC "for" SPC temp.itemPrice SPC "dollars!"; }
|