View Single Post
  #10  
Old 06-09-2010, 12:23 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
To expand on what Jerret said, you will never access the data directly.

PHP Code:
if (player.chat == "buy sword") {
  if (
player.getItemCount("super_sword") >= 0) {
    return 
player.chat "You can only have one super sword!";
  }
  
  if (
player.getItemCount("lesser_sword") >= 0) {
    
player.removeItem("lesser_sword"player.getItemCount("lesser_sword"));
  }
  
  
player.addItem("lesser_sword"1);

Even core scripts like the inventory should use functions like getAllItems to access the items. Then you could easily change code like this

PHP Code:
public function getItemCount(item) {
  return 
this.clientr.item.(@ item);

to this

PHP Code:
public function getItemCount(item) {
  
temp.req requestSQL("SELECT * FROM items WHERE item = '" item.escape() @ "' AND account = '" this.account.escape() @ "'"true);
  return 
req.rows[0].quantity;

without breaking any of your scripts.
__________________
Reply With Quote