View Single Post
  #7  
Old 04-04-2010, 01:29 PM
firefighter firefighter is offline
Registered User
Join Date: Jan 2009
Location: Germany
Posts: 70
firefighter is on a distinguished road
We on Zenox are storing the items in a SQLite database

PHP Code:
public function IncPlayerItemCount(placc, item, count) {
  if (
ItemExists(item)) {
    
temp.ct = int(count);
    if (
temp.ct > 0) {
      
CreatePlayerItemIfNotExists(placc, item);
      
temp.req = GetSQL("UPDATE ItemDB_PlayerItems SET count=count+"@temp.ct@" WHERE player=(SELECT ID FROM Players WHERE Account='"@SQLEscape(placc)@"') AND item=(SELECT ID FROM ItemDB_Items WHERE name='"@SQLEscape(item)@"')",false);
      if (
temp.req!=null && temp.req.error=="")
        return 
true;
      else {
        echo(
"ItemDB: Inc item count '"@item@"' of player "@placc@" failed - SQL query error");
        return 
false;
      }
    } else {
      echo(
"ItemDB: Inc item count '"@item@"' of player "@placc@" failed - count smaller than 0 or 0");
      return 
false;
    }
  } else {
    echo(
"ItemDB: Inc item count '"@item@"' of player "@placc@" failed - item doesnt exist");
    return 
false;
  }
} 
Reply With Quote