mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-10-04 18:49:34 +03:00
Use better method to find player's vehicle in Advanced Trading #1725
This commit is contained in:
1 parent
f6e10dd71c
commit
c51fd11511
5 files changed
+61
-32
No files matched your search
@@ -124,17 +124,29 @@ if (_selection == 1) then { //vehicle
|
||||
if (_allowedWeapons >= (_toBuyWeaps + _toolsToBuy)) then {
|
||||
_check1 = true;
|
||||
} else {
|
||||
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 {
|
||||
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 {
|
||||
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 {
|
||||
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;
|
||||
|
||||
if (!isNull DZE_myVehicle && local DZE_myVehicle && alive DZE_myVehicle && DZE_myVehicle in _list) then {
|
||||
_vehicle = DZE_myVehicle;
|
||||
};
|
||||
} count _list;
|
||||
|
||||
_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;
|
||||
|
||||
if (!isNull DZE_myVehicle && local DZE_myVehicle && alive DZE_myVehicle && DZE_myVehicle in _list) then {
|
||||
_vehicle = DZE_myVehicle;
|
||||
};
|
||||
} count _list;
|
||||
|
||||
if (!isNull _vehicle) then {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_SELECTED",typeOf _vehicle];
|
||||
_pic = getText (configFile >> 'CfgVehicles' >> (typeOf _vehicle) >> 'picture');
|
||||
|
||||
_formattedText = format [
|
||||
|
||||
@@ -113,9 +113,10 @@ if (!_canDoThis && s_player_Drinkfromhands >= 0) then {
|
||||
s_player_Drinkfromhands = -1;
|
||||
};
|
||||
|
||||
if (_inVehicle && {_vehicleOwnerID != "0"} && {!(_vehicle isKindOf "Bicycle")}) then {
|
||||
if (s_player_lockUnlockInside_ctrl < 0) then {
|
||||
if (_inVehicle) then {
|
||||
DZE_myVehicle = _vehicle;
|
||||
if (_vehicleOwnerID != "0" && !(_vehicle isKindOf "Bicycle")) then {
|
||||
if (s_player_lockUnlockInside_ctrl < 0) then {
|
||||
_totalKeys = call epoch_tempKeys;
|
||||
_temp_keys = _totalKeys select 0;
|
||||
_temp_keys_names = _totalKeys select 1;
|
||||
@@ -144,6 +145,10 @@ if (_inVehicle && {_vehicleOwnerID != "0"} && {!(_vehicle isKindOf "Bicycle")})
|
||||
};
|
||||
};
|
||||
};
|
||||
} else {
|
||||
{DZE_myVehicle removeAction _x} count s_player_lockUnlockInside;s_player_lockUnlockInside = [];
|
||||
s_player_lockUnlockInside_ctrl = -1;
|
||||
};
|
||||
} else {
|
||||
if (!isNil "DZE_myVehicle") then {
|
||||
{DZE_myVehicle removeAction _x} count s_player_lockUnlockInside;s_player_lockUnlockInside = [];
|
||||
@@ -151,6 +156,7 @@ if (_inVehicle && {_vehicleOwnerID != "0"} && {!(_vehicle isKindOf "Bicycle")})
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
if (DZE_HeliLift) then {
|
||||
_hasAttached = _vehicle getVariable["hasAttached",false];
|
||||
if (_inVehicle && {_vehicle isKindOf "Air"} && {(([_vehicle] call FNC_getPos) select 2) < 30} && {speed _vehicle < 5} && {typeName _hasAttached == "OBJECT"}) then {
|
||||
@@ -421,8 +427,8 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
|
||||
if(_isModular || _isModularDoor || {_typeOfCursorTarget in DZE_isDestroyableStorage}) then {
|
||||
if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
|
||||
_isowner = [player, _cursorTarget] call FNC_check_access;
|
||||
if ((_isowner select 0) or (_isowner select 2) or (_isowner select 3)) then {
|
||||
_isOwner = [player, _cursorTarget] call FNC_check_access;
|
||||
if ((_isOwner select 0) or (_isOwner select 2) or (_isOwner select 3)) then {
|
||||
_player_deleteBuild = true;
|
||||
};
|
||||
};
|
||||
@@ -634,8 +640,8 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
if ((_cursorTarget isKindOf "Plastic_Pole_EP1_DZ") && {_canDo && speed player <= 1}) then {
|
||||
if (DZE_permanentPlot) then {
|
||||
if (s_player_plotManagement < 0) then {
|
||||
_isowner = [player, _cursorTarget] call FNC_check_access;
|
||||
if ((_isowner select 0) or (_isowner select 2) or (_isowner select 3) or (_isowner select 4)) then {
|
||||
_isOwner = [player, _cursorTarget] call FNC_check_access;
|
||||
if ((_isOwner select 0) or (_isOwner select 2) or (_isOwner select 3) or (_isOwner select 4)) then {
|
||||
s_player_plotManagement = player addAction [format["<t color='#0059FF'>%1</t>",localize "STR_EPOCH_ACTIONS_MANAGEPLOT"], "\z\addons\dayz_code\actions\plotManagement\initPlotManagement.sqf", [], 5, false];
|
||||
};
|
||||
};
|
||||
@@ -659,8 +665,8 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
if (DZE_permanentPlot) then {
|
||||
if (s_player_plot_take_ownership < 0) then {
|
||||
if (DZE_PlotOwnership) then {
|
||||
_isowner = [player, _cursorTarget] call FNC_check_access;
|
||||
if (_isowner select 0) then {
|
||||
_isOwner = [player, _cursorTarget] call FNC_check_access;
|
||||
if (_isOwner select 0) then {
|
||||
s_player_plot_take_ownership = player addAction ["Take plot items ownership", "\z\addons\dayz_code\actions\A_Plot_for_Life\plot_take_ownership.sqf", "", 1, false];
|
||||
};
|
||||
};
|
||||
@@ -769,15 +775,15 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
// Allow manage door
|
||||
if( DZE_doorManagement && (_typeOfCursorTarget in DZE_DoorsLocked) ) then {
|
||||
// Check player access
|
||||
_isowner = [player, _cursorTarget] call FNC_check_access;
|
||||
_isOwner = [player, _cursorTarget] call FNC_check_access;
|
||||
if( (s_player_manageDoor < 0) && (
|
||||
((_isowner select 0) && DZE_doorManagementAllowManage_owner) // door owner
|
||||
|| ((_isowner select 1) && DZE_doorManagementAllowManage_ownerFriendlies) // door owner's friendly tagged
|
||||
|| ((_isowner select 2) && DZE_doorManagementAllowManage_plotOwner) // plot owner
|
||||
|| ((_isowner select 3) && DZE_doorManagementAllowManage_plotFriends) // plot friends
|
||||
|| ((_isowner select 4) && DZE_doorManagementAllowManage_plotAdmins) // plot management admins
|
||||
|| ((_isowner select 5) && DZE_doorManagementAllowManage_doorFriends) // door friends
|
||||
|| ((_isowner select 6) && DZE_doorManagementAllowManage_doorAdmins) // door management admins
|
||||
((_isOwner select 0) && DZE_doorManagementAllowManage_owner) // door owner
|
||||
|| ((_isOwner select 1) && DZE_doorManagementAllowManage_ownerFriendlies) // door owner's friendly tagged
|
||||
|| ((_isOwner select 2) && DZE_doorManagementAllowManage_plotOwner) // plot owner
|
||||
|| ((_isOwner select 3) && DZE_doorManagementAllowManage_plotFriends) // plot friends
|
||||
|| ((_isOwner select 4) && DZE_doorManagementAllowManage_plotAdmins) // plot management admins
|
||||
|| ((_isOwner select 5) && DZE_doorManagementAllowManage_doorFriends) // door friends
|
||||
|| ((_isOwner select 6) && DZE_doorManagementAllowManage_doorAdmins) // door management admins
|
||||
)) then {
|
||||
s_player_manageDoor = player addAction [format["<t color='#0059FF'>%1</t>", localize "STR_EPOCH_ACTIONS_MANAGEDOOR"], "\z\addons\dayz_code\actions\doorManagement\initDoorManagement.sqf", _cursorTarget, 5, false];
|
||||
};
|
||||
@@ -885,9 +891,9 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
};
|
||||
};
|
||||
if (s_player_upgrade_build < 0) then {
|
||||
_isowner = [player, _cursorTarget] call FNC_check_access;
|
||||
_isOwner = [player, _cursorTarget] call FNC_check_access;
|
||||
_upgrade = getArray (configFile >> "CfgVehicles" >> (typeOf _cursorTarget) >> "upgradeBuilding");
|
||||
if (((_isowner select 0) or (_isowner select 2) or (_isowner select 3)) && (count _upgrade) > 0) then {
|
||||
if (((_isOwner select 0) or (_isOwner select 2) or (_isOwner select 3)) && (count _upgrade) > 0) then {
|
||||
s_player_lastTarget set [0,_cursorTarget];
|
||||
s_player_upgrade_build = player addAction [format[localize "str_upgrade",_text], "\z\addons\dayz_code\actions\player_upgrade.sqf",_cursorTarget, -1, false, true];
|
||||
};
|
||||
@@ -906,8 +912,8 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
};
|
||||
};
|
||||
if (s_player_downgrade_build < 0) then {
|
||||
_isowner = [player, _cursorTarget] call FNC_check_access;
|
||||
if ((_isowner select 0) or (_isowner select 2) or (_isowner select 3)) then {
|
||||
_isOwner = [player, _cursorTarget] call FNC_check_access;
|
||||
if ((_isOwner select 0) or (_isOwner select 2) or (_isOwner select 3)) then {
|
||||
s_player_lastTarget set [1,_cursorTarget];
|
||||
s_player_downgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_REMLOCK",_text], "\z\addons\dayz_code\actions\player_buildingDowngrade.sqf",_cursorTarget, -2, false, true];
|
||||
};
|
||||
@@ -926,8 +932,8 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
|
||||
};
|
||||
};
|
||||
if (s_player_maint_build < 0) then {
|
||||
_isowner = [player, _cursorTarget] call FNC_check_access;
|
||||
if ((_isowner select 0) or (_isowner select 2) or (_isowner select 3)) then {
|
||||
_isOwner = [player, _cursorTarget] call FNC_check_access;
|
||||
if ((_isOwner select 0) or (_isOwner select 2) or (_isOwner select 3)) then {
|
||||
_text2 = _text + " (" + str(round ((damage _cursorTarget) * 100)) + "% damaged)";
|
||||
s_player_lastTarget set [2,_cursorTarget];
|
||||
s_player_maint_build = player addAction [format["%1 %2",localize "STR_EPOCH_ACTIONS_MAINTAIN",_text2], "\z\addons\dayz_code\actions\player_buildingMaint.sqf",_cursorTarget, -2, false, true];
|
||||
|
||||
@@ -16208,6 +16208,15 @@
|
||||
<English>You can only buy %1 backpacks into your vehicle.</English>
|
||||
<Russian>Вы можете купить рюкзаков в ваш транспорт: %1.</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_EPOCH_TRADE_VEHICLE_FULL_GUNS">
|
||||
<English>You can't fit anymore weapons into your vehicle.</English>
|
||||
</Key>
|
||||
<Key ID="STR_EPOCH_TRADE_VEHICLE_FULL_MAGS">
|
||||
<English>You can't fit anymore magazines into your vehicle.</English>
|
||||
</Key>
|
||||
<Key ID="STR_EPOCH_TRADE_VEHICLE_FULL_BAGS">
|
||||
<English>You can't fit anymore backpacks into your vehicle.</English>
|
||||
</Key>
|
||||
<Key ID="STR_EPOCH_TRADE_BACKPACK_FULL">
|
||||
<English>Total backpack space exceeded.</English>
|
||||
</Key>
|
||||
|
||||
Reference in new issue
Block a user