zonekiller 175 Posted March 25, 2016 @kludge Try saving everything as an array it works for me as it will at least return an empty array if empty playerHealth = ["read", ["playerData", "health", "ARRAY"]] call _inidbi; ["write", [_playerData, "health", [damage player]]] call _inidbi; if (count playerHealth > 0) then {player setdamage (playerHealth select 0)} Share this post Link to post Share on other sites
baizhu45 0 Posted March 29, 2016 @code34 thanks for ur answer :D. But i will stick with one database as it saves much time. Here is my Problem, in Server side i cant check existance of the "Key". // Create the Database _inidbi = ["new", "databaseabc"] call OO_INIDBI; //Check if playerdata exists ("playerData" is the section. _PlayerUID is the key and it is already received from the client) _playerDataExists = ["read", ["playerData", _playerUID]] call _inidbi; systemChat str _playerDataExists; systemChat _playerDataExists; So if no data is found under the "key": _playerUID, it will return false as boolen or "false" as string. So _playerDataExists = false or "false". But after i run it i cant see any systemchat message.... I also tried with Array: _playerDataArray = ["read", ["playerData", _playerUID, "ARRAY"]] call _inidbi; systemChat str _playerDataArray; if its empty, i should get a [] in systemchat , but i still got nothing.... Have i made any mistake? Im sure i do.... Share this post Link to post Share on other sites
Crielaard 435 Posted March 31, 2016 Is there someone that allready made some sort of MP player persistent script with this? I dont want to waste time reinventing the wheel. Share this post Link to post Share on other sites
code34 248 Posted April 3, 2016 @code34 thanks for ur answer :D. But i will stick with one database as it saves much time. Here is my Problem, in Server side i cant check existance of the "Key". // Create the Database _inidbi = ["new", "databaseabc"] call OO_INIDBI; //Check if playerdata exists ("playerData" is the section. _PlayerUID is the key and it is already received from the client) _playerDataExists = ["read", ["playerData", _playerUID]] call _inidbi; systemChat str _playerDataExists; systemChat _playerDataExists; So if no data is found under the "key": _playerUID, it will return false as boolen or "false" as string. So _playerDataExists = false or "false". But after i run it i cant see any systemchat message.... I also tried with Array: _playerDataArray = ["read", ["playerData", _playerUID, "ARRAY"]] call _inidbi; systemChat str _playerDataArray; if its empty, i should get a [] in systemchat , but i still got nothing.... Have i made any mistake? Im sure i do.... you should use this instead _playerDataArray = ["read", ["playerData", _playerUID, false]] call _inidbi; return false if nothing is found Share this post Link to post Share on other sites
code34 248 Posted April 3, 2016 Is there someone that allready made some sort of MP player persistent script with this? I dont want to waste time reinventing the wheel. you can look at first at this place: https://forums.bistudio.com/topic/162765-oo-pdw-oriented-object-persistent-data-world/ you will found easy to start system :) 2 Share this post Link to post Share on other sites
GameBoss 0 Posted April 6, 2016 Trying to create new db comb. _inidbi = ["new","myDB"] call OO_INIDBI; its not working and return "any" in logs and: Error position: <OO_INIDBI; We are trying to use it on ArmA 2 : OA Share this post Link to post Share on other sites
code34 248 Posted April 7, 2016 hi Gameboss, Inidbi2 were not done for A2 :( First , i think you should explicit call compile the class has it was done with inidbi with A2 ex: call compile preProcessFile "\inidbi\init.sqf"; But, it will not solve all compatibilities problems (ex your buffer size should not execeed 4K), give me a feed back about the problem that happens. Share this post Link to post Share on other sites
GameBoss 0 Posted April 7, 2016 If its not compatible then we will use simple @iniDB addon. We dont have much time to remake whole script. Share this post Link to post Share on other sites
willithappen 194 Posted April 11, 2016 Hi Code,I'm having some trouble with a rather trivial locality issue.I'm trying to output some simple data. That being the results of the "HandleDamage" event handler and the results of "GetIn" event handlers. I have everything down pat except for getting the data to transfer to the servers .ini.in my initServer I have the following WIHLogs_TK_ini = ["new","WIHLogs_TK"] call OO_INIDBI; WIHLogs_Veh_ini = ["new","WIHLogs_Veh"] call OO_INIDBI; // EH on Vehicles [] spawn{ while {true} do { { if (!(_x getVariable ["added_EV",false])) then { _x addEventHandler ["GetIn", {[_this select 0,_this select 1,_this select 2] remoteExecCall ["WIH_LogVEH", 2]}]; _x setVariable ["added_EV",true]; }; }forEach vehicles; sleep 10; }; }; // EH on Players [] spawn { while {true} do { { if (!(_x getVariable ["Added_TKEV",false])) then { _x addEventHandler ["HandleDamage",{[_this select 0,_this select 1,_this select 2,_this select 3,_this select 4] remoteExecCall ["WIH_LogTK", 2]}]; _x setVariable ["Added_TKEV",true]; }; }forEach playableUnits; sleep 10; }; }; // Calls WIH_LogTK = { _player = _this select 0; //Player _type = _this select 1; _damageAmt = _this select 2; // Amount of Damage _source = _this select 3; //By what _proj = _this select 4; _playerID = getPlayerUID _player; _playerName = name _player; _culpritID = getPlayerUID _source; _culpritName = name _source; if !(_source in PlayableUnits) exitWith {}; if (isNil "countKeyTK") then {countKeyTK = 0;}; _Print = format["(%2/%3) took [%4 - Damage] from (%5/%6) (%8)",_time,_playerName,_playerID,_damageAmt,_culpritName,_culpritID,_type,_proj]; countKeyTK = countKeyTK + 1; ["write",[_culpritName,CountKeyTK,_Print]] call WIHLogs_TK_ini; }; WIH_LogVEH = { // Script Grab _player = _this select 2; //player full class _playerName = name _player; //Easy read playername _seat = _this select 1; //Seat if (side _player == WEST) then { _veh = _this select 0; // Vehicle classname _veh = getText (configfile >> "CfgVehicles" >> typeof _veh>> "displayName"); _Print = format["%1 Enters (%3) in [%2]",_playerName,_seat,_veh]; if (isNil "countKeyVeh") then {countKeyVeh = 0;}; countKeyVeh = countKeyVeh + 1; ["write",[_playerName,CountKeyVeh,_Print]] call WIHLogs_Veh_ini; }; }; The above works fine in hosted multiplayer, however, once its on a dedicated server, I get no luck.I have tried a few other ways, that being spreading it across into .sqf files etc, but this method in the initServer seems to be what SHOULD work by trying to keep as much as possible serverSide. Any Idea as to why the .ini files do not create on the servers @inidbi2/db/ ?? Share this post Link to post Share on other sites
code34 248 Posted April 11, 2016 hi willithappen first at all, did you check if simple command works like getVersion and put the result into arma3 logs with a diag_log ? diag_log format ["version : %1", "getVersion" call _inidbi]; Share this post Link to post Share on other sites
willithappen 194 Posted April 13, 2016 Hi Code, The error I receive is the following when doing: I get the following when calling the either of the below: WIHLogs_TK_ini = ["new","WIHLogs_TK"] call OO_INIDBI;WIHLogs_Veh_ini = ["new","WIHLogs_Veh"] call OO_INIDBI; "version : Inidbi: 2.05 Dll: 2.05". However, I still do not have the .ini files creating Share this post Link to post Share on other sites
Persian MO 82 Posted April 13, 2016 I made a mission few months ago, saving worked fine but today i tried the mission and the save/load not working anymore. Something has been changed? Here is codes. initserver: call compile preProcessFile "\inidbi\init.sqf"; saveVeh.sqf private ["_unit","_near","_object"]; _unit = _this select 0; _near = nearestObjects [ blueGarage1, ["Land","Air"], 10]; _object = _near call BIS_fnc_selectRandom; //if (_object == "") exitWith {["No asset at garage area...","hint",_unit,false] call BIS_fnc_MP;}; _Profile = format["%1", getPlayerUID _unit]; _landCar = [_Profile, "Vehicles", "typeOf", typeOf _object] call iniDB_write; deletevehicle _object; ["The asset has been saved...","hint",_unit,false] call BIS_fnc_MP; it give me a error about not running indbi. i tried some solution like permission in windows to dll files and others. Still im not sure why the code not working anymore!!! Share this post Link to post Share on other sites
code34 248 Posted April 13, 2016 Hi Code, The error I receive is the following when doing: I get the following when calling the either of the below: WIHLogs_TK_ini = ["new","WIHLogs_TK"] call OO_INIDBI; WIHLogs_Veh_ini = ["new","WIHLogs_Veh"] call OO_INIDBI; "version : Inidbi: 2.05 Dll: 2.05". However, I still do not have the .ini files creating wow, strange, where do you look for it ? Share this post Link to post Share on other sites
code34 248 Posted April 13, 2016 I made a mission few months ago, saving worked fine but today i tried the mission and the save/load not working anymore. Something has been changed? Here is codes. initserver: call compile preProcessFile "\inidbi\init.sqf"; saveVeh.sqf private ["_unit","_near","_object"]; _unit = _this select 0; _near = nearestObjects [ blueGarage1, ["Land","Air"], 10]; _object = _near call BIS_fnc_selectRandom; //if (_object == "") exitWith {["No asset at garage area...","hint",_unit,false] call BIS_fnc_MP;}; _Profile = format["%1", getPlayerUID _unit]; _landCar = [_Profile, "Vehicles", "typeOf", typeOf _object] call iniDB_write; deletevehicle _object; ["The asset has been saved...","hint",_unit,false] call BIS_fnc_MP; it give me a error about not running indbi. i tried some solution like permission in windows to dll files and others. Still im not sure why the code not working anymore!!! yes :) you use INIDBI1 and now it s INIDBI2 Share this post Link to post Share on other sites
willithappen 194 Posted April 13, 2016 wow, strange, where do you look for it ? Looking for the files that are created? @inidbi2/db/ Nothing... Very confused myself as to what's going on. I'm still trying different things, If I have any success I'll let you know. As far as i'm aware, it's a locality issue with saving from the client to the server etc as it's in eventHandlers running on a client for the handleDamage. The vehicles EH SHOULDN'T have that issue however, but it is... Share this post Link to post Share on other sites
code34 248 Posted April 13, 2016 yes, try to make think simpliest for test. Just put a write instruction in your initserver and looks what happens :) Share this post Link to post Share on other sites
Persian MO 82 Posted May 18, 2016 Need some help. I'm trying to create a save inventory box for all players.here is what i got until now. initplayerlocal.sqf act = player addAction ["open box", "openbox.sqf",[],0,false,true,"","((_target distance _this)<1)"]; player addEventhandler ["Respawn", { act = player addAction ["open box", "openbox.sqf",[],0,false,true,"","((_target distance _this)<1)"]; }]; openbox.sqf _unit = _this select 1; _unit removeAction act; _Storage = "Box_NATO_AmmoVeh_F" createVehicle getpos _unit; _Storage addAction ["save box", "savebox.sqf"]; _Profile = getPlayerUID _unit; _inidbi = ["new", _Profile] call OO_INIDBI; _items = ["read", ["box", "locker", "ARRAY"]] call _inidbi; if(!(_items isEqualTo [])) then { { _subArr = _items select _forEachIndex; _weps = _subArr select 0; _wepsCount = _subArr select 1; _mags = _subArr select 2; _magsCount = _subArr select 3; _itemss = _subArr select 4; _itemsCount = _subArr select 5; _backpacks = _subArr select 6; _backpacksCount = _subArr select 7; { _Storage addWeaponCargoGlobal[_x,_wepsCount select _forEachIndex]; } forEach _weps; { _Storage addMagazineCargoGlobal[_x,_magsCount select _forEachIndex]; } forEach _mags; { _Storage addItemCargoGlobal[_x,_itemsCount select _forEachIndex]; } forEach _itemss; { _Storage addBackpackCargoGlobal[_x,_backpacksCount select _forEachIndex]; } forEach _backpacks; } forEach _items; }; savebox.sqf _target = _this select 0; _unit = _this select 1; _Profile = getPlayerUID _unit; _saveArray = []; _guns = getWeaponCargo _target; _mags = getMagazineCargo _target; _items = getItemCargo _target; _backpacks = getBackpackCargo _target; _subArray = _guns + _mags + _items + _backpacks; _saveArray set [count _saveArray,_subArray]; _inidbi = ["new", _Profile] call OO_INIDBI; ["write", ["box", "locker", _saveArray]] call _inidbi; act = player addAction ["open box", "openbox.sqf"]; deletevehicle _target; because the script running from player local , it won't work on server. i tried some mp functions for that codes are for inidbi part. how to change this to get it work? Share this post Link to post Share on other sites
code34 248 Posted May 18, 2016 hi, What is exactly the problem ? Share this post Link to post Share on other sites
Persian MO 82 Posted May 18, 2016 Hi. openbox.sqf and savebox.sqf are client side scripts.I used inidbi code in there,not working on dedicated server.Im looking for a way to execute those lines on server. Tried BIS_fnc_MP to execute inidbi part code lines on server but looks like not working. anyway, i want to add a option to all players to have a storage box with them by addaction, so players can spawn the box and save their weapons/items, .... in the storage box. i search and read forum and i don't have better way for save/load until now. maybe i should try OO PDW if my codes will not work at all for dedicated server! Share this post Link to post Share on other sites
code34 248 Posted May 18, 2016 Inidbi2 works with windows server. Do you use one ? :) Share this post Link to post Share on other sites
VanceMan 0 Posted June 11, 2016 Hi code34! I'm pretty new to scripting, I'm just finishing my first gamemode and I'm trying to get the database for my server up and running. I can't seem to understand how to actually get inidbi2 running.. I'm using the MCC4 addon for role selection and when I select "enable roles" in the MCC4 module, I get an error message that says "inidb is not running". SO my question is how do I get inidb running? I have it installed server side in my server root folder, and I have added it to my startup parameters in a .par file. Do you have an idea of how to get MCC4 role selection and your awesome inidbi2 to work together? I would reeeeeally appreciate some help, I've been at it for a week now and not getting anywhere :(. Thanks code 34! :) Share this post Link to post Share on other sites
code34 248 Posted June 12, 2016 sorry :( i dont know how MCC4 module interract with inidb2 You should check first if MCC4 don't use inidb1 :) if not, load inidbi2 and test if the getVersion function works. _version = "getVersion" call _inidbi; hintc format ["%1", _version]; Share this post Link to post Share on other sites
S.Crowe 142 Posted July 5, 2016 Just stopped by to say awesome mod. May i suggest an edit? Check to make sure the _x in _data is definied if !(isNil "_x") then { .... }; The reason I suggest this, is because if a nil item gets passed, an error is thrown at I believe this location starting line 195 PRIVATE FUNCTION("array", "parseArray"){ private ["_data", "_exit", "_array"]; _exit = _this select 0; _data = _this select 1; { if!(typename _x in ["BOOL", "ARRAY", "STRING", "SCALAR"]) then { _exit = true; }; if(typename _x == "ARRAY") then { _array = [_exit, _x]; _exit = MEMBER("parseArray", _array); }; sleep 0.0001; }foreach _data; _exit; }; Share this post Link to post Share on other sites
code34 248 Posted August 5, 2016 hi S.Crowe Thanks :) im not sure to release a new version cause i dont have another improvement to do in dll part. but if i release a new one , i take in account your feedback :) Share this post Link to post Share on other sites
Mr.jizz 9 Posted September 21, 2016 Does "call inidb" work on client if the mod is loaded only on the server so clients dont need to load this mod or do you have to set it up so clients send and recieve data from the server. I want to be able to only have this mod server side, i have inidb1 setup on local hosted server and it works fine but it doesnt work the same on dedicated? Share this post Link to post Share on other sites