mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-10 10:12:54 +03:00
1.7.5.D1208
This commit is contained in:
24
dayz_code/actions/ammo.sqf
Normal file
24
dayz_code/actions/ammo.sqf
Normal file
@@ -0,0 +1,24 @@
|
||||
private["_ammoType","_vehicle","_ammo","_weapon","_turret","_text","_array","type"];
|
||||
_array = _this select 3;
|
||||
_vehicle = _array select 0;
|
||||
_weapon = _array select 1;
|
||||
_turret = _array select 2;
|
||||
_ammo = "";
|
||||
_text = [];
|
||||
|
||||
call r_player_removeActions2;
|
||||
_magazines = getArray (configFile >> "cfgWeapons" >> _weapon >> "magazines");
|
||||
{
|
||||
_ammoType = getText (configFile >> "cfgMagazines" >> _x >> "displayName");
|
||||
if (_ammoType == "") then {_ammoType = _x;};
|
||||
if (!(_ammoType in _text)) then {_text set [count _text,_ammoType];};
|
||||
if (_x in magazines player) exitWith {_ammo = _x;};
|
||||
} forEach _magazines;
|
||||
if (_ammo != "") then {
|
||||
_vehicle removeMagazineTurret [_ammo,_turret];
|
||||
_vehicle addMagazineTurret [_ammo,_turret];
|
||||
player removeMagazine _ammo;
|
||||
cutText [format["You have successfully loaded %1 ammunition.",_ammoType], "PLAIN DOWN"];
|
||||
} else {
|
||||
cutText [format["You need %1 type of ammo to do this.",_text], "PLAIN DOWN"];
|
||||
};
|
||||
@@ -11,7 +11,7 @@ _category = (_this select 3) select 1;
|
||||
diag_log format["DEBUG TRADER OBJ: %1", _trader_id];
|
||||
|
||||
dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action];
|
||||
publicVariable "dayzTraderMenu";
|
||||
publicVariableServer "dayzTraderMenu";
|
||||
if (isServer) then {
|
||||
dayzTraderMenu call server_traders;
|
||||
};
|
||||
@@ -19,6 +19,7 @@ if (isServer) then {
|
||||
waitUntil {!isNil "dayzTraderMenuResult"};
|
||||
|
||||
/*
|
||||
`id`,
|
||||
`item` varchar(255) NOT NULL COMMENT '[Class Name,1 = CfgMagazines | 2 = Vehicle | 3 = Weapon]',
|
||||
`qty` int(8) NOT NULL COMMENT 'amount in stock available to buy',
|
||||
`buy` varchar(255) NOT NULL COMMENT '[[Qty,Class,Type],]',
|
||||
@@ -96,10 +97,11 @@ diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
||||
// trade_items.sqf | [part_out, part_in, qty_out, qty_in,_textPart,_textCurrency];
|
||||
if(_qty <= 0) then {
|
||||
_Display = format["Buy %1 (Out of Stock: %2)", _textPart, _qty];
|
||||
_part = player addAction [_Display, "\z\addons\dayz_code\actions\trade_cancel.sqf",[], 0, true, false, "",""];
|
||||
//_part = player addAction [_Display, "\z\addons\dayz_code\actions\trade_cancel.sqf",[], 0, true, false, "",""];
|
||||
_part = player addAction [_Display, _File,[_name,_bname,_out,_in,"buy",_textCurrency,_textPart,_header], _order, true, true, "",""];
|
||||
} else {
|
||||
_Display = format["Buy %1 for %2 %3 (Available: %4)", _textPart, _in, _textCurrency, _qty];
|
||||
_part = player addAction [_Display, _File,[_name,_bname,_out,_in,"buy",_textCurrency,_textPart], _order, true, true, "",""];
|
||||
_part = player addAction [_Display, _File,[_name,_bname,_out,_in,"buy",_textCurrency,_textPart,_header], _order, true, true, "",""];
|
||||
};
|
||||
|
||||
diag_log format["DEBUG TRADER: %1", _part];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
_dog = _this select 0;
|
||||
private ["_array", "_handle", "_type", "_onLadder"];
|
||||
_array = _this select 3;
|
||||
_handle = _array select 0;
|
||||
_type = _array select 1;
|
||||
@@ -12,10 +12,15 @@ switch (_type) do {
|
||||
case 0: {
|
||||
player removeMagazine "FoodSteakRaw";
|
||||
_handle setFSMVariable ["_hunger",0];
|
||||
player removeAction s_player_feeddog;
|
||||
s_player_feeddog = -1;
|
||||
|
||||
};
|
||||
case 1: {
|
||||
player removeMagazine "ItemWaterbottle";
|
||||
player addMagazine "ItemWaterbottleUnfilled";
|
||||
_handle setFSMVariable ["_hunger",0];
|
||||
_handle setFSMVariable ["_thirst",0];
|
||||
player removeAction s_player_waterdog;
|
||||
s_player_waterdog = -1;
|
||||
};
|
||||
};
|
||||
@@ -1,7 +1,8 @@
|
||||
_dog = _this select 0;
|
||||
private["_array","_handle","_whistle","_dog"];
|
||||
_array = _this select 3;
|
||||
_handle = _array select 0;
|
||||
_whistle = _array select 1;
|
||||
_dog = _handle getFSMVariable "_dog";
|
||||
|
||||
if(_whistle) then {
|
||||
[nil,player,rSAY,["dog_callBack", 120]] call RE;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
_array = _this select 3;
|
||||
_handle = _array;
|
||||
private ["_handle"];
|
||||
_handle = _this select 3;
|
||||
|
||||
_handle setFSMVariable ["_command","move"];
|
||||
|
||||
|
||||
@@ -1,19 +1,5 @@
|
||||
_dog = _this select 0;
|
||||
private ["_dog"];
|
||||
_dog = _this select 3;
|
||||
|
||||
_dog playActionNow "GestureBark";
|
||||
[_dog,"dog_bark",0,false] call dayz_zombieSpeak;
|
||||
/*
|
||||
_anim = animationState _dog;
|
||||
_sitDown = false;
|
||||
if(_anim == "Dog_SitDown") then {
|
||||
[objNull, _dog, rSwitchMove,"Dog_SitUp"] call RE;
|
||||
sleep 1;
|
||||
_sitDown = true;
|
||||
};
|
||||
|
||||
[objNull, _dog, rSwitchMove,"Dog_StopV2"] call RE;
|
||||
|
||||
if (_sitDown) then {
|
||||
waitUntil{(animationState _dog) != "Dog_StopV2"};
|
||||
[objNull, _dog, rSwitchMove,"Dog_SitDown"] call RE;
|
||||
};
|
||||
*/
|
||||
[_dog,"dog_bark",0,false] call dayz_zombieSpeak;
|
||||
@@ -1,33 +1,16 @@
|
||||
//_dog = _this select 0;
|
||||
private ["_array", "_handle", "_speed", "_dog"];
|
||||
_array = _this select 3;
|
||||
_handle = _array select 0;
|
||||
_whistle = _array select 1;
|
||||
_forceWalk = _array select 2;
|
||||
_speed = _array select 1;
|
||||
|
||||
_dog = _handle getFSMVariable "_dog";
|
||||
_maxSpeed = _handle getFSMVariable "_maxSpeed";
|
||||
player removeAction s_player_speeddog;
|
||||
s_player_speeddog = -1;
|
||||
|
||||
if(player distance _dog < 5) then {
|
||||
_whistle = false;
|
||||
};
|
||||
_dog = _handle getFSMVariable "_dog";
|
||||
|
||||
if(_forceWalk) then {
|
||||
_maxSpeed = _maxSpeed - 1;
|
||||
if (_maxSpeed < 0) then {
|
||||
_maxSpeed = 0;
|
||||
};
|
||||
if(_whistle) then {
|
||||
if(player distance _dog > 5) then {
|
||||
[nil,player,rSAY,["dog_slowDown", 120]] call RE;
|
||||
};
|
||||
} else {
|
||||
_maxSpeed = _maxSpeed + 1;
|
||||
if (_maxSpeed > 2) then {
|
||||
_maxSpeed = 2;
|
||||
};
|
||||
if(_whistle) then {
|
||||
[nil,player,rSAY,["dog_speedUp", 120]] call RE;
|
||||
};
|
||||
};
|
||||
|
||||
_handle setFSMVariable ["_maxSpeed",_maxSpeed];
|
||||
_handle setFSMVariable ["_forceChange",true];
|
||||
_handle setFSMVariable ["_maxSpeed", _speed];
|
||||
_dog setVariable ["currentSpeed", _speed];
|
||||
@@ -1,12 +1,13 @@
|
||||
_dog = _this select 0;
|
||||
private ["_handle", "_dog", "_standing", "_watchDog", "_anim"];
|
||||
_handle = _this select 3;
|
||||
_dog = _handle getFSMVariable "_dog";
|
||||
_standing = _handle getFSMVariable "_standing";
|
||||
_handle setFSMVariable ["_command","stay"];
|
||||
_watchDog = _handle getFSMVariable "_watchDog";
|
||||
|
||||
_anim = animationState _dog;
|
||||
if (_anim == "Dog_SitDown" and _watchDog) then {
|
||||
[objNull, _dog, rSwitchMove,"Dog_SitUp"] call RE;
|
||||
sleep 0.5;
|
||||
//[objNull, _dog, rSwitchMove,"Dog_SitUp"] call RE;
|
||||
//sleep 0.5;
|
||||
[objNull, _dog, rSwitchMove,"Dog_LieDown"] call RE;
|
||||
};
|
||||
@@ -1,8 +1,5 @@
|
||||
_array = _this select 3;
|
||||
_handle = _array;
|
||||
//_target = _array select 1;
|
||||
|
||||
_target = target1;
|
||||
private ["_handle"];
|
||||
_handle = _this select 3;
|
||||
|
||||
_handle setFSMVariable ["_command","track"];
|
||||
_handle setFSMVariable ["_target",_target];
|
||||
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
_dog = _this select 0;
|
||||
private ["_array", "_handle", "_watchDog", "_dog", "_warn"];
|
||||
_array = _this select 3;
|
||||
_handle = _array select 0;
|
||||
_watchDog = _array select 1;
|
||||
_dog = _handle getFSMVariable "_dog";
|
||||
|
||||
player removeAction s_player_warndog;
|
||||
s_player_warndog = -1;
|
||||
|
||||
_handle setFSMVariable ["_watchDog",_watchDog];
|
||||
|
||||
_actionWarn = _handle getFSMVariable "_actionWarn";
|
||||
_actionDir = _handle getFSMVariable "_actionDir";
|
||||
_dog removeAction _actionWarn;
|
||||
|
||||
if (_watchDog) then {
|
||||
_actionWarn = _dog addAction ["Quiet",_actionDir + "warn.sqf",[_handle,false], 2, false, true];
|
||||
_handle setFSMVariable ["_actionWarn",_actionWarn];
|
||||
_handle setFSMVariable ["_idleTime",5];
|
||||
_warn = {
|
||||
_handle = _this select 0;
|
||||
while {_watchDog and alive _dog} do {
|
||||
_watchDog = _handle getFSMVariable "_watchDog";
|
||||
_senseSkill = _handle getFSMVariable "_senseSkill";
|
||||
@@ -20,21 +18,16 @@ if (_watchDog) then {
|
||||
_nearby = (getPosATL _dog) nearEntities ["CAManBase",_senseSkill];
|
||||
_nearby = _nearby - [player];
|
||||
if (count _nearby > 0) then {
|
||||
//_chance = (3 - (count _nearby));
|
||||
//hintSilent str(_chance);
|
||||
[_dog,"dog_growl",2,false] call dayz_zombieSpeak;
|
||||
} else {
|
||||
/*
|
||||
_nearby = (getPosATL _dog) nearEntities ["CAAnimalBase",_senseSkill];
|
||||
_nearby = _nearby - [_dog];
|
||||
[_dog,"dog_bark",1,false] call dayz_zombieSpeak;
|
||||
*/
|
||||
};
|
||||
};
|
||||
sleep 2;
|
||||
};
|
||||
};
|
||||
|
||||
if (_watchDog) then {
|
||||
_handle setFSMVariable ["_idleTime",5];
|
||||
[_handle] spawn _warn;
|
||||
} else {
|
||||
_actionWarn = _dog addAction ["Alert",_actionDir + "warn.sqf",[_handle,true], 2, false, true];
|
||||
_handle setFSMVariable ["_actionWarn",_actionWarn];
|
||||
_handle setFSMVariable ["_idleTime",1];
|
||||
};
|
||||
@@ -40,6 +40,31 @@ switch (_item) do {
|
||||
case "Skin_Rocket_DZ": {
|
||||
_model = "Rocket_DZ";
|
||||
};
|
||||
case "Skin_RU_Policeman_DZ": {
|
||||
_model = "RU_Policeman_DZ";
|
||||
};
|
||||
case "Skin_Pilot_EP1_DZ": {
|
||||
_model = "Pilot_EP1_DZ";
|
||||
};
|
||||
case "Skin_Haris_Press_EP1_DZ": {
|
||||
_model = "Haris_Press_EP1_DZ";
|
||||
};
|
||||
case "Skin_Ins_Soldier_GL_DZ": {
|
||||
_model = "Ins_Soldier_GL_DZ";
|
||||
};
|
||||
case "Skin_GUE_Commander_DZ": {
|
||||
_model = "GUE_Commander_DZ";
|
||||
};
|
||||
case "Skin_Functionary1_EP1_DZ": {
|
||||
_model = "Functionary1_EP1_DZ";
|
||||
};
|
||||
case "Skin_Priest_DZ": {
|
||||
_model = "Priest_DZ";
|
||||
};
|
||||
case "Skin_Rocker2_DZ": {
|
||||
_model = "Rocker2_DZ";
|
||||
};
|
||||
|
||||
case "Skin_Soldier1_DZ": {
|
||||
_model = "Soldier1_DZ";
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ _category = (_this select 3) select 1;
|
||||
diag_log format["DEBUG TRADER OBJ: %1", _trader_id];
|
||||
|
||||
dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action];
|
||||
publicVariable "dayzTraderMenu";
|
||||
publicVariableServer "dayzTraderMenu";
|
||||
if (isServer) then {
|
||||
dayzTraderMenu call server_traders;
|
||||
};
|
||||
@@ -95,7 +95,7 @@ diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
||||
|
||||
// trade_items.sqf | [part_out, part_in, qty_out, qty_in,_textPart,_textCurrency];
|
||||
_Display = format["Sell %1 for %2 %3", _textPart, _sqty, _textCurrency];
|
||||
_part = player addAction [_Display, _File,[_sname,_name,_out,_in,"sell",_textPart,_textCurrency], _order, true, true, "",""];
|
||||
_part = player addAction [_Display, _File,[_sname,_name,_out,_in,"sell",_textPart,_textCurrency,_header], _order, true, true, "",""];
|
||||
|
||||
diag_log format["DEBUG TRADER: %1", _part];
|
||||
s_player_parts set [count s_player_parts,_part];
|
||||
|
||||
36
dayz_code/actions/tame_dog.sqf
Normal file
36
dayz_code/actions/tame_dog.sqf
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
File: tame_dog.sqf
|
||||
Author: Kane "Alby" Stone
|
||||
|
||||
Description:
|
||||
Allows a player to tame/domesticate a dog.
|
||||
Script is applied to object via addAction.
|
||||
|
||||
Variables:
|
||||
_target = Object that action is attached too.
|
||||
_caller = Object that activates the action.
|
||||
_id = ID of the action handler.
|
||||
_dog = Intended target of the script.
|
||||
*/
|
||||
|
||||
private["_target", "_caller", "_id", "_dog", "_pos", "_fsmid"];
|
||||
_target = _this select 0;
|
||||
_caller = _this select 1;
|
||||
_id = _this select 2;
|
||||
_dog = _this select 3;
|
||||
|
||||
player removeMagazine "FoodSteakRaw";
|
||||
_animalID = _dog getVariable "fsm_handle";
|
||||
_animalID setFSMVariable ["_isTamed", true];
|
||||
sleep 1;
|
||||
diag_log format["DEBUG: %1, id: %2 [%3]",_dog,_animalID,completedFSM _animalID];
|
||||
if (!moveToCompleted _dog) then {
|
||||
_dog moveTo (position _dog);
|
||||
};
|
||||
_dog disableAI "FSM";
|
||||
(group _dog) setBehaviour "AWARE";
|
||||
_fsmid = [_dog, typeOf _dog] execFSM "\z\addons\dayz_code\system\dog_agent.fsm";
|
||||
_fsmid setFSMVariable ["_handle", _fsmid];
|
||||
player setVariable ["dogID", _fsmid];
|
||||
_dog setVariable ["fsm_handle", _fsmid];
|
||||
_dog setVariable ["characterID", dayz_characterID, true];
|
||||
107
dayz_code/actions/trade_any_boat.sqf
Normal file
107
dayz_code/actions/trade_any_boat.sqf
Normal file
@@ -0,0 +1,107 @@
|
||||
private["_position","_veh","_location","_isOk","_backpack","_vehType","_trg","_key","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID"];
|
||||
|
||||
// [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], 10];
|
||||
_qty = count _obj;
|
||||
_bos = 1;
|
||||
};
|
||||
|
||||
|
||||
if (_qty >= _qty_in) then {
|
||||
|
||||
// server_tradeObject [_activatingPlayer,_traderID,_bos]
|
||||
dayzTradeObject = [_activatingPlayer,_traderID,_bos];
|
||||
publicVariableServer "dayzTradeObject";
|
||||
|
||||
if (isServer) then {
|
||||
dayzTradeObject call server_tradeObject;
|
||||
};
|
||||
|
||||
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 = 90;
|
||||
|
||||
_location = [(position player),0,20,1,2,20,0] call BIS_fnc_findSafePos;
|
||||
|
||||
//place tent (local)
|
||||
_veh = createVehicle [_part_out, _location, [], 0, "CAN_COLLIDE"];
|
||||
_veh setdir _dir;
|
||||
_veh setpos _location;
|
||||
|
||||
//_veh setPosATL _position;
|
||||
|
||||
player reveal _veh;
|
||||
_location = getPosATL _veh;
|
||||
|
||||
_veh setVariable ["characterID",dayz_playerUID,true];
|
||||
|
||||
// server_publishVeh [_veh,[_dir,_objPosition],_vehicle,true,dayz_characterID]
|
||||
dayzPublishVeh = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
|
||||
|
||||
publicVariableServer "dayzPublishVeh";
|
||||
if (isServer) then {
|
||||
dayzPublishVeh call server_publishVeh;
|
||||
};
|
||||
|
||||
cutText [format[("Bought %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
||||
} else {
|
||||
// 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];
|
||||
publicVariableServer "dayzDeleteObj";
|
||||
if (isServer) then {
|
||||
dayzDeleteObj call local_deleteObj;
|
||||
};
|
||||
|
||||
deleteVehicle _obj;
|
||||
|
||||
cutText [format[("Sold %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
|
||||
s_player_parts_crtl = -1;
|
||||
|
||||
} else {
|
||||
cutText [format[("Error insufficient quality %1"),_textPartIn] , "PLAIN DOWN"];
|
||||
};
|
||||
dayzTradeResult = nil;
|
||||
|
||||
} else {
|
||||
_needed = _qty_in - _qty;
|
||||
cutText [format[("Need %1 More %2"),_needed,_textPartIn] , "PLAIN DOWN"];
|
||||
};
|
||||
@@ -2,6 +2,8 @@ private["_position","_veh","_location","_isOk","_backpack","_vehType","_trg","_k
|
||||
|
||||
// [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;
|
||||
@@ -9,70 +11,95 @@ _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], 10];
|
||||
_qty = count _obj;
|
||||
_bos = 1;
|
||||
};
|
||||
|
||||
|
||||
if (_qty >= _qty_in) then {
|
||||
|
||||
if(_buy_o_sell == "buy") then {
|
||||
for "_x" from 1 to _qty_in do {
|
||||
player removeMagazine _part_in;
|
||||
};
|
||||
// server_tradeObject [_activatingPlayer,_traderID,_bos]
|
||||
dayzTradeObject = [_activatingPlayer,_traderID,_bos];
|
||||
publicVariableServer "dayzTradeObject";
|
||||
|
||||
_dir = 90;
|
||||
|
||||
_location = [(position player),0,20,1,0,20,0] call BIS_fnc_findSafePos;
|
||||
|
||||
//place tent (local)
|
||||
_veh = createVehicle [_part_out, _location, [], 0, "CAN_COLLIDE"];
|
||||
_veh setdir _dir;
|
||||
_veh setpos _location;
|
||||
|
||||
//_veh setPosATL _position;
|
||||
|
||||
player reveal _veh;
|
||||
_location = getPosATL _veh;
|
||||
|
||||
_veh setVariable ["characterID",dayz_playerUID,true];
|
||||
|
||||
// server_publishVeh [_veh,[_dir,_objPosition],_vehicle,true,dayz_characterID]
|
||||
dayzPublishVeh = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
|
||||
|
||||
publicVariable "dayzPublishVeh";
|
||||
if (isServer) then {
|
||||
dayzPublishVeh spawn server_publishVeh;
|
||||
};
|
||||
|
||||
cutText [format[("Bought %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
||||
} else {
|
||||
// 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];
|
||||
publicVariableServer "dayzDeleteObj";
|
||||
if (isServer) then {
|
||||
dayzDeleteObj call local_deleteObj;
|
||||
};
|
||||
|
||||
deleteVehicle _obj;
|
||||
|
||||
cutText [format[("Sold %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
||||
if (isServer) then {
|
||||
dayzTradeObject call server_tradeObject;
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
|
||||
s_player_parts_crtl = -1;
|
||||
_dir = 90;
|
||||
|
||||
_location = [(position player),0,20,1,0,20,0] call BIS_fnc_findSafePos;
|
||||
|
||||
//place tent (local)
|
||||
_veh = createVehicle [_part_out, _location, [], 0, "CAN_COLLIDE"];
|
||||
_veh setdir _dir;
|
||||
_veh setpos _location;
|
||||
|
||||
//_veh setPosATL _position;
|
||||
|
||||
player reveal _veh;
|
||||
_location = getPosATL _veh;
|
||||
|
||||
_veh setVariable ["characterID",dayz_playerUID,true];
|
||||
|
||||
// server_publishVeh [_veh,[_dir,_objPosition],_vehicle,true,dayz_characterID]
|
||||
dayzPublishVeh = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
|
||||
|
||||
publicVariableServer "dayzPublishVeh";
|
||||
if (isServer) then {
|
||||
dayzPublishVeh call server_publishVeh;
|
||||
};
|
||||
|
||||
cutText [format[("Bought %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
||||
} else {
|
||||
// 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];
|
||||
publicVariableServer "dayzDeleteObj";
|
||||
if (isServer) then {
|
||||
dayzDeleteObj call local_deleteObj;
|
||||
};
|
||||
|
||||
deleteVehicle _obj;
|
||||
|
||||
cutText [format[("Sold %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
|
||||
s_player_parts_crtl = -1;
|
||||
|
||||
} else {
|
||||
cutText [format[("Error insufficient quality %1"),_textPartIn] , "PLAIN DOWN"];
|
||||
};
|
||||
dayzTradeResult = nil;
|
||||
|
||||
} else {
|
||||
_needed = _qty_in - _qty;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
private["_iarray","_part_out","_part_in","_qty_out","_qty_in","_qty"];
|
||||
// [part_out,part_in, qty_out, qty_in,];
|
||||
|
||||
_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;
|
||||
@@ -8,10 +10,13 @@ _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 {
|
||||
_bos = 1;
|
||||
_qty = 0;
|
||||
_bag = unitBackpack player;
|
||||
_class = typeOf _bag;
|
||||
@@ -22,25 +27,46 @@ if(_buy_o_sell == "buy") then {
|
||||
|
||||
if (_qty >= _qty_in) then {
|
||||
|
||||
if(_buy_o_sell == "buy") then {
|
||||
for "_x" from 1 to _qty_in do {
|
||||
player removeMagazine _part_in;
|
||||
};
|
||||
removeBackpack player;
|
||||
player addBackpack _part_out;
|
||||
} else {
|
||||
// Sell
|
||||
for "_x" from 1 to _qty_out do {
|
||||
player addMagazine _part_out;
|
||||
};
|
||||
removeBackpack player;
|
||||
// player addBackpack _part_out;
|
||||
// server_tradeObject [_activatingPlayer,_traderID,_bos]
|
||||
dayzTradeObject = [_activatingPlayer,_traderID,_bos];
|
||||
publicVariableServer "dayzTradeObject";
|
||||
|
||||
if (isServer) then {
|
||||
dayzTradeObject call server_tradeObject;
|
||||
};
|
||||
|
||||
cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
||||
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;
|
||||
};
|
||||
removeBackpack player;
|
||||
player addBackpack _part_out;
|
||||
} else {
|
||||
// Sell
|
||||
for "_x" from 1 to _qty_out do {
|
||||
player addMagazine _part_out;
|
||||
};
|
||||
removeBackpack player;
|
||||
// player addBackpack _part_out;
|
||||
};
|
||||
|
||||
cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
||||
|
||||
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
|
||||
s_player_parts_crtl = -1;
|
||||
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
|
||||
s_player_parts_crtl = -1;
|
||||
|
||||
} else {
|
||||
cutText [format[("Error insufficient quality %1"),_textPartIn] , "PLAIN DOWN"];
|
||||
};
|
||||
dayzTradeResult = nil;
|
||||
|
||||
} else {
|
||||
_needed = _qty_in - _qty;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
private["_iarray","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_textPartIn","_textPartOut"];
|
||||
private["_iarray","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_textPartIn","_textPartOut","_bos"];
|
||||
// [part_out,part_in, qty_out, qty_in,];
|
||||
|
||||
_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;
|
||||
@@ -8,21 +10,48 @@ _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;
|
||||
|
||||
_qty = {_x == _part_in} count magazines player;
|
||||
|
||||
if (_qty >= _qty_in) then {
|
||||
|
||||
for "_x" from 1 to _qty_in do {
|
||||
player removeMagazine _part_in;
|
||||
_bos = 0;
|
||||
if(_buy_o_sell == "sell") then {
|
||||
_bos = 1;
|
||||
};
|
||||
|
||||
// server_tradeObject [_activatingPlayer,_traderID,_bos]
|
||||
dayzTradeObject = [_activatingPlayer,_traderID,_bos];
|
||||
publicVariableServer "dayzTradeObject";
|
||||
|
||||
for "_x" from 1 to _qty_out do {
|
||||
player addMagazine _part_out;
|
||||
if (isServer) then {
|
||||
dayzTradeObject call server_tradeObject;
|
||||
};
|
||||
|
||||
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 {
|
||||
for "_x" from 1 to _qty_in do {
|
||||
player removeMagazine _part_in;
|
||||
};
|
||||
|
||||
for "_x" from 1 to _qty_out do {
|
||||
player addMagazine _part_out;
|
||||
};
|
||||
|
||||
// [player,"repair",0,false] call dayz_zombieSpeak;
|
||||
cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
||||
} else {
|
||||
cutText [format[("Error insufficient quality %1"),_textPartIn] , "PLAIN DOWN"];
|
||||
};
|
||||
dayzTradeResult = nil;
|
||||
|
||||
|
||||
// [player,"repair",0,false] call dayz_zombieSpeak;
|
||||
cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
||||
|
||||
} else {
|
||||
_needed = _qty_in - _qty;
|
||||
|
||||
33
dayz_code/actions/trade_items_wo_db.sqf
Normal file
33
dayz_code/actions/trade_items_wo_db.sqf
Normal file
@@ -0,0 +1,33 @@
|
||||
private["_iarray","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_textPartIn","_textPartOut","_bos"];
|
||||
// [part_out,part_in, qty_out, qty_in,];
|
||||
|
||||
//_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;
|
||||
|
||||
_qty = {_x == _part_in} count magazines player;
|
||||
|
||||
if (_qty >= _qty_in) then {
|
||||
|
||||
for "_x" from 1 to _qty_in do {
|
||||
player removeMagazine _part_in;
|
||||
};
|
||||
|
||||
for "_x" from 1 to _qty_out do {
|
||||
player addMagazine _part_out;
|
||||
};
|
||||
|
||||
// [player,"repair",0,false] call dayz_zombieSpeak;
|
||||
cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
||||
|
||||
} else {
|
||||
_needed = _qty_in - _qty;
|
||||
cutText [format[("Need %1 More %2"),_needed,_textPartIn] , "PLAIN DOWN"];
|
||||
};
|
||||
@@ -1,6 +1,8 @@
|
||||
private["_iarray","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell"];
|
||||
private["_iarray","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_traderID","_bos"];
|
||||
// [part_out,part_in, qty_out, qty_in,"buy"];
|
||||
|
||||
_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;
|
||||
@@ -8,37 +10,61 @@ _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 {
|
||||
_qty = {_x == _part_in} count weapons player;
|
||||
_bos = 1;
|
||||
};
|
||||
|
||||
if (_qty >= _qty_in) then {
|
||||
|
||||
for "_x" from 1 to _qty_in do {
|
||||
if(_buy_o_sell == "buy") then {
|
||||
player removeMagazine _part_in;
|
||||
} else {
|
||||
player removeWeapon _part_in;
|
||||
};
|
||||
};
|
||||
|
||||
for "_x" from 1 to _qty_out do {
|
||||
if(_buy_o_sell == "buy") then {
|
||||
player addWeapon _part_out;
|
||||
} else {
|
||||
player addMagazine _part_out;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// [player,"repair",0,false] call dayz_zombieSpeak;
|
||||
cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
||||
|
||||
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
|
||||
s_player_parts_crtl = -1;
|
||||
// server_tradeObject [_activatingPlayer,_traderID,_bos]
|
||||
dayzTradeObject = [_activatingPlayer,_traderID,_bos];
|
||||
publicVariableServer "dayzTradeObject";
|
||||
|
||||
if (isServer) then {
|
||||
dayzTradeObject call server_tradeObject;
|
||||
};
|
||||
|
||||
waitUntil {!isNil "dayzTradeResult"};
|
||||
|
||||
diag_log format["DEBUG Complete Trade: %1", dayzTradeResult];
|
||||
|
||||
if(dayzTradeResult == "PASS") then {
|
||||
|
||||
for "_x" from 1 to _qty_in do {
|
||||
if(_buy_o_sell == "buy") then {
|
||||
player removeMagazine _part_in;
|
||||
} else {
|
||||
player removeWeapon _part_in;
|
||||
};
|
||||
};
|
||||
|
||||
for "_x" from 1 to _qty_out do {
|
||||
if(_buy_o_sell == "buy") then {
|
||||
player addWeapon _part_out;
|
||||
} else {
|
||||
player addMagazine _part_out;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// [player,"repair",0,false] call dayz_zombieSpeak;
|
||||
cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
||||
|
||||
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
|
||||
s_player_parts_crtl = -1;
|
||||
|
||||
} else {
|
||||
cutText [format[("Error insufficient quality %1"),_textPartIn] , "PLAIN DOWN"];
|
||||
};
|
||||
dayzTradeResult = nil;
|
||||
|
||||
} else {
|
||||
_needed = _qty_in - _qty;
|
||||
|
||||
Reference in New Issue
Block a user