mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 20:13:13 +03:00
Use better method to find player's vehicle in Advanced Trading #1725
This commit is contained in:
@@ -124,17 +124,29 @@ if (_selection == 1) then { //vehicle
|
||||
if (_allowedWeapons >= (_toBuyWeaps + _toolsToBuy)) then {
|
||||
_check1 = true;
|
||||
} else {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_VEHICLE_WEPS", _allowedWeapons];
|
||||
if (_allowedWeapons > 0) then {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_VEHICLE_WEPS", _allowedWeapons];
|
||||
} else {
|
||||
systemChat localize "STR_EPOCH_TRADE_VEHICLE_FULL_GUNS";
|
||||
};
|
||||
};
|
||||
if (_allowedMags >= _toBuyTotalMags) then {
|
||||
_check2 = true;
|
||||
} else {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_VEHICLE_MAGS", _allowedMags];
|
||||
if (_allowedMags > 0) then {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_VEHICLE_MAGS", _allowedMags];
|
||||
} else {
|
||||
systemChat localize "STR_EPOCH_TRADE_VEHICLE_FULL_MAGS";
|
||||
};
|
||||
};
|
||||
if (_allowedBackpacks >= _toBuyBags) then {
|
||||
_check3 = true;
|
||||
} else {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_VEHICLE_BAGS", _allowedBackpacks];
|
||||
if (_allowedBackpacks > 0) then {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_VEHICLE_BAGS", _allowedBackpacks];
|
||||
} else {
|
||||
systemChat localize "STR_EPOCH_TRADE_VEHICLE_FULL_BAGS";
|
||||
};
|
||||
};
|
||||
|
||||
if (_check1 && _check2 && _check3) then { _return = true; };
|
||||
@@ -165,7 +177,11 @@ if (_selection == 0) then { //backpack
|
||||
if (_allowedWeapons >= _toBuyWeaps) then { //_toBuyWeaps does not include tools (which can exceed transportMaxWeapons in backpacks but not vehicles)
|
||||
_check1 = true;
|
||||
} else {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BAG_WEPS", _allowedWeapons];
|
||||
if (_allowedWeapons > 0) then {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BAG_WEPS", _allowedWeapons];
|
||||
} else {
|
||||
systemChat localize "STR_EPOCH_TRADE_BACKPACK_FULL";
|
||||
};
|
||||
};
|
||||
|
||||
if (_allowedMags >= _toBuyTotalMags) then {
|
||||
|
||||
@@ -4,11 +4,11 @@ Z_vehicle = objNull;
|
||||
_vehicle = objNull;
|
||||
_pos = [player] call FNC_GetPos;
|
||||
_list = nearestObjects [_pos, ["Air","LandVehicle","Ship"], Z_VehicleDistance];
|
||||
{
|
||||
if (!isNull _x && local _x && alive _x) then {
|
||||
_vehicle = _x;
|
||||
};
|
||||
} count _list;
|
||||
|
||||
if (!isNull DZE_myVehicle && local DZE_myVehicle && alive DZE_myVehicle && DZE_myVehicle in _list) then {
|
||||
_vehicle = DZE_myVehicle;
|
||||
};
|
||||
|
||||
_result = false;
|
||||
|
||||
if (!isNull _vehicle) then {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* call Z_getVehicleItems
|
||||
*
|
||||
* Gets all your items stored in your vehicle and innitiates the selling list.
|
||||
* Gets all your items stored in your vehicle and initiates the selling list.
|
||||
**/
|
||||
private ["_vehicle","_pos","_list","_formattedText","_pic","_normalMags","_normalWeaps","_freeSpace"];
|
||||
#include "defines.hpp"
|
||||
@@ -14,14 +14,12 @@ _vehicle = objNull;
|
||||
|
||||
_pos = [player] call FNC_GetPos;
|
||||
_list = nearestObjects [_pos, ["Air","LandVehicle","Ship"], Z_VehicleDistance];
|
||||
{
|
||||
if (!isNull _x && local _x && alive _x) then {
|
||||
_vehicle = _x;
|
||||
};
|
||||
} count _list;
|
||||
|
||||
if (!isNull DZE_myVehicle && local DZE_myVehicle && alive DZE_myVehicle && DZE_myVehicle in _list) then {
|
||||
_vehicle = DZE_myVehicle;
|
||||
};
|
||||
|
||||
if (!isNull _vehicle) then {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_SELECTED",typeOf _vehicle];
|
||||
_pic = getText (configFile >> 'CfgVehicles' >> (typeOf _vehicle) >> 'picture');
|
||||
|
||||
_formattedText = format [
|
||||
|
||||
Reference in New Issue
Block a user