Jump to content
code34

iniDBI2 - Save and Load data to the server or your local computer without databases!

Recommended Posts

Hi everyone 

 

I am digging into the persistency portion of a project again.

I have managed to save/load pretty much all I wanted to save, again, great mod!

 

Now I am looking into possibilities to remove information from the database.

Scenario: I place a crate. The crate and its inventory is saved. Now I want to remove a create from the database (e.g. if its destroyed).

 

this is how the file looks after saving. it loads properly afterwards:

../db/Caches

 

Spoiler

//UPDATED

[CacheBox_East_Ammo_F691570]
Array="["CacheBox_East_Ammo_F691570","Box_East_Ammo_F",[4168.5,289.5,0],0]"
[CacheBox_East_Ammo_F695570]
Array="["CacheBox_East_Ammo_F695570","Box_East_Ammo_F",[4162.5,283.5,0],0]"
[CacheBox_East_Ammo_F599570]
Array="["CacheBox_East_Ammo_F599570","Box_East_Ammo_F",[4168.5,295.5,0],0]"
[CacheBox_East_Ammo_F554570]
Array="["CacheBox_East_Ammo_F554570","Box_East_Ammo_F",[4156.5,283.5,0],0]"

 

 

I am trying to apply the functions as per included wiki:

 

(DELETED)

I ve been playing around with it for a while, trying to feed in the correct _section, _key, db object params, but I cant delete anything.

I am not sure if its a formatting thing. Writing and reading works well on hosted MP and Dedi.

 

I tried examples like this:

(DELETED)

 

Can anyone help me understand where I am going wrong?

Or can someone share an example of his code? (saved example and how to delete it).

 

Right, sometimes you need to post your question before the brain activates=)

Here is how i got it to work, in case someone is looking for this:

 

delete a section:

Spoiler

//delete a _section
_section = "CacheBox_East_Ammo_F691570";

_inidbi = ["new","Caches"] call OO_INIDBI;

["deleteSection", _section] call _inidbi;

 

 

delete a key:

 

Spoiler

//delete a _key
_section = "CacheBox_East_Ammo_F691570";
_key = "Array";

_inidbi = ["new","Caches"] call OO_INIDBI;

["deleteKey", [_section, _key]] call _inidbi;

 

 

I appreciate any help.

 

Happy to help, if anyone needs assistance.

 

Thanks

VD

  • Like 1

Share this post


Link to post
Share on other sites
On 6/9/2020 at 10:56 AM, Blaq G-Sus said:

Hello!

Lots of good stuff in this thread! This thread got me started and helped me save & load player data on my server. Thanks!

Did anyone manage to save and load vehicle position & state for all vehicles on the map?

I've been trying for a week now, but haven't figured it out yet.

I have been looking at this and have tried to convert it from inidbi to inidbi2:
 

"Here is another brief example of how you could use iniDBi to save vehicle stats:

_vehicleArray = nearestObjects [[0,0,0], ["Car"], 5000];
dataArray = [];
{ _classname = typeOf _x;
_position = getPos _x;
_direction = getDir _x;
_damage = damage _x;
_fuel = fuel _x;
dataArray pushBack [_classname, _position, _direction, _damage, _fuel]; } forEach _vehicleArray; ["Vehicles", "Data", "Cars", dataArray] call iniDB_write;

 

And this is how you would load the stats of each vehicle:

_dataArray = ["Vehicles", "Data", "Cars", "ARRAY"] call iniDB_read;
{ _classname = _x select 0;
_position = _x select 1;
_direction = _x select 2;
_damage = _x select 3;
_fuel = _x select 4;
_vehicle = _classname createVehicle _position; _vehicle setDir _direction; _vehicle setDamage _damage; _vehicle setFuel _fuel; sleep 0.01; } forEach _dataArray;"


Source:


Any constructive feedback is appreciated.

Have a nice day!

Solved!

Vehicles and player data are now being saved in separate databases in my mission. Vehicles are saved by oopdw scripts. (Made by code34).

Here's a URL to my files if anybody wants to use this for vehicle saving on their mission/server:

http://www.mediafire.com/file/angr3or82t5xuyd/carRC.stratis.pbo/file

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×