ACE3/addons/reload/functions/fnc_checkAmmo.sqf

41 lines
947 B
Plaintext
Raw Normal View History

/*
2015-03-24 04:18:00 +00:00
* Author: commy2 and esteldunedain
* Count the ammo of the currently loaded magazine or count rifle grenades. Play animation and display message.
2015-03-06 04:32:47 +00:00
*
* Argument:
2015-03-06 04:32:47 +00:00
* 0: Player <OBJECT>
* 1: Target. Optional, if not suplied the player counts his personal or static weapon ammo <OBJECT>
*
* Return value:
* Nothing
*/
2015-01-16 01:25:41 +00:00
#include "script_component.hpp"
#define COUNT_BARS 12
2015-03-06 04:32:47 +00:00
EXPLODE_1_PVT(_this,_unit);
2015-03-06 04:32:47 +00:00
private ["_target"];
_target = vehicle _unit;
2015-03-06 04:32:47 +00:00
if (count _this > 1) then {
_target = _this select 1;
} else {
2015-03-06 04:32:47 +00:00
// If the unit is on foot, count it's own ammo
if (_unit == _target) exitWith {};
2015-03-06 04:32:47 +00:00
// If it's mounted on a movile weapon, count it's own ammo
if !(_target isKindOf "StaticWeapon") then {
_target = _unit;
};
2015-03-06 04:32:47 +00:00
};
if (_unit == _target) then {
_unit playActionNow "Gear";
} else {
_unit playActionNow "PutDown";
};
2015-03-06 04:32:47 +00:00
[FUNC(displayAmmo), [_target], 1, 0.1] call EFUNC(common,waitAndExecute);