ACE3/addons/gunbag/functions/fnc_canInteract.sqf

30 lines
718 B
Plaintext
Raw Normal View History

2016-05-03 08:21:21 +00:00
/*
* Author: Ir0n1E
* Check if client able to interact with gunbag
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* <NUMBER> -1: can't interact 0: empty gunbag 1: full gunbag
*
* Public: No
*/
#include "script_component.hpp"
2016-06-12 11:51:23 +00:00
params ["_unit", "_target"];
2016-05-03 08:21:21 +00:00
2016-06-12 11:51:23 +00:00
private _result = -1;
private _gunbag = backpackContainer _target;
2016-05-03 08:21:21 +00:00
2016-06-12 11:51:23 +00:00
if ((_gunbag getVariable [QGVAR(gunbagWeapon), []]) isEqualTo [] && {primaryWeapon _unit != ""} && {getNumber (configFile >> "CfgWeapons" >> primaryWeapon _unit >> QGVAR(allowGunbag)) == 1}) then {
2016-05-17 09:21:48 +00:00
_result = 0;
2016-05-03 08:21:21 +00:00
};
2016-06-12 11:51:23 +00:00
if (!((_gunbag getVariable [QGVAR(gunbagWeapon), []]) isEqualTo []) && {primaryWeapon _unit == ""}) then {
2016-05-17 09:21:48 +00:00
_result = 1;
2016-05-03 08:21:21 +00:00
};
_result