Forum Jump :

Author Message


Posts: 2
Rank:


Level: Member

Country: en
Location:
Occupation:
Age: 40
In-game name: 2LT A. Stevens [51AA]

 
#1 Posted at 2014-10-06 19:51        
     
Okay so first off, a huge thank you to the people who reply to this cry for help! I searched both armaholic and the Bohemia forums and found nothing so I posted this.

My problem is that on a public server I'm running, two types of people use it, Public players without Mods and Clan Members with Mods. Now I have a way for them to play in harmony (questions about that PM me please) without any kicking or floating players or missing items. However there is one problem, Pubbers need a revive script so they don't die on impact and our clan members have AGM medical mod in the modpack which conflicts with the script.

Now what I want to do is edit the medical script with a statement, if AGM is present run {Nothing}; else {Medical script};

Now I'm not sure if this is possible, I would hope so. In AGM there is a script that checks the version:
// by commy2
_files = [];
{
	_addon = toArray _x;
	_addon resize 4; 
	_addon = toString _addon;

	if (_addon == "AGM_") then {
		_files set [count _files, _x];
	};
} forEach activatedAddons;

_versionMain = parseNumber getText (configFile >> "CfgPatches" >> "AGM_Core" >> "version");

_versions = [];
{
	_version = parseNumber getText (configFile >> "CfgPatches" >> _x >> "version");
	_versions set [_forEachIndex, _version];
} forEach _files;

if (isServer) then {
	diag_log text format ["[AGM] Server: agm_core is Version %1.", _versionMain];

	{
		_version = _versions select _forEachIndex;
		if (_version != _versionMain) then {
			diag_log text format ["[AGM] Server: %1 is Version %2.", _x, _version];
		};
	} forEach _files;

	AGM_Version_ServerVersions = [_files, _versions];
	publicVariable "AGM_Version_ServerVersions";
} else {
	diag_log text format ["[AGM] Client: AGM_Core is Version %1.", _versionMain];

	{
		_version = _versions select _forEachIndex;
		if (_version != _versionMain) then {
			diag_log text format ["[AGM] Client: %1 is Version %2.", _x, _version];
		};
	} forEach _files;

	AGM_Version_ClientVersions = [_files, _versions];
};

// Begin client version check 
if (!isServer) then {
	0 spawn {

		// Wait for server to send the servers files and version numbers
		waitUntil {
			sleep 1;
			!isNil "AGM_Version_ClientVersions" && {!isNil "AGM_Version_ServerVersions"}
		};

		_client = profileName;

		_files = AGM_Version_ClientVersions select 0;
		_versions = AGM_Version_ClientVersions select 1;

		_serverFiles = AGM_Version_ServerVersions select 0;
		_serverVersions = AGM_Version_ServerVersions select 1;

		// Compare client and server files and versions
		_missingAddons = [];
		_oldVersionsClient = [];
		_oldVersionsServer = [];
		{
			_serverVersion = _serverVersions select _forEachIndex;

			_index = _files find _x;
			if (_index == -1) then {
				_missingAddons set [count _missingAddons, _x];
			} else {

				_clientVersion = _versions select _index;

				if (_clientVersion < _serverVersion) then {
					_oldVersionsClient set [count _oldVersionsClient, [_x, _clientVersion, _serverVersion]];
				};

				if (_clientVersion > _serverVersion) then {
					_oldVersionsServer set [count _oldVersionsServer, [_x, _clientVersion, _serverVersion]];
				};
			};
		} forEach _serverFiles;

		// find client files which the server doesn't have
		_missingAddonsServer = [];
		{
			_index = _serverFiles find _x;
			if (_index == -1) then {
				_missingAddonsServer set [count _missingAddonsServer, _x];
			}
		} forEach _files;

		// display and log error messages
		_fnc_cutComma = {
			_string = _this;
			_string = toArray _string;

			_count = count _string;
			_string set [_count - 2, toArray "." select 0];
			_string set [_count - 1, -1];
			_string = _string - [-1];

			toString _string;
		};

		_missingAddon = false;
		if (count _missingAddons > 0) then {
			_missingAddon = true;

			_error = format ["[AGM] %1: ERROR missing addon(s): ", _client];
			{
				_error = _error + format ["%1, ", _x];
			} forEach _missingAddons;

			_error = _error call _fnc_cutComma;

			diag_log text _error;
			[_error, "{systemChat _this}"] call AGM_Core_fnc_execRemoteFnc;
		};

		_missingAddonServer = false;
		if (count _missingAddonsServer > 0) then {
			_missingAddonServer = true;

			_error = format ["[AGM] %1: ERROR missing server addon(s): ", _client];
			{
				_error = _error + format ["%1, ", _x];
			} forEach _missingAddonsServer;

			_error = _error call _fnc_cutComma;

			diag_log text _error;
			[_error, "{systemChat _this}"] call AGM_Core_fnc_execRemoteFnc;
		};

		_oldVersionClient = false;
		if (count _oldVersionsClient > 0) then {
			_oldVersionClient = true;

			_error = format ["[AGM] %1: ERROR outdated addon(s): ", _client];
			{
				_error = _error + format ["%1 (client: %2, server: %3), ", _x select 0, _x select 1, _x select 2];
			} forEach _oldVersionsClient;

			_error = _error call _fnc_cutComma;

			diag_log text _error;
			[_error, "{systemChat _this}"] call AGM_Core_fnc_execRemoteFnc;
		};

		_oldVersionServer = false;
		if (count _oldVersionsServer > 0) then {
			_oldVersionServer = true;

			_error = format ["[AGM] %1: ERROR outdated server addon(s): ", _client];
			{
				_error = _error + format ["%1 (client: %2, server: %3), ", _x select 0, _x select 1, _x select 2];
			} forEach _oldVersionsServer;

			_error = _error call _fnc_cutComma;

			diag_log text _error;
			[_error, "{systemChat _this}"] call AGM_Core_fnc_execRemoteFnc;
		};

		AGM_Version_ClientErrors = [_missingAddon, _missingAddonServer, _oldVersionClient, _oldVersionServer];
	};
};
Maybe this could be adapted? I appreciate anyone with the knowledge to help, though I have no prior scripting knowledge so step by step guides will be needed.


Author Message

Tajin  



Posts: 433
Rank:


Level: Member

Country: de
Location: Bavaria
Occupation: Communications Designer
Age: 36
In-game name: Tajin

 
#2 Posted at 2014-10-07 09:39        
     
This should suffice (unless you need a more detailed check, with versioning and whatnot):

if ({ ["AGM_", _x] call BIS_fnc_inString) } count activatedAddons > 0) then {
	// code when AGM is active
} else {
	// code without AGM
};

There are a lot of very capable people on this forum, willing to spend some of their time to help you out. So if you have a problem, it surely isn't too much to ask that you atleast take the time to describe it properly. Thanks.

Advertisement


Author Message


Posts: 2
Rank:


Level: Member

Country: en
Location:
Occupation:
Age: 40
In-game name: 2LT A. Stevens [51AA]

 
#3 Posted at 2014-10-07 21:21        
     
Worked first time, thanks a bunch buddy.