IniDB - Has anyone checked it out?

Discussion in 'Scripting/Addon Discussion' started by dirtbikr59, Mar 21, 2013.

  1. dirtbikr59

    dirtbikr59 New Member

    Joined:
    Mar 7, 2013
    Messages:
    8
    Likes Received:
    0
    Link to IniDB original post and download file.
    http://forums.bistudio.com/showthre...rver-or-your-local-computer-without-databases

    It uses .ini files to save player information such as position, weapons, clothing, etc... I think this would be a great edition to 404Wasteland 1.06 but SicSemperTyrannis's directions are unclear. How would you call "savePlayerData.sqf" and "loadPlayerData.sqf"? There are 3 Init.Sqf files in Arma 3 (Mission, Server, and client) and I am unsure how and where to call it. Something like this I suppose:

    Code:
    while{true} do {
        {
            if(isPlayer _x) then {
                // Save their data here
            };
        } forEach allUnits;
    };

    savePlayerData.sqf
    Code:
    _unit = _this;
    _puid = getPlayerUID _unit;
     
    if(!isServer) exitWith {};
     
    if(_puid == "_SP_PLAYER_" || _puid == "") exitWith {};
     
    // Allow users with multiple profiles to make new profiles and have new lives
    // We want to use CRC hashes for the name because some people have spaces, weird characters or some other stuff so it's just better this way.
    _profileName = _unit getVariable["profileName", ""];
     
    if(_profileName == "") exitWith {};
     
    _unitFileName = format["%1_%2", _puid, (_profileName call iniDB_CRC32)];
     
    // We will save to the same file, but use different sections for each side
    // We don't want cop uniforms/pos/etc saving over to insurgent or civilian sides
    // This will mean persistent data will carry over _per occupation_, pretty neat right?
    _sectionTitle = format["%1", side _unit];
     
    // Actually save global data
    [_unitFileName, _sectionTitle, "pos", position _unit] call iniDB_write;
    [_unitFileName, _sectionTitle, "loadout", ([_unit] call getLoadout)] call iniDB_write;
    loadPlayerData.sqf
    Code:
    _unit = _this;
    _puid = getPlayerUID _unit;
     
    if(!isServer) exitWith {};
     
    if(_puid == "_SP_PLAYER_" || _puid == "") exitWith {};
     
    _profileName = _unit getVariable["profileName", ""];
     
    if(_profileName == "") exitWith {};
     
    _unitFileName = format["%1_%2", _puid, (_profileName call iniDB_CRC32)];
    _sectionTitle = format["%1", side _unit];
     
    _unit setPos ([_unitFileName, _sectionTitle, "pos", "ARRAY"] call iniDB_read);
     
    [_unit, ([_unitFileName, _sectionTitle, "loadout", "ARRAY"] call iniDB_read)] spawn setLoadout;
     
  2. JoSchaap

    JoSchaap Well-Known Member

    Joined:
    Nov 1, 2012
    Messages:
    219
    Likes Received:
    17
    I reverted back to the persistentDB application from the 404Games forums :p

    its awesome, but abit too much hassle te get it to work
     
  3. Stuff and Junk

    Stuff and Junk Well-Known Member

    Joined:
    Nov 4, 2013
    Messages:
    266
    Likes Received:
    21
    I actually use this in my arma 3 development. I have a mod that i have been adding in "skeleton" features and i think i have this working very well actually.
     
  4. machine

    machine Well-Known Member

    Joined:
    Jan 20, 2013
    Messages:
    297
    Likes Received:
    21
    Does this preform better than using a Database?
     
  5. Stuff and Junk

    Stuff and Junk Well-Known Member

    Joined:
    Nov 4, 2013
    Messages:
    266
    Likes Received:
    21
    Well that sis difficult to say. With a prebuilt DB you just make your table and go but with this you have to create your own variables and public vars as well to make it work. This is a mod for devs more than server owners. It took me a while but i made it work with the help of armaholics and others.

    If you have the patience and time/dedication you could implement this.
     

Share This Page