Guest User

Untitled

a guest
Mar 11th, 2012
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.21 KB | None | 0 0
  1. public function onLoadPlayerData(){
  2.   temp.results = SQL.executeSQL("items", "SELECT rowid, * FROM 'player_data' WHERE account = '" @ player.account @ "'", null, true);
  3.   temp.rows = temp.results.rows;
  4.   for (temp.row : temp.rows){
  5.     clientr.item.(@ temp.row.realname).(@ temp.row.rowid) = { temp.row.rowid, temp.row.realname, temp.row.socket, temp.row.accountlocked };
  6.     if (clientr.item.(@ temp.row.realname).data == null) {
  7.       temp.results2 = SQL.executeSQL("items", "SELECT realname, itemname, itemtype, itemthumbnail, itemdescription FROM 'item_data' WHERE realname ='"@ temp.row.realname @ "'", null, true);
  8.       temp.rows2 = temp.results2.rows;
  9.       for (temp.row2 : temp.rows2){
  10.         clientr.item.(@ temp.row.realname).data = { temp.row2.realname, temp.row2.itemname, temp.row2.itemtype, temp.row2.itemthumbnail, temp.row2.itemdescription};        
  11.       }
  12.     }
  13.   }
  14. }
  15. public function onClearVariables() {
  16.   temp.clientrvars = clientr.getdynamicvarnames();  
  17.   for(temp.var: temp.clientrvars) {
  18.     temp.clientrvars2 = clientr.(@ temp.var).getdynamicvarnames();
  19.     clientr.(@ temp.var) = null;
  20.     for(temp.var2 : temp.clientrvars2){
  21.       temp.clientrvars3 = clientr.(@ temp.var).(@ temp.var2).getdynamicvarnames();
  22.       clientr.(@ temp.var).(@ temp.var2) = null;
  23.       for(temp.var3 : temp.clientrvars3){
  24.         clientr.(@ temp.var).(@ temp.var2).(@ temp.var3) = null;        
  25.       }
  26.     }
  27.   }
  28. }
  29.  
  30. public function onCreateItem(realname, createdby){
  31.  if (temp.realname == null || temp.createdby == null) return;
  32.  temp.timecreated = timevar2;
  33.  temp.results = SQL.executeSQL("items", "SELECT * FROM 'item_data' WHERE realname = '" @ temp.realname.escape() @ "'", null, true);
  34.  temp.rows = temp.results.rows;
  35.  if (temp.rows.size() >= 1){
  36.    temp.results = SQL.executeSQL("items", "INSERT INTO 'player_data' VALUES(
  37.                                '" @ player.account.escape() @ "',
  38.                                '" @ temp.realname.escape() @ "',
  39.                                '" @ temp.timecreated.escape() @ "',
  40.                                '" @ temp.createdby.escape() @ "',
  41.                                '" @ player.account.escape() @ "',
  42.                                '0',
  43.                                '0'
  44.                               )", null, true);
  45.   temp.results = SQL.executeSQL("items", "SELECT rowid FROM 'player_data' WHERE account = '" @ player.account.escape() @ "' AND  timecreated = '" @ temp.timecreated.escape() @ "' AND realname = '" @ temp.realname.escape() @ "'", null, true);
  46.   temp.itemid = temp.results.rows;
  47.   temp.itemid = temp.itemid.substring(1);
  48.   onAddItem(temp.realname, temp.itemid[0]);
  49.   }else echo("Hacker Alert?:" SPC player.account SPC "is attempting to create a" SPC temp.realname SPC "and it doesn't exist");
  50. }
  51. public function onAddItem(realname, itemid){
  52.   temp.results = SQL.executeSQL("items", "SELECT realname, itemname, itemtype, itemthumbnail, itemdescription FROM 'item_data' WHERE realname = '" @ temp.realname.escape() @ "'", null, true);
  53.   temp.rows = temp.results.rows;
  54.   for (temp.row : temp.rows){
  55.     clientr.item.(@ temp.row.realname).data = { temp.row.realname, temp.row.itemname, temp.row.itemtype, temp.row.itemthumbnail, temp.row.itemdescription};        
  56.   }
  57.   temp.results = SQL.executeSQL("items", "SELECT rowid, * FROM 'player_data' WHERE rowid = '" @ temp.itemid.escape() @  "'", null, true);
  58.   temp.rows2 = temp.results.rows;
  59.   for (temp.row : temp.rows2){
  60.     clientr.item.(@ temp.row.realname).(@ temp.row.rowid) = { temp.row.rowid, temp.row.realname, temp.row.socket, temp.row.accountlocked };
  61.   }
  62. }
  63. public function onRemoveItem(itemid, realname){
  64.   if(clientr.item.(@ temp.realname).(@ temp.itemid) != null){
  65.     clientr.item.(@ temp.realname).(@ temp.itemid) = null;
  66.     temp.results = SQL.executeSQL("items", "DELETE FROM 'player_data' WHERE rowid = '" @ temp.itemid.escape() @ "'", null, true);
  67.     temp.i = clientr.item.(@ temp.realname).getdynamicvarnames();
  68.     if (temp.i.size() <=2 ){
  69.       clientr.item.(@ temp.realname).data = null;
  70.     }
  71.   } else echo("Item Error: Player" SPC player.communityname SPC "is trying to delete" SPC temp.itemid @ "(" @ temp.realname @ ") however no items with the ID" SPC temp.itemid SPC "exist");
  72. }
Advertisement
Add Comment
Please, Sign In to add comment