View Single Post
  #9  
Old 05-19-2007, 05:45 PM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
PHP Code:
function onCreated() {
  
this.items = {{"Juggling", 30, "*Prizes/Juggle"}, {"PK Heal", 30, "*Prizes/PK Heal"}, {"Jump", 30, "*Prizes/Jump"}, {"Light Mouse", 150, "*Prizes/Light Mouse"}};
}

function 
onPlayerChats() {
  if (
player.chat.starts("buy")) {
    
temp.item = player.chat.substring(4);
    
    for (
temp.var : this.items) {
      if (
temp.item == temp.var[0]) {
        
temp.iteminfo = temp.var;
        
        break;
      }
    }
    
    if (
temp.iteminfo != NULL) {
      if (
clientr.etcoins >= temp.iteminfo[1]) {
        
clientr.etcoins -= temp.iteminfo[1];
        
addWeapon(temp.iteminfo[2]);
        
        
player.chat = format("You bought %s for %d event coins!", temp.iteminfo[0], temp.iteminfo[1]);
      }
      else 
player.chat = format("You require %d event coins for this item!", temp.iteminfo[1]);
    }
  }
} 
or the:
{
}
format

PHP Code:
function onCreated()
{
  
this.items = {{"Juggling", 30, "*Prizes/Juggle"}, {"PK Heal", 30, "*Prizes/PK Heal"}, {"Jump", 30, "*Prizes/Jump"}, {"Light Mouse", 150, "*Prizes/Light Mouse"}};
}

function 
onPlayerChats()
{
  if (
player.chat.starts("buy"))
  {
    
temp.item = player.chat.substring(4);
    
    for (
temp.var : this.items)
    {
      if (
temp.item == temp.var[0])
      {
        
temp.iteminfo = temp.var;
        
        break;
      }
    }
    
    if (
temp.iteminfo != NULL)
    {
      if (
clientr.etcoins >= temp.iteminfo[1])
      {
        
clientr.etcoins -= temp.iteminfo[1];
        
addWeapon(temp.iteminfo[2]);
        
        
player.chat = format("You bought %s for %d event coins!", temp.iteminfo[0], temp.iteminfo[1]);
      }
        else
      {
        
player.chat = format("You require %d event coins for this item!", temp.iteminfo[1]);
      }
    }
  }
} 
__________________
- Zidane / Zidaya
Reply With Quote