Files
DayZ-Epoch/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkCloseVehicle.sqf
oiad 088945e074 Remove public variable event handler when using config traders. (#1930)
* Remove public variable event handler when using config traders.

This stops the public variable event handler from being loaded when
you're using config based traders, it's not needed in this situation

* Change nearestObjects to nearEntities in z_checkCloseVehicle.sqf

* Fixes vehicle selling not able to sell correctly

If more than 1 vehicle of the same classname was in a trader and the
local vehicle was further away it would not be able to be sold till
moved closer. We are using DZE_myVehicle for everything and we do
previous checks to make sure it's not null and local so we can assume it
is okay to use.

Fixes
https://epochmod.com/forum/topic/43643-vehicle-dze4-can-not-be-sell/#comment-290036
2017-04-01 13:02:51 -04:00

20 lines
721 B
Plaintext

private ["_list","_result","_pos"];
_result = false;
_pos = [player] call FNC_GetPos;
_list = _pos nearEntities [["Air","LandVehicle","Ship"],Z_VehicleDistance];
if (!isNull DZE_myVehicle && {local DZE_myVehicle} && {alive DZE_myVehicle} && {DZE_myVehicle in _list}) then {
_result = true;
if (_this) then { // Set trade title, don't set on menu start up since gear is selected initially.
systemChat format[localize "STR_EPOCH_TRADE_SELECTED",typeOf DZE_myVehicle];
if (Z_Selling) then {
[format[localize "STR_EPOCH_TRADE_SELLING_FROM", typeOf DZE_myVehicle]] call Z_fillTradeTitle;
} else {
[format[localize "STR_EPOCH_TRADE_BUYING_IN", typeOf DZE_myVehicle]] call Z_fillTradeTitle;
};
};
};
_result