From 8b3e5ac8e2bcbd11bcc933119c1d0753c2bfe3d7 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 22 Feb 2015 18:38:06 +0100 Subject: [PATCH] Added hasItems function --- addons/medical/XEH_preInit.sqf | 1 + addons/medical/functions/fnc_hasItems.sqf | 31 +++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 addons/medical/functions/fnc_hasItems.sqf diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 400fefaa7f..58d9232250 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -45,6 +45,7 @@ PREP(onMedicationUsed); PREP(reactionToDamage); PREP(useItem); PREP(hasItem); +PREP(hasItems); PREP(hasMedicalEnabled); PREP(hasTourniquetAppliedTo); PREP(isMedic); diff --git a/addons/medical/functions/fnc_hasItems.sqf b/addons/medical/functions/fnc_hasItems.sqf new file mode 100644 index 0000000000..3a4bd6a7c9 --- /dev/null +++ b/addons/medical/functions/fnc_hasItems.sqf @@ -0,0 +1,31 @@ +/* + * Author: Glowbal + * Check if all items are present between the patient and the medic. + * + * Arguments: + * 0: Medic + * 1: Patient + * 2: Item + * + * ReturnValue: + * + * + * Public: Yes + */ + +#include "script_component.hpp" + + +private ["_medic", "_patient", "_items", "_return"]; +_medic = _this select 0; +_patient = _this select 1; +_items = _this select 2; + +_return = true; +{ + if !([_medic, _patient, _x] call FUNC(hasItem)) exitwith { + _return = false; + }; +}foreach _items; + +_return;