Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function onLoadPlayerData(){
- temp.results = SQL.executeSQL("items", "SELECT rowid, * FROM 'player_data' WHERE account = '" @ player.account @ "'", null, true);
- temp.rows = temp.results.rows;
- for (temp.row : temp.rows){
- clientr.item.(@ temp.row.realname).(@ temp.row.rowid) = { temp.row.rowid, temp.row.realname, temp.row.socket, temp.row.accountlocked };
- if (clientr.item.(@ temp.row.realname).data == null) {
- temp.results2 = SQL.executeSQL("items", "SELECT realname, itemname, itemtype, itemthumbnail, itemdescription FROM 'item_data' WHERE realname ='"@ temp.row.realname @ "'", null, true);
- temp.rows2 = temp.results2.rows;
- for (temp.row2 : temp.rows2){
- clientr.item.(@ temp.row.realname).data = { temp.row2.realname, temp.row2.itemname, temp.row2.itemtype, temp.row2.itemthumbnail, temp.row2.itemdescription};
- }
- }
- }
- }
- public function onClearVariables() {
- temp.clientrvars = clientr.getdynamicvarnames();
- for(temp.var: temp.clientrvars) {
- temp.clientrvars2 = clientr.(@ temp.var).getdynamicvarnames();
- clientr.(@ temp.var) = null;
- for(temp.var2 : temp.clientrvars2){
- temp.clientrvars3 = clientr.(@ temp.var).(@ temp.var2).getdynamicvarnames();
- clientr.(@ temp.var).(@ temp.var2) = null;
- for(temp.var3 : temp.clientrvars3){
- clientr.(@ temp.var).(@ temp.var2).(@ temp.var3) = null;
- }
- }
- }
- }
- public function onCreateItem(realname, createdby){
- if (temp.realname == null || temp.createdby == null) return;
- temp.timecreated = timevar2;
- temp.results = SQL.executeSQL("items", "SELECT * FROM 'item_data' WHERE realname = '" @ temp.realname.escape() @ "'", null, true);
- temp.rows = temp.results.rows;
- if (temp.rows.size() >= 1){
- temp.results = SQL.executeSQL("items", "INSERT INTO 'player_data' VALUES(
- '" @ player.account.escape() @ "',
- '" @ temp.realname.escape() @ "',
- '" @ temp.timecreated.escape() @ "',
- '" @ temp.createdby.escape() @ "',
- '" @ player.account.escape() @ "',
- '0',
- '0'
- )", null, true);
- 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);
- temp.itemid = temp.results.rows;
- temp.itemid = temp.itemid.substring(1);
- onAddItem(temp.realname, temp.itemid[0]);
- }else echo("Hacker Alert?:" SPC player.account SPC "is attempting to create a" SPC temp.realname SPC "and it doesn't exist");
- }
- public function onAddItem(realname, itemid){
- temp.results = SQL.executeSQL("items", "SELECT realname, itemname, itemtype, itemthumbnail, itemdescription FROM 'item_data' WHERE realname = '" @ temp.realname.escape() @ "'", null, true);
- temp.rows = temp.results.rows;
- for (temp.row : temp.rows){
- clientr.item.(@ temp.row.realname).data = { temp.row.realname, temp.row.itemname, temp.row.itemtype, temp.row.itemthumbnail, temp.row.itemdescription};
- }
- temp.results = SQL.executeSQL("items", "SELECT rowid, * FROM 'player_data' WHERE rowid = '" @ temp.itemid.escape() @ "'", null, true);
- temp.rows2 = temp.results.rows;
- for (temp.row : temp.rows2){
- clientr.item.(@ temp.row.realname).(@ temp.row.rowid) = { temp.row.rowid, temp.row.realname, temp.row.socket, temp.row.accountlocked };
- }
- }
- public function onRemoveItem(itemid, realname){
- if(clientr.item.(@ temp.realname).(@ temp.itemid) != null){
- clientr.item.(@ temp.realname).(@ temp.itemid) = null;
- temp.results = SQL.executeSQL("items", "DELETE FROM 'player_data' WHERE rowid = '" @ temp.itemid.escape() @ "'", null, true);
- temp.i = clientr.item.(@ temp.realname).getdynamicvarnames();
- if (temp.i.size() <=2 ){
- clientr.item.(@ temp.realname).data = null;
- }
- } 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");
- }
Advertisement
Add Comment
Please, Sign In to add comment