Jump to content
Sign in to follow this  
SicSemperTyrannis

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

Recommended Posts

I think it's execVM "rundatabase.sqf" and not spawn.

If i'm not wrong, i think there's an error in the iniDB_read fnc.

Should be:

	if((count _this) > 3) then {
	_type = _this select 3;
	_data = [_data, _type] call iniDB_Datarizer;
};

Not:

if((count _this) > 2) then {
	_type = _this select 3;
	_data = [_data, _type] call iniDB_Datarizer;
};

Hi guys,

Thank you very much for your help. I got it to work only half way. It saves scores in datatabse properly. I can see: myDatabaseFile created and proper UID , player name and score inside. What I can't get to work is retrieve scores when server restarts. It looks like no data are loaded into mission.

Any help ? thx, pawel

---------- Post added at 09:35 PM ---------- Previous post was at 09:05 PM ----------

Hi,

I don't have anything in my missions folders, I am running Got Wasteland sandbox.

Don't see where to put the call compile preProcessFile "\iniDB\init.sqf";

Thanks

The best option for you is to find wasteland server with @inidb mod and download their mission (when joing server game saves mission in missioncache folder). I saw a few running out there with that database.

Share this post


Link to post
Share on other sites

This system is very much like, but here you might show for neophytes in scripts like me and the other steps to follow step by step to the installation file creation to add to the server? and even if it is in youtube!

thank you for your work!

Share this post


Link to post
Share on other sites

Is there anyone actively working with this still? I need some help getting it up and running on a altis life server if anyone got time to assist me a bit, I've got skype,steam,TS3 you name it! Willing to DL any software you're using to contact you :)

Thanks people,

Nex

Share this post


Link to post
Share on other sites

I had to fix inidb for my personnal usage. As there is no new version since a long while, i will release a new version as a fork of the original version.

Inidb(i) v1.1:

http://forums.bistudio.com/showthread.php?167927-iniDBI-Save-and-Load-data-to-the-server-or-your-local-computer-without-databases!

Edited by code34

Share this post


Link to post
Share on other sites

So I have a very larg problem here,

Everything works fine on my side, BUT if a player joins my server it wont load any files or write them as it gives them error to the code, I've tried to fix this a few times now but nothing I do helps it. I've dubble checked the ini file, my saving saves writes without any problem, it wont write or load for other players besides me.... Any ideas?

Error in expression <erUID player, "Account", cash] call iniDB_write;
["Data", getPlayerUID p>
 Error position: <iniDB_write;
["Data", getPlayerUID p>
 Error Undefined variable in expression: inidb_write
File mpmissions\__CUR_MP.cherarus\Scripts\saveData.sqf, line 5

Seriusly? How hard can it be to answer me why it is only saving for me and not? A fix would be awesome before I kill my PC or something, it's driving me crazy it's been 48 hours now of same stupied error. I'll pay you if thats the case! Someone please tell me what is wrong and how I can fix it!!

Edited by Ben_Sherman

Share this post


Link to post
Share on other sites
can someone help me with this? i get this error always script inidb init sqf not found

im kinda new to arma 2 servers

You got @inidb activated in your -mod parameter? or expantions?

If not you must activate it.

Also post the codes where it's loading the inidb init.sqf file from.

Share this post


Link to post
Share on other sites
You got @inidb activated in your -mod parameter? or expantions?

If not you must activate it.

Also post the codes where it's loading the inidb init.sqf file from.

it tries to load it from the inidb folder and i dont have a init file cuz idk what init file there needs to be

and i had that -mod@ inidb or something like that.

Share this post


Link to post
Share on other sites
it tries to load it from the inidb folder and i dont have a init file cuz idk what init file there needs to be

and i had that -mod@ inidb or something like that.

Okey, well the init.sqf file your asking about is loaded from @inidb/addons/iniDB.pbo it's inside that mod folder which is for server side only, check so you have those files and make sure your @inidb is loaded correct

Share this post


Link to post
Share on other sites

First off just wanted to say thanks inidb works great 90% of the time but sometimes when a player joins who already has a db file looses all his progress everything is reset to 0. I think I kinda know where the bug is but have no idea how to fix it

Server rpt

Error in expression <_type == "ARRAY") then {
_string = call compile _string;
} else {
if((_type == ">
 Error position: <compile _string;
} else {
if((_type == ">
 Error compile: Type Bool, expected String

I believe its referring to the inidb pbo init file more specifically the iniDB_Datarizer function

iniDB_Datarizer = {
private["_string", "_type"];
_string = _this select 0;
_type = _this select 1;

if(_type == "ARRAY") then {
	_string = call compile _string;
} else {
	if((_type == "SCALAR") || (_type == "NUMBER")) then { // "NUMBER" is less confusing for new folks
		_string = parseNumber _string;
	};
};

_string
};

This is my load Function

abc_LoadplayerPos = {
   private ["_loadpos"];
   _loadpos = _this select 0;
   _Profile = format["%1", getPlayerUID _loadpos];
_SavXP = [_Profile, "playerData", "playerxp", "ARRAY"] call iniDB_read;
if (isNil"_SavXP") exitWith 
{
hint formattext ["%1 we could not find your save Data, Use the noticeboard in your base to get the Game and Server info! ", _loadpos];
_loadpos setVariable ["playerxp", 0, true];
};
_loadpos setVariable ["playerxp", _SavXP, true];
hint formattext ["%1 your save data has successfully been loaded", _loadpos];
};

and my save function

if(isDedicated) then {
while{true} do {
sleep 90;
["","ASH_Function"] spawn BIS_fnc_MP;
{
	if(isPlayer _x) then {

_playerxp = _x getvariable ["playerxp", 0];
_Profile = format["%1", getPlayerUID _x];
[_Profile, "playerData", "position", position _x] call iniDB_write;
[_Profile, "playerData", "Playername", name _x] call iniDB_write;
[_Profile, "playerData", "playerxp", _playerxp] call iniDB_write;
/* //Not need for this mission type
[_Profile, "playerData", "magazines", magazines _x] call iniDB_write;
[_Profile, "playerData", "weapons", Weapons _x] call iniDB_write;
[_Profile, "playerData", "weapons1", SecondaryWeapon _x] call iniDB_write;
[_Profile, "playerData", "vest", vest _x] call iniDB_write;
[_Profile, "playerData", "uniform", uniform _x] call iniDB_write;
[_Profile, "playerData", "headgear", headgear _x] call iniDB_write;
[_Profile, "playerData", "items", items _x] call iniDB_write;
*/	
		};
	} forEach allUnits;
	["","ASCH_Function"] spawn BIS_fnc_MP;
};
};

Any help at all would be greatly appreciated. If you need any more info please let me know.

Thanks

Share this post


Link to post
Share on other sites

terrence, it's because of the

_loadpos = _this select 0;

That is local to the client. It works for you because you are the server which has iniDB and the client.

Share this post


Link to post
Share on other sites

Well its a hosted server and it works 90% of the time for all clients. Well I have all players calling on load on during init. I realize that _loadpos is local and should represent the player calling on it. Just wondering why it works 9 times out of 10 for everybody but once and awhile it just fails :(

Edited by terrence

Share this post


Link to post
Share on other sites

I think I found the problem. I was trying to read playerxp as a array when it should have been a Scalar. Not sure why this wouldnt give me and error everytime but Ill do some testing and post my results

Well that didnt fix it. I logged in and out 8 times and on the last one it didnt load my stats. But I relogged quickly and the load worked. Got two errors in the rpt:

Error in expression < (_type == "NUMBER")) then { 
_string = parseNumber _string;
};
};

_string
};

>
 Error position: <parseNumber _string;
};
};

_string
};

>
 Error parsenumber: Type Bool, expected String

Error in expression <_key];
_data = call compile _data;

if((_data select 0)) then {
_data select 1
}>
 Error position: <_data select 0)) then {
_data select 1
}>
 Error Undefined variable in expression: _data
Error in expression <NUMBER")) then { 
_string = parseNumber _string;
};
};

_string
};

iniDB_read =>
 Error position: <_string;
};
};

_string
};

iniDB_read =>
 Error Undefined variable in expression: _string
Error in expression <then {
_type = _this select 3;
_data = [_data, _type] call iniDB_Datarizer;
};

>
 Error position: <_data, _type] call iniDB_Datarizer;
};

>
 Error Undefined variable in expression: _data
Error in expression < 
_string = parseNumber _string;
};
};

_string
};

iniDB_read = {
private["_fil>
 Error position: <_string
};

iniDB_read = {
private["_fil>
 Error Undefined variable in expression: _string
Error in expression <_data, _type] call iniDB_Datarizer;
};

_data
};

iniDB_write = {
private["_file>
 Error position: <_data
};

iniDB_write = {
private["_file>
 Error Undefined variable in expression: _data

Edited by terrence
Uploading Results

Share this post


Link to post
Share on other sites

Look at it from this perspective. With that script, the client with the local variable _loadpos is being asked to execute the iniDB functions. Only the server has the addon installed, not the clients. Therefore, it's impossible for the clients to be able to load their own stats if they don't have the functions. If you are the server then that will work for yourself.

Share this post


Link to post
Share on other sites

Just wondering why it works 90% for all clients. If the players couldnt call iniDB function when the init through the server wouldn't it fail everytime? So are you suggesting having the load function to be called on from onplayerconnected.sqf ran by the server? BTW I upgraded to inidbi and it seems to have fixed the problem.

Share this post


Link to post
Share on other sites

@ 1PARA{God-Father}

Yes it does. I have a vehicle save system on my mission for an RPG Mod.

Also, a suggestion to the author: objNull support? I tried inputitng objNull to write to the db, and it wrote "<NULL-object>" instead

Edited by eagledude4

Share this post


Link to post
Share on other sites

Hey SicSemperTyrannis :)

I've got a question: I'm storing a large array via iniDB, which actually works. But when I read it, iniDB throws a syntax error because the line is probably too long. Is there a possibility to enlarge this maximum row length, or do I have to split it into multiple lines?

EDIT: I guess I found a bug...

Look at your lines at iniDB_read:

iniDB_read = {
private["_file", "_sec", "_key", "_type", "_data"];
_file = _this select 0;
_sec = _this select 1;
_key = _this select 2;
_data = [_file, _sec, _key] call iniDB_readRaw;

if((count _this) > 2) then {
	_type = _this select 3;
	_data = [_data, _type] call iniDB_Datarizer;
};

_data
};

Shouldn't be it "if ((count _this) > 3) then {"?

Edited by florianmuellerCH

Share this post


Link to post
Share on other sites

I downloaded the inidb and it works but i dont know how i can load and save the player position and gear.

Share this post


Link to post
Share on other sites

I am making an island life server and i require a Developer who can help us with fixing stat and also vehicle saving and also anything else.

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
Sign in to follow this  

×