ACE3/addons/gunbag/functions/fnc_canInteract.sqf

33 lines
723 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"
params ["_unit","_target"];
private ["_result","_gunbag"];
_result = -1;
_gunbag = backpackContainer _target;
if(count (_gunbag getVariable [QGVAR(GunbagWeapon),[]]) <= 0 && {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
};
if(count (_gunbag getVariable [QGVAR(GunbagWeapon),[]]) >= 1 && {primaryWeapon _unit == ""}) then {
2016-05-17 09:21:48 +00:00
_result = 1;
2016-05-03 08:21:21 +00:00
};
_result