Search the Community
Showing results for tags 'activeaddons'.
Found 1 result
-
Obviously based on my question my Arma scripting experience is limited. I have other coding experience but the Arma nuances make it difficult for me to find out where I am going wrong. I have done a bunch of research and I have found examples of what I want but none are working. If anyone has suggestions it would be very helpful. What I would like to do is step through the players cfgpatches and check to see if each element of that array is in another array or not. If not display text and endmission. I know this question has been asked but in each thread the examples do not work as expected. Below are the three methods I have tried to get what I want done to work. First attempt mods = ["Element1","Element2","Element3"]; _classes = []; _cfg = (ConfigFile >> "CfgPatches"); _itemCount = (count _cfg) - 1; for "_i" from 0 to _itemCount do { if (isClass (_cfg select _i)) then { _classes = _classes + [configName (_cfg select _i)]; }; }; if (!( str _classes in mods)) then { player groupChat "You are using a mod that is not allowed, please check list of approved mods. you are being returned to the lobby in 15 seconds"; sleep 15; "end1" call BIS_fnc_endMission; }; Second Attempt _mods = ["Element1","Element2","Element3"]; _patches = (ConfigFile >> "CfgPatches"); _c = count _patches; _loop = true; _n = 0; _arr []; while{_loop}do{ _cur = _patches select _n; if not(_cur in _mods) { player groupChat "You are using a mod that is not allowed, please check list of approved mods. you are being returned to the lobby in 15 seconds"; sleep 15; "end1" call BIS_fnc_endMission; }; _n = _n + 1; if(_n > _c)then{_loop = false;}; }; _arr; Third Attempt _mods = ["Element1","Element2","Element3"]; _canPass = true; { if (!(["a3_", _x] call BIS_fnc_inString)) then { if (isClass _x) then { if ((!configName _x) in _mods) exitWith {_canPass = false;}; }; }; } forEach activatedAddons; if (!_canPass) exitWith { player groupChat "You are using a mod that is not allowed, please check list of approved mods. you are being returned to the lobby in 15 seconds"; sleep 15; "end1" call BIS_fnc_endMission; }; Any suggestions on how I might get one of these are similar code to work would be a big help, Thanks in advanced.
- 8 replies
-
- array
- cfgpatches
-
(and 2 more)
Tagged with: