Files
DayZ-Epoch/dayz_code/actions/trade_any_vehicle.sqf
vbawol 9e4ea22120 1.0.0.5 Developer Build
+ [ADDED] Added 4 more new military skins as rare drops on
militaryclothes:
(FR_OHara_DZ,FR_Rodriguez_DZ,CZ_Soldier_Sniper_EP1_DZ,Graves_Light_DZ)
Picture. Left to right. http://i.imgur.com/HlE4o2R.jpg
+ [CHANGED] You can now only sell vehicles to the trader if they are
between 75% and 100% health.
+ [ADDED] Added generator as build-able and now can be started with one
20 liter Jerrycan and runs until server restart.
+ [CHANGED] Lowered building preview time from 50 seconds to 15.
+ [ADDED] First release of PHP tool to help config traders.
+ [ADDED] Player Zombie vision.
+ [CHANGED] You must now be the owner of a plot or a friend of an owner
to build.
+ [CHANGED] When removing base building elements and not the owner or
friend removal counter is doubled.
+ [FIXED] Potential fix for shifting position of mg nest.
+ [ADDED] New sniper rifle SCAR_H_LNG_Sniper_SD (ammo:
20Rnd_762x51_SB_SCAR) added to MassGrave loot tables.
+ [ADDED] New Machine Gun Pecheneg_DZ to MilitarySpecial loot tables and
to traders. (ammo:100Rnd_762x54_PK)
+ [ADDED] New SMG: Sa61_EP1 (ammo: 20Rnd_B_765x17_Ball), UZI_SD_EP1
(ammo: 30Rnd_9x19_UZI_SD) added to traders and Military loot tables.
+ [ADDED] New Pistol added to traders and loot tables
MassGrave,DynamicDebrisMilitary, and Residential : MakarovSD (ammo:
8Rnd_9x18_MakarovSD)
+ [ADDED] Bikeys Added for playwith versions of taviana, namalsk, celle,
lingor.
+ [INFO] Attention server owners should change @tavi_DayZ_Epoch folder
on the server to @taviana and your players can then connect and install
automatically with play.withsix.com with the above mentioned bikeys.
2013-04-23 15:59:55 -05:00

164 lines
4.5 KiB
Plaintext

private["_position","_veh","_location","_isOk","_backpack","_vehType","_trg","_key","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID"];
if(TradeInprogress) exitWith { cutText ["Trade already in progress." , "PLAIN DOWN"]; };
TradeInprogress = true;
// [part_out,part_in, qty_out, qty_in, loc];
_activatingPlayer = _this select 1;
_part_out = (_this select 3) select 0;
_part_in = (_this select 3) select 1;
_qty_out = (_this select 3) select 2;
_qty_in = (_this select 3) select 3;
_buy_o_sell = (_this select 3) select 4;
_textPartIn = (_this select 3) select 5;
_textPartOut = (_this select 3) select 6;
_traderID = (_this select 3) select 7;
_bos = 0;
if(_buy_o_sell == "buy") then {
_qty = {_x == _part_in} count magazines player;
} else {
_obj = nearestObjects [(getPosATL player), [_part_in], 20];
_qty = count _obj;
_bos = 1;
};
if (_qty >= _qty_in) then {
cutText ["Starting trade, stand still to complete trade.", "PLAIN DOWN"];
// force animation
player playActionNow "Medic";
r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
_started = false;
_finished = false;
while {r_doLoop} do {
_animState = animationState player;
_isMedic = ["medic",_animState] call fnc_inString;
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
r_doLoop = false;
_finished = true;
};
if (r_interrupt) then {
r_doLoop = false;
};
sleep 0.1;
};
r_doLoop = false;
if (!_finished) exitWith {
r_interrupt = false;
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
cutText ["Canceled Trade." , "PLAIN DOWN"];
};
if (_finished) then {
// Double check for items
if(_buy_o_sell == "buy") then {
_qty = {_x == _part_in} count magazines player;
} else {
_obj = nearestObjects [(getPosATL player), [_part_in], 20];
_qty = count _obj;
_bos = 1;
};
if (_qty >= _qty_in) then {
//["dayzTradeObject",[_activatingPlayer,_traderID,_bos]] call callRpcProcedure;
dayzTradeObject = [_activatingPlayer,_traderID,_bos];
publicVariableServer "dayzTradeObject";
diag_log format["DEBUG Starting to wait for answer: %1", dayzTradeObject];
waitUntil {!isNil "dayzTradeResult"};
diag_log format["DEBUG Complete Trade: %1", dayzTradeResult];
if(dayzTradeResult == "PASS") then {
if(_buy_o_sell == "buy") then {
for "_x" from 1 to _qty_in do {
player removeMagazine _part_in;
};
_dir = round(random 360);
_helipad = nearestObjects [player, ["HeliHCivil","HeliHempty"], 100];
if(count _helipad > 0) then {
_location = (getPosATL (_helipad select 0));
} else {
_location = [(position player),0,20,1,0,2000,0] call BIS_fnc_findSafePos;
};
//place vehicle spawn marker (local)
_veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"];
_location = (getPosATL _veh);
//["dayzPublishVeh",[_veh,[_dir,_location],_part_out,false,dayz_playerUID]] call callRpcProcedure;
dayzPublishVeh2 = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
publicVariableServer "dayzPublishVeh2";
player reveal _veh;
cutText [format[("Bought %3 %4 for %1 %2"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
} else {
if((damage _obj) >= 0.75) then {
// Sell Vehicle
for "_x" from 1 to _qty_out do {
player addMagazine _part_out;
};
_obj = _obj select 0;
_objectID = _obj getVariable ["ObjectID","0"];
_objectUID = _obj getVariable ["ObjectUID","0"];
//["dayzDeleteObj",[_objectID,_objectUID]] call callRpcProcedure;
dayzDeleteObj = [_objectID,_objectUID];
publicVariableServer "dayzDeleteObj";
deleteVehicle _obj;
cutText [format[("Sold %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
} else {
_dampercent = (damage _obj) * 100;
cutText [format[("Cannot sell %1 it is %2% damaged and cannot be sold under 75%."),_textPartIn,_dampercent], "PLAIN DOWN"];
};
};
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
s_player_parts_crtl = -1;
} else {
cutText [format[("Insufficient Stock %1"),_textPartOut] , "PLAIN DOWN"];
};
dayzTradeResult = nil;
};
};
} else {
_needed = _qty_in - _qty;
if(_buy_o_sell == "buy") then {
cutText [format[("Need %1 More %2"),_needed,_textPartIn] , "PLAIN DOWN"];
} else {
cutText [format[("No %1 found within 20 meters."),_textPartIn] , "PLAIN DOWN"];
};
};
TradeInprogress = false;