From fd215c17fac236be073b245eecc44463804f1e0f Mon Sep 17 00:00:00 2001 From: Wyqer Date: Sat, 7 Dec 2019 11:08:47 +0100 Subject: [PATCH] fn_getUnitPositionId --- .../functions/fn_getUnitPositionId.sqf | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Missionframework/functions/fn_getUnitPositionId.sqf b/Missionframework/functions/fn_getUnitPositionId.sqf index 402a296e..b6d33adf 100644 --- a/Missionframework/functions/fn_getUnitPositionId.sqf +++ b/Missionframework/functions/fn_getUnitPositionId.sqf @@ -2,25 +2,28 @@ File: fn_getUnitPositionId.sqf Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2019-12-03 - Last Update: 2019-12-03 + Last Update: 2019-12-07 License: MIT License - http://www.opensource.org/licenses/MIT Description: - No description added yet. + Gets the position ID of given unit with vehicleVarName bypassing. Parameter(s): - _localVariable - Description [DATATYPE, defaults to DEFAULTVALUE] + _unit - Unit to get the position ID from [OBJECT, defaults to objNull] Returns: - Function reached the end [BOOL] + Position ID [NUMBER] */ -// TODO -params [ "_unit" ]; -private ["_vvn", "_str"]; -_vvn = vehicleVarName _unit; +params [ + ["_unit", objNull, [objNull]] +]; + +if (isNull _unit) exitWith {["Null object given"] call BIS_fnc_error; -1}; + +private _vvn = vehicleVarName _unit; _unit setVehicleVarName ""; -_str = str _unit; +private _str = str _unit; _unit setVehicleVarName _vvn; parseNumber (_str select [(_str find ":") + 1])