Jump to content

Recommended Posts

"/" for subfolders. It works when saving. apparently inidb2 does not like subfolders.
it is a pity.

Share this post


Link to post
Share on other sites

@LoOni3r, iniDBI2 is simple solution. If you need more complex one -- use databases.

Share this post


Link to post
Share on other sites

that works with the subfolders.

There was a problem I did not notice.

 

example:
_playerpos = getPosASL _x;
_setplayerpos = ["write", ["GENERAL", "POS", _playerpos]] call _inidbi;

database:
[GENERAL]
POS="[36615.8,12251.3,5.27095]"

 

this works:

_playerpos = getPosASL _x;
_setplayerpos = ['',_playerpos,''] joinString "";
_inidbifolderplayerdata = ["australia-survival\playerdata\",_playeruid] joinString "";
_inidbi = ["new", _inidbifolderplayerdata] call OO_INIDBI;
_setplayerpos = ["write", ["GENERAL", "POS", _setplayerpos]] call _inidbi;

database:
[GENERAL]
POS=""[36615.8,12251.3,5.27095]""


output worked

 

Share this post


Link to post
Share on other sites
19 minutes ago, LoOni3r said:

that works with the subfolders

Cool. Didn't know this.

 

21 minutes ago, LoOni3r said:

There was a problem I did not notice.

 


example:
_playerpos = getPosASL _x;
_setplayerpos = ["write", ["GENERAL", "POS", _playerpos]] call _inidbi;

database:
[GENERAL]
POS="[36615.8,12251.3,5.27095]"

 

Very strange -- it works for me.

Share this post


Link to post
Share on other sites

How do you save the loadout?

 

he does not read the loadout with me. save works.

 

{
_playerloadout = getUnitLoadout _x;
_setplayerloadout = ['',_playerloadout,''] joinString "";


_read = ["read", ["GENERAL", "LOADOUT"]] call _inidbi;
_read remoteExec ["systemChat"];

}foreach playableUnits;	

Database:
[GENERAL]
LOADOUT=""[[],[],[],["U_C_man_sport_2_F",[["FirstAidKit",1],["Chemlight_red",1,1],["Chemlight_blue",1,1],["SmokeShellRed",1,1],["SmokeShellYellow",1,1]]],[],[],"","",[],["","","","","",""]]""

no output.

Share this post


Link to post
Share on other sites
6 hours ago, LoOni3r said:

How do you save the loadout?

["write", [_side, "loadout", _loadout]] call _inidbi;

where _loadout is array returned by getUnitLoadout command.

In INI file it looks like

loadout="[...]"

So, I don't convert array (loadout) to string.

Share this post


Link to post
Share on other sites

saving loadout works. just do not retrieve that.
It can wait.

 

missionNamespace does not work on my test server. do you have to add a start parameter or something else?

 

 

edit:

 

 

I looked at your example and tried to take over.

Unfortunately, I still do not understand how data from server to client sends

Share this post


Link to post
Share on other sites
6 hours ago, LoOni3r said:

missionNamespace does not work on my test server. do you have to add a start parameter or something else?

Yes, I use startup parameter:

Quote

arma3server_x64.exe -serverMod=@inidbi2

But this does not affect accessibility to missionNamespace.

 

6 hours ago, LoOni3r said:

I looked at your example and tried to take over.

Unfortunately, I still do not understand how data from server to client sends

Player sends request to server (using publicVariableServer command), server retrieves data from database and sends them to player (using publicVariableClient command).

Share this post


Link to post
Share on other sites

"-serverMod=@inidbi2" I have, that works too

 

missionNamespace about eden editor -> multiplayer it works.

it does not work over server.

 

I wrote the following for the first test (I know it is not optimal but for testing it is enough for now):

initPlayerLocal:
_playeruid = getPlayerUID player;
_setplayerconnected = [_playeruid,"connected"] joinString "";
missionNamespace setVariable [_setplayerconnected,1];

sleep 10;

_playerpos = [_playeruid,"pos"] joinString "";
_playerpos = missionNamespace getVariable _playerpos;
_playerpos = parseSimpleArray _playerpos;

_playerpos deleteAt 2;
_playerpos pushback 0;
player setPos _playerpos;

_playerdir = [_playeruid,"dir"] joinString "";
_playerdir = missionNamespace getVariable _playerdir;
_playerdir = parseNumber _playerdir;
player setDir _playerdir;


initServer:
while {true} do{

	// Player Data
	{
		_playeruid = getPlayerUID _x;
		_inidbifolderplayerdata = ["australia-survival\playerdata\",_playeruid] joinString "";
		_inidbi = ["new", _inidbifolderplayerdata] call OO_INIDBI;
			
		_playerconnected = [_playeruid,"connected"] joinString "";
		_playerconnected = missionNamespace getVariable _playerconnected;


		if (_playerconnected == 1) then {
"1" remoteExec ["systemChat"];

			_playerpos = ["read", ["GENERAL", "POS"]] call _inidbi;
			_setplayerpos = [_playeruid,"pos"] joinString "";
			missionNamespace setVariable [_setplayerpos,_playerpos];


			_playerdir = ["read", ["GENERAL", "DIR"]] call _inidbi;
			_setplayerdir = [_playeruid,"dir"] joinString "";
			missionNamespace setVariable [_setplayerdir,_playerdir];

			_setplayerconnected = [_playeruid,"connected"] joinString "";
			missionNamespace setVariable [_setplayerconnected,0];

			sleep 30;
			
		}else{	// Player Connect

			_playerpos = getPosASL _x;
			_setplayerpos = ['',_playerpos,''] joinString "";
			_playerdir = getDir _x;
			_setplayerdir = ['',_playerdir,''] joinString "";
			_playerloadout = getUnitLoadout _x;
//			_time = "getTimeStamp" call _inidbi;	// <- not working


//			_setplayerdate = ["write", ["GENERAL", "TIME", _time]] call _inidbi;
			_setplayerpos = ["write", ["GENERAL", "POS", _setplayerpos]] call _inidbi;
			_setplayerdir = ["write", ["GENERAL", "DIR", _setplayerdir]] call _inidbi;
//			_setplayerloadout = ["write", ["GENERAL", "LOADOUT", _setplayerloadout]] call _inidbi;
			_setplayerloadout = [_playeruid,"loadout"] joinString "";
			missionNamespace setVariable [_setplayerloadout,_playerloadout];

"2" remoteExec ["systemChat"];


		};	// Player Connect ende



		}foreach playableUnits;	
	// Player Data ende




sleep 3;
};

 

Share this post


Link to post
Share on other sites

@LoOni3r, your problem is that client and server has separated mission namespaces when mission hosted on dedicated server (but shared when hosted server).So I used publicVariableXXX commands to send data to/from client/server.

Share this post


Link to post
Share on other sites

ok, if missionNamespace server and client are disconnected, it's clear that it's not working.
my test server I have local hosted on my PC.
can I allow the server missionNamespace without publicVariable?

Share this post


Link to post
Share on other sites
14 hours ago, LoOni3r said:

can I allow the server missionNamespace without publicVariable?

No if your mission is hosted on dedicated server.

 

Here is extended example, that works both on player's host or dedicated server.

initPlayerLocal.sqf:

applyPlayerData = {...};

waitUntil {time > 0};

playerDataRequest = [player];

if (isServer) then {
    ["playerDataRequest", playerDataRequest] call playerDataRequestHandler;
} else {
    publicVariableServer "playerDataRequest";

    playerDataRequest = nil;
};

_time = time + 10;

waitUntil {!(isNil "playerData") or {_time >= time}};

if (!(isNil "playerData")) then {
    playerData call applyPlayerData;

    playerData = nil;
};

initServer.sqf:

playerDataRequestHandler = {
    params ["_varName", "_varValue"];

    missionNamespace setVariable [_varName, nil];

    _varValue params ["_player"];

    _inidbi = ["new", getPlayerUID _player] call OO_INIDBI;

    // Read player data and form playerData variable

    ["delete", _inidbi] call OO_INIDBI;

    if (_player == player) then {
        playerData call applyPlayerData;
    } else {
        (owner _player) publicVariableClient "playerData";
    };

    playerData = nil;
};

"playerDataRequest" addPublicVariableEventHandler {call playerDataRequestHandler};

 

Share this post


Link to post
Share on other sites

initPlayerLocal.sqf:

applyPlayerData = {
};

waitUntil {time > 0};

playerDataRequest = [player];

if (isServer) then {
    ["playerDataRequest", playerDataRequest] call playerDataRequestHandler;
} else {
    publicVariableServer "playerDataRequest";

    playerDataRequest = nil;
};

_time = time + 10;

waitUntil {!(isNil "playerData") or {_time >= time}};

if (!(isNil "playerData")) then {
    playerData call applyPlayerData;
    playerData = nil;
};

initServer.sqf:

playerDataRequestHandler = {
    params ["_varName", "_varValue"];

    missionNamespace setVariable [_varName, nil];

    _varValue params ["_player"];

// Start
	_pljoin = [name _player, " join the Game"] joinString "";
	_pljoin remoteExec ["systemChat"];

	_playeruid = getPlayerUID _player;
	_inidbifolderplayerdata = ["australia-survival\playerdata\",_playeruid] joinString "";
	_inidbi = ["new", _inidbifolderplayerdata] call OO_INIDBI;

	_playerpos = ["read", ["GENERAL", "POS"]] call _inidbi;
	_setplayerpos = [_playeruid,"pos"] joinString "";
//	missionNamespace setVariable [_setplayerpos,_playerpos];


	_playerdir = ["read", ["GENERAL", "DIR"]] call _inidbi;
	_setplayerdir = [_playeruid,"dir"] joinString "";
//	missionNamespace setVariable [_setplayerdir,_playerdir];


// Ende

    if (_player == player) then {
        playerData call applyPlayerData;
    } else {
        (owner _player) publicVariableClient "playerData";
    };

    playerData = nil;
};

"playerDataRequest" addPublicVariableEventHandler {call playerDataRequestHandler};

 

how do I get _setplayerpos and _setplayerdir in the initPlayerLocal.sqf read?

 

I tried a lot, example:

 

_playerpos = ["playerDataRequest", _playerpos] call playerDataRequestHandler;
hint str[_playerpos];

looks logical to me, but did not work

Share this post


Link to post
Share on other sites

@LoOni3r, I wrote this comment:

Quote

Read player data and form playerData variable

You read player data, but you didn't form playerData variable. You try read variables on client side from mission namespace, but this will not work on dedicated server!

 

As I wrote you need to form playerData variable:

playerData = [
    ["read", ["GENERAL", "DIR"]] call _inidbi,
    ["read", ["GENERAL", "POS"]] call _inidbi
];

Next you send playerData variable to client and use applyPlayerData function:

applyPlayerData = {
    params ["_playerdir", "_playerpos"];

    player setDir _playerdir;
    player setPos _playerpos;
};

 

Share this post


Link to post
Share on other sites

thank you for the code.

 

the server does not send me the data to the client

 

eden editor -> multiplayer it works.

 

I've deleted ale scripts for testing.

except that the system chat is no longer displayed, nothing has changed.

 

So it can only be on the server.

here's my config:

start.bat:
@echo off

start arma3server_x64.exe  -port=2302 "-config=config.cfg" "-profiles=profile" -name=server -filePatching "-servermod=mods\@inidbi2;" "-mod=mods\@Australia 5.0.9;" -autoInit

timeout 3
config:
hostName = "test server - not join!";
password = "";
passwordAdmin = "pass";
serverCommandPassword = "";
logFile = "";

persistent = 1;

class Missions
{
	class Mission_1
	{
		template = "looni3r-survival.australia";
		difficulty = "regular";
	};
};
description.ext:
author = "LoOni3r (Dennis)";
onLoadName = "LoOni3r´s Survival"; 
onLoadMission = "Survival Game of Arma 3 - Please Wait, loading...";
loadScreen = "loadscreen.jpg";
skipLobby = 1;
briefing = 0;
debriefing = 0;
enableDebugConsole = 1;
respawn = "BASE";
respawnDelay = 2;
respawnDialog = 0;
disabledAI=1;




class Header
{
	gameType =  Survive;
	minPlayers =  1;
	maxPlayers = 32;
};

 

Share this post


Link to post
Share on other sites
player
applyPlayerData = {
    params ["_playerpos", "_playerdir"];

	_playerpos = parseSimpleArray _playerpos;
	player setPos _playerpos;
	_playerdir = parseNumber _playerdir;
	player setDir _playerdir;

};

waitUntil {time > 0};

_plconnect = 1;
playerDataRequest = [player,_plconnect];

if (isServer) then {
    ["playerDataRequest", playerDataRequest] call playerDataRequestHandler;
} else {
    publicVariableServer "playerDataRequest";

    playerDataRequest = nil;
};

_time = time + 10;

waitUntil {!(isNil "playerData") or {_time >= time}};

if (!(isNil "playerData")) then {
    playerData call applyPlayerData;

    playerData = nil;
};

server
playerDataRequestHandler = {
    params ["_varName", "_varValue"];

    missionNamespace setVariable [_varName, nil];

    _varValue params ["_player","_plconnect"];

	if (_plconnect == 1) then {
		_pljoin = [name _player, " join the Game"] joinString "";
		_pljoin remoteExec ["systemChat"];
	};
	
	_playeruid = getPlayerUID _player;
	_inidbifolderplayerdata = ["australia-survival\playerdata\",_playeruid] joinString "";
	_inidbi = ["new", _inidbifolderplayerdata] call OO_INIDBI;

	playerData = [
		["read", ["GENERAL", "POS"]] call _inidbi,
		["read", ["GENERAL", "DIR"]] call _inidbi
	];


    if (_player == player) then {
        playerData call applyPlayerData;
    } else {
        (owner _player) publicVariableClient "playerData";
    };

    playerData = nil;
};

"playerDataRequest" addPublicVariableEventHandler {call playerDataRequestHandler};

 

 

That's the current status.

 

I was already on. In Eden Editor -> Multiplayer there are no problems:

applyPlayerData = {
    params ["_playerpos","_playerdir","_playermoney","_playerxp","_playernew"];

	// New Player
	if (_playernew == 1) then {

		_veh = createVehicle ["C_Plane_Civil_01_F", [32790,327,150], [], 0, "FLY"];
		player moveInDriver _veh;

		_wp = (group player) addWaypoint [[35708,11988], 0];
		_wp setWaypointType "MOVE";
		sleep 200;
		deleteWaypoint _wp;
		_wp2 = (group player) addWaypoint [[36615.738,12251.281], 0];
		_wp2 setWaypointType "MOVE";
		sleep 200;
		deleteWaypoint _wp2;

		hint "Welcome to LoOni3rs Survival.\n\nPlease press the Window Key.";

	}else{

		// Not a New Player
		_playerpos = parseSimpleArray _playerpos;
		player setPos _playerpos;
		_playerdir = parseNumber _playerdir;
		player setDir _playerdir;
		
		hint "Welcome back.";
		
	}; // New Player ende
};

waitUntil {time > 0};

_plconnect = 1;

playerDataRequest = [player,_plconnect];

if (isServer) then {
    ["playerDataRequest", playerDataRequest] call playerDataRequestHandler;
} else {
    publicVariableServer "playerDataRequest";

    playerDataRequest = nil;
};

_time = time + 10;

waitUntil {!(isNil "playerData") or {_time >= time}};

if (!(isNil "playerData")) then {
    playerData call applyPlayerData;
    playerData = nil;
};

 

Server:
playerDataRequestHandler = {
    params ["_varName", "_varValue"];

    missionNamespace setVariable [_varName, nil];

    _varValue params ["_player","_plconnect"];

// Start

	if (_plconnect == 1) then {
		_pljoin = [name _player, " join the Game"] joinString "";
		_pljoin remoteExec ["systemChat"];
	};
	

	_playeruid = getPlayerUID _player;
	_inidbifolderplayerdata = ["australia-survival\playerdata\",_playeruid] joinString "";
	_inidbi = ["new", _inidbifolderplayerdata] call OO_INIDBI;


	// New Player
	_plpos = ["read", ["GENERAL", "POS"]] call _inidbi;
	str _plpos remoteExec ["systemChat"];
	if (str _plpos == "false") then {
		_playerpos = getPosATL _player;
		_setplayerpos = ['',_playerpos,''] joinString "";
		_playerdir = getDir _player;
		_setplayerdir = ['',_playerdir,''] joinString "";
		_setplayerpos = ["write", ["GENERAL", "POS", _setplayerpos]] call _inidbi;
		_setplayerdir = ["write", ["GENERAL", "DIR", _setplayerdir]] call _inidbi;
		_setplayerpos = ["write", ["GENERAL", "MONEY", "1000"]] call _inidbi;
		_setplayerdir = ["write", ["GENERAL", "XP", "0"]] call _inidbi;
		_setplayerdir = ["write", ["GENERAL", "NEW", "1"]] call _inidbi;
	}; // New Player ende



	playerData = [
		["read", ["GENERAL", "POS"]] call _inidbi,
		["read", ["GENERAL", "DIR"]] call _inidbi,
		["read", ["GENERAL", "MONEY"]] call _inidbi,
		["read", ["GENERAL", "XP"]] call _inidbi,
		["read", ["GENERAL", "NEW"]] call _inidbi
	];
_setplayerdir = ["write", ["GENERAL", "NEW", "0"]] call _inidbi;
// Ende

    if (_player == player) then {
        playerData call applyPlayerData;
    } else {
        (owner _player) publicVariableClient "playerData";
    };

    playerData = nil;
};

"playerDataRequest" addPublicVariableEventHandler {call playerDataRequestHandler};

 

 

to test I deleted everything last night and

"missionNamespace setVariable ["YourString",3];" in iniserver

 

and

"_yourString = missionNamespace getVariable "YourString";

hint str[_yourString ];"

 

inserted to test whether something is ever sent from server to client.

That was not the case.
My server does not send any data to the client and I do not understand it

Share this post


Link to post
Share on other sites

@LoOni3r, well, your code generally works. The problem is that 64-bit version of iniDBI2 for some reason isn't loading. Don't know why. But you can use 32-bit version of A3 server, in this case 32-bit version of iniDBI2 will be used -- it works.

Share this post


Link to post
Share on other sites

inidb2 is working on 32 and 64 bit.

 

 

20190122224249-1.jpg

 

server

...
    _varValue params ["_player","_plconnect"];

	if (_plconnect == 1) then {
		_pljoin = [name _player, " join the Game"] joinString "";
		_pljoin remoteExec ["systemChat"];
	};


	_playeruid = getPlayerUID _player;
	_inidbifolderplayerdata = ["australia-survival\playerdata\",_playeruid] joinString "";
	_inidbi = ["new", _inidbifolderplayerdata] call OO_INIDBI;
	
	_test = ["read", ["GENERAL", "POS"]] call _inidbi;
	_test remoteExec ["systemChat"];

	playerData = [
		["read", ["GENERAL", "POS"]] call _inidbi,
		["read", ["GENERAL", "DIR"]] call _inidbi
	];
...

playerini

applyPlayerData = {
    params ["_playerpos", "_playerdir"];

	systemchat str[_playerpos];
	_playerpos = parseSimpleArray _playerpos;
	player setPos _playerpos;
	_playerdir = parseNumber _playerdir;
	player setDir _playerdir;

};

waitUntil {time > 0};
....

the second output of the position is missing.

 

Now I've created a new blank mission with Altis.

 The same problem with Altis.

missionNamespace does not seem to work on my server.
I googled a lot and could not find a similar problem.

 

 

 

 

 

Share this post


Link to post
Share on other sites

@LoOni3r, I fixed some bugs.

initPlayerLocal.sqf:

applyPlayerData = {...};

waitUntil {time > 0};

playerDataRequest = [player];

if (isServer) then {
    ["playerDataRequest", playerDataRequest] call playerDataRequestHandler;
} else {
    publicVariableServer "playerDataRequest";

    playerDataRequest = nil;
};

_time = time + 10;

waitUntil {!(isNil "playerData") or {time >= _time}};

if (!(isNil "playerData")) then {
    playerData call applyPlayerData;

    playerData = nil;
};

initServer.sqf:

playerDataRequestHandler = {
    params ["_varName", "_varValue"];

    missionNamespace setVariable [_varName, nil];

    _varValue params ["_player"];

    _inidbi = ["new", getPlayerUID _player] call OO_INIDBI;

    // Read player data and form playerData variable

    ["delete", _inidbi] call OO_INIDBI;

    if (_player != player) then {
        (owner _player) publicVariableClient "playerData";

        playerData = nil;
    };
};

"playerDataRequest" addPublicVariableEventHandler {call playerDataRequestHandler};

Test mission (based on your code).

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

×