dirtbikr59
New Member
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:
savePlayerData.sqf
loadPlayerData.sqf
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;
};
niDB - A simple server-side database extension using INI files (and more)
----------------------------------------------------------------------------------------------
Author:
SicSemperTyrannis
Support:
http://raiderbattalion.enjin.com/
How to use:
To use "iniDB" in your mission, install the extension in your ARMA2 or ARMA3 directory by copying the entire "@inidb" folder included in the download to your root directory.
Don't forget to copy over over or create the /db/ folder.
It should look like: /Arma 3/@inidb/iniDB.dll
It should look like: /Arma 3/@inidb/db/
It should look like: /Arma 3/@inidb/Addons/iniDB.pbo
Then in your mission init.sqf, somewhere before you want to use the functions do this:
call compile preProcessFile "\iniDB\init.sqf";
It should be noted that when you install the @inidb folder you can delete the /examples/ directory from there if you please, they serve no purpose in that folder.
You have permission to use, upload or otherwise distribute this as please, but don't hold me responsible for anything.
----------------------------------------------------------------------------------------------
CHANGELOG
13-March-2013
- Module
- Initial Release
- init.sqf
- Initial Release
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;