View Single Post
  #8  
Old 09-11-2008, 02:32 AM
Frankie Frankie is offline
xChugxLifex
Frankie's Avatar
Join Date: Feb 2008
Location: New York
Posts: 1,610
Frankie is a jewel in the roughFrankie is a jewel in the rough
Send a message via AIM to Frankie Send a message via MSN to Frankie
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.ithis.saleItems)
    {
      if (
player.chat.substring(4) == temp.i[0])
      {
        
this.buyItem(temp.i[0], temp.i[1], temp.i[2]);
        break;
      }
    }
  }
}

function 
buyItem(itemNameitemPriceitemWeapon)
{
  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!";

__________________
*Sum41Freeeeek
*Frankie

Last edited by Frankie; 09-11-2008 at 03:09 AM..
Reply With Quote