Skip to content

Commit

Permalink
only allow selling of vehicle if local to player
Browse files Browse the repository at this point in the history
This makes it so you must get into the drivers seat once first before
you can sell the vehicle.
  • Loading branch information
vbawol committed Nov 7, 2013
1 parent cdc433f commit 54d692d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 22 deletions.
32 changes: 18 additions & 14 deletions SQF/dayz_code/actions/trade_any_bicycle.sqf
Expand Up @@ -4,8 +4,8 @@ if(TradeInprogress) exitWith { cutText [(localize "str_epoch_player_103") , "PLA
TradeInprogress = true;

// Test cannot lock while another player is nearby
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 12]) > 1;
if(_playerNear) exitWith { TradeInprogress = false; cutText [(localize "str_epoch_player_104") , "PLAIN DOWN"]; };
//_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 12]) > 1;
//if(_playerNear) exitWith { TradeInprogress = false; cutText [(localize "str_epoch_player_104") , "PLAIN DOWN"]; };

// [part_out,part_in, qty_out, qty_in, loc];

Expand Down Expand Up @@ -148,27 +148,31 @@ if (_qty >= _qty_in) then {
_okToSell = false;
};
};
if(local _obj) then {

if(_okToSell) then {
if(_okToSell) then {

if(!isNull _obj and alive _obj) then {
if(!isNull _obj and alive _obj) then {

for "_x" from 1 to _qty_out do {
player addMagazine _part_out;
};
for "_x" from 1 to _qty_out do {
player addMagazine _part_out;
};

_objectID = _obj getVariable ["ObjectID","0"];
_objectUID = _obj getVariable ["ObjectUID","0"];
_objectID = _obj getVariable ["ObjectID","0"];
_objectUID = _obj getVariable ["ObjectUID","0"];

PVDZE_obj_Delete = [_objectID,_objectUID,_activatingPlayer];
publicVariableServer "PVDZE_obj_Delete";
PVDZE_obj_Delete = [_objectID,_objectUID,_activatingPlayer];
publicVariableServer "PVDZE_obj_Delete";

deleteVehicle _obj;
deleteVehicle _obj;

cutText [format[(localize "str_epoch_player_181"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
cutText [format[(localize "str_epoch_player_181"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
};
} else {
cutText [format[(localize "str_epoch_player_182"),_textPartIn] , "PLAIN DOWN"];
};
} else {
cutText [format[(localize "str_epoch_player_182"),_textPartIn] , "PLAIN DOWN"];
cutText [(localize "str_epoch_player_245"), "PLAIN DOWN"];
};
};

Expand Down
10 changes: 8 additions & 2 deletions SQF/dayz_code/actions/trade_any_boat.sqf
Expand Up @@ -4,8 +4,8 @@ if(TradeInprogress) exitWith { cutText [(localize "str_epoch_player_103") , "PLA
TradeInprogress = true;

// Test cannot lock while another player is nearby
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 12]) > 1;
if(_playerNear) exitWith { TradeInprogress = false; cutText [(localize "str_epoch_player_104") , "PLAIN DOWN"]; };
//_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 12]) > 1;
//if(_playerNear) exitWith { TradeInprogress = false; cutText [(localize "str_epoch_player_104") , "PLAIN DOWN"]; };

// [part_out,part_in, qty_out, qty_in, loc];

Expand Down Expand Up @@ -145,6 +145,10 @@ if (_qty >= _qty_in) then {
_obj = _obj select 0;

_okToSell = true;
if(!local _obj) then {
_okToSell = false;
};

if(_okToSell and !isNull _obj and alive _obj) then {

for "_x" from 1 to _qty_out do {
Expand All @@ -160,6 +164,8 @@ if (_qty >= _qty_in) then {
deleteVehicle _obj;

cutText [format[(localize "str_epoch_player_181"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
} else {
cutText [(localize "str_epoch_player_245"), "PLAIN DOWN"];
};
};

Expand Down
16 changes: 10 additions & 6 deletions SQF/dayz_code/actions/trade_any_vehicle.sqf
Expand Up @@ -4,8 +4,8 @@ if(TradeInprogress) exitWith { cutText [(localize "str_epoch_player_103") , "PLA
TradeInprogress = true;

// Test cannot lock while another player is nearby
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 12]) > 1;
if(_playerNear) exitWith { TradeInprogress = false; cutText [(localize "str_epoch_player_104") , "PLAIN DOWN"]; };
//_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 12]) > 1;
//if(_playerNear) exitWith { TradeInprogress = false; cutText [(localize "str_epoch_player_104") , "PLAIN DOWN"]; };

// [part_out,part_in, qty_out, qty_in, loc];

Expand Down Expand Up @@ -169,10 +169,10 @@ if (_qty >= _qty_in) then {
};
};

if(_okToSell) then {
if(local _obj and !isNull _obj and alive _obj) then {

if(_okToSell) then {

if(!isNull _obj and alive _obj) then {

for "_x" from 1 to _qty_out do {
player addMagazine _part_out;
};
Expand All @@ -186,10 +186,14 @@ if (_qty >= _qty_in) then {
deleteVehicle _obj;

cutText [format[(localize "str_epoch_player_181"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];

} else {
cutText [format[(localize "str_epoch_player_182"),_textPartIn] , "PLAIN DOWN"];
};
} else {
cutText [format[(localize "str_epoch_player_182"),_textPartIn] , "PLAIN DOWN"];
cutText [(localize "str_epoch_player_245"), "PLAIN DOWN"];
};

};

{player removeAction _x} forEach s_player_parts;s_player_parts = [];
Expand Down
10 changes: 10 additions & 0 deletions SQF/dayz_epoch_b/stringtable.xml
Expand Up @@ -4974,5 +4974,15 @@
<French></French>
<Czech></Czech>
</Key>
<Key ID="STR_EPOCH_PLAYER_245">
<Original>Failed to sell vehicle, you must get into drivers seat first.</Original>
<English>Failed to sell vehicle, you must get into drivers seat first.</English>
<German>Failed to sell vehicle, you must get into drivers seat first.</German>
<Russian>Failed to sell vehicle, you must get into drivers seat first.</Russian>
<Spanish>Failed to sell vehicle, you must get into drivers seat first.</Spanish>
<Dutch>Failed to sell vehicle, you must get into drivers seat first.</Dutch>
<French>Failed to sell vehicle, you must get into drivers seat first.</French>
<Czech>Failed to sell vehicle, you must get into drivers seat first.</Czech>
</Key>
</Package>
</Project>

0 comments on commit 54d692d

Please sign in to comment.