| Blockland Forums > General Discussion |
| Aoki's CityRPG |
| << < (4/4) |
| Starzy:
--- Quote from: Advanced Bot on March 15, 2014, 10:37:30 PM ---Seems we need a new cityRPG code. --- End quote --- New loving saving/loading system sassy is loving stuff. |
| Renderman:
--- Quote from: Advanced Bot on March 15, 2014, 10:37:30 PM ---Seems we need a new cityRPG code. --- End quote --- The code on the server is pretty crappy, that's why it lags so loving much |
| Crystalwarrior:
Use Port's JSON. No, seriously. |
| Color:
It lags because it takes too much memory, right? If so then I should be able to make it delete/save data on leave, and then re-load on enter. --- Code: --- function God::loadData(%db, %client) { %file = %db.directory@%client.bl_id@".cs"; if(isFile(%file)) { exec(%file); } } function God::saveData(%db, %client) { %file = new FileObject(); %file.openForWrite(%db.directory@%client.bl_id@".cs"); %Data = %db.getData(%client.bl_id); if(findclientbyname(%client.name) == %client) { for(%a = 1; %a <= %db.valueCount; %a++) { %file.writeLine(%db.getName()@".getData("@%client.bl_id@").value"@%db.value[%a]@" = \""@%Data.value[%Data.parent.value[%a]]@"\";"); } } %file.close(); %file.delete(); } function gameConnection::onClientEnterGame(%this) { parent::onClientEnterGame(%this); if(!isObject(CityRPData.getData(%this.bl_id))) { CityRPData.addData(%this.bl_id); } if(isObject(CityRPMini)) { CityRPMini.addMember(%this); } else { CityRP_BuildMinigame(); } // I wouldn't do that if I were you... centerPrint(%this, "<bitmap:Add-Ons/GameMode_CityRP/Iban>", 5); } function gameConnection::onClientLeaveGame(%this) { CityRPData.saveData(%this); CityRPData.getData(%this.bl_id).delete(); if(%this.player) { for(%a = 0; %a < %this.player.getDatablock().maxTools; %a++) { if(!%tools) { %tools = %this.player.tool[%a]; } else { %tools = %tools SPC %this.player.tool[%a]; } } CityRPData.getData(%this.bl_id).valueTools = %tools; } parent::onClientLeaveGame(%this); } --- End code --- |
| EazyE:
welcome to 2014 use json |
| Navigation |
| Message Index |
| Previous page |