View Single Post
  #34  
Old 02-24-2011, 04:39 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
The problem is that the weapon and the price aren't defined. You'll need to have the client send information on the weapon when it sends the trigger. You could also have it send the price but that's a security risk.

My suggestion (since I doubt you want to use NPC registration, which is what I would do) is to have a list of prices for each weapon:

PHP Code:
function onCreated() {
  
this.price.Sword 100;
}

function 
onActionServerSide(cmditem) {
  if (
cmd == "buy") {
    if (
this.price.(@ item) > 0) {
      if (
player.rupees this.price.(@ item)) {
        
player.rupees -= this.price.(@ item);
        
player.addWeapon(item);
      } else {
        
player.chat "I don't have enough money to buy this item!";
      }
    }
  }

__________________
Reply With Quote