+ [FIXED] Testing some dupe fixes now require that no player is nearby

when selling vehicles, safe actions, and "take" items.
This commit is contained in:
vbawol
2013-06-02 11:46:48 -05:00
parent 8fc7e16515
commit b24dce7298
6 changed files with 127 additions and 90 deletions

View File

@@ -6,6 +6,10 @@ if(player isKindOf "PZombie_VB") exitWith {};
if(TradeInprogress) exitWith { cutText ["Take item already in progress." , "PLAIN DOWN"]; };
TradeInprogress = true;
// Test cannot lock while another player is nearby
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]) > 1;
if(_playerNear) exitWith { TradeInprogress = false; cutText ["Cannot take item while another player is nearby." , "PLAIN DOWN"]; };
_array = _this select 3;
_type = _array select 0;
_classname = _array select 1;

View File

@@ -3,6 +3,10 @@ private ["_veh","_location","_isOk","_part_out","_part_in","_qty_out","_qty_in",
if(TradeInprogress) exitWith { cutText ["Trade already in progress." , "PLAIN DOWN"]; };
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 ["Cannot trade while another player is nearby." , "PLAIN DOWN"]; };
// [part_out,part_in, qty_out, qty_in, loc];
_activatingPlayer = _this select 1;

View File

@@ -3,6 +3,10 @@ private ["_veh","_location","_isOk","_part_out","_part_in","_qty_out","_qty_in",
if(TradeInprogress) exitWith { cutText ["Trade already in progress." , "PLAIN DOWN"]; };
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 ["Cannot trade while another player is nearby." , "PLAIN DOWN"]; };
// [part_out,part_in, qty_out, qty_in, loc];
_activatingPlayer = _this select 1;

View File

@@ -12,6 +12,10 @@ _obj = _this;
// Silently exit if object no longer exists
if(isNull _obj) exitWith { TradeInprogress = false; };
// Test cannot lock while another player is nearby
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 12]) > 1;
if(_playerNear) exitWith { TradeInprogress = false; cutText ["Cannot lock vault while another player is nearby." , "PLAIN DOWN"]; };
_ownerID = _obj getVariable["CharacterID","0"];
_objectID = _obj getVariable["ObjectID","0"];
_objectUID = _obj getVariable["ObjectUID","0"];

View File

@@ -9,7 +9,11 @@ TradeInprogress = true;
_obj = _this;
// Silently exit if object no longer exists
if(isNull _obj) exitWith { TradeInprogress = false; };
if(isNull _obj or !(alive _obj)) exitWith { TradeInprogress = false; };
// Test cannot lock while another player is nearby
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 12]) > 1;
if(_playerNear) exitWith { TradeInprogress = false; cutText ["Cannot pack vault while another player is nearby." , "PLAIN DOWN"]; };
_ownerID = _obj getVariable["CharacterID","0"];
_objectID = _obj getVariable["ObjectID","0"];
@@ -36,38 +40,37 @@ if(_location1 distance _location2 > 0.1) exitWith {
_obj setVariable["packing",0];
};
player playActionNow "Medic";
_dir = direction _obj;
_pos = _obj getVariable["OEMPos",(getposATL _obj)];
[player,"tentpack",0,false] call dayz_zombieSpeak;
sleep 3;
if(!isNull _obj and alive _obj) then {
if(!isNull _obj) then {
//place tent (local)
_bag = createVehicle ["WeaponHolder_ItemVault",_pos,[], 0, "CAN_COLLIDE"];
_bag setdir _dir;
_bag setpos _pos;
player reveal _bag;
_holder = "WeaponHolder" createVehicle _pos;
player playActionNow "Medic";
[player,"tentpack",0,false] call dayz_zombieSpeak;
sleep 3;
_weapons = getWeaponCargo _obj;
_magazines = getMagazineCargo _obj;
_backpacks = getBackpackCargo _obj;
//["dayzDeleteObj",[_objectID,_objectUID]] call callRpcProcedure;
// Remove from database
dayzDeleteObj = [_objectID,_objectUID];
publicVariableServer "dayzDeleteObj";
if (isServer) then {
dayzDeleteObj call server_deleteObj;
};
// Set down vault "take" item
_bag = createVehicle ["WeaponHolder_ItemVault",_pos,[], 0, "CAN_COLLIDE"];
// Delete original
deleteVehicle _obj;
_bag setdir _dir;
_bag setpos _pos;
player reveal _bag;
// Empty weapon holder
_holder = "WeaponHolder" createVehicle _pos;
//Add weapons
_objWpnTypes = _weapons select 0;
_objWpnQty = _weapons select 1;
@@ -95,7 +98,6 @@ if(!isNull _obj) then {
_countr = _countr + 1;
} forEach _objWpnTypes;
cutText ["Your Safe has been packed", "PLAIN DOWN"];
s_player_packvault = -1;

View File

@@ -6,96 +6,115 @@ private ["_objectID","_objectUID","_obj","_ownerID","_dir","_pos","_holder","_we
if(TradeInprogress) exitWith { cutText ["Unlock already in progress." , "PLAIN DOWN"]; };
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 ["Cannot unlock vault while another player is nearby." , "PLAIN DOWN"]; };
_obj = _this;
_alreadyPacking = _obj getVariable["packing",0];
_claimedBy = _holder getVariable["claimed","0"];
{player removeAction _x} forEach s_player_combi;s_player_combi = [];
s_player_unlockvault = 1;
_obj = _this;
// Silently exit if object no longer exists
if(isNull _obj) exitWith { TradeInprogress = false; };
// Silently exit if object no longer exists or alive
if(isNull _obj or !(alive _obj)) exitWith { TradeInprogress = false; };
_ownerID = _obj getVariable["CharacterID","0"];
_objectID = _obj getVariable["ObjectID","0"];
_objectUID = _obj getVariable["ObjectUID","0"];
player playActionNow "Medic";
_alreadyPacking = _obj getVariable["packing",0];
if (_alreadyPacking == 1) exitWith {TradeInprogress = false; s_player_unlockvault = -1; cutText ["That Safe is already being unlocked." , "PLAIN DOWN"]};
if (_alreadyPacking == 1) exitWith {TradeInprogress = false; cutText ["That Safe is already being unlocked." , "PLAIN DOWN"]};
// Promt user for password if _ownerID != dayz_playerUID
if ((_ownerID == dayz_combination) or (_ownerID == dayz_playerUID)) then {
_obj setVariable["packing",1];
// Check if any players are nearby if not allow player to claim item.
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]) > 1;
_playerID = getPlayerUID player;
// Only allow if not already claimed.
if (_claimedBy == "0" or !_playerNear) then {
// Since item was not claimed proceed with claiming it.
_holder setVariable["claimed",_playerID,true];
};
_dir = direction _obj;
// _pos = getposATL _obj;
_pos = _obj getVariable["OEMPos",(getposATL _obj)];
//player playActionNow "Medic";
sleep 1;
[player,"tentpack",0,false] call dayz_zombieSpeak;
sleep 5;
_objectID = _obj getVariable["ObjectID","0"];
_objectUID = _obj getVariable["ObjectUID","0"];
if(!isNull _obj) then {
_claimedBy = _holder getVariable["claimed","0"];
//place tent (local)
_holder = createVehicle ["VaultStorage",_pos,[], 0, "CAN_COLLIDE"];
_holder setdir _dir;
_holder setpos _pos;
player reveal _holder;
if (_claimedBy != _playerID) then {
_holder setVariable["CharacterID",_ownerID,true];
_holder setVariable["ObjectID",_objectID,true];
_holder setVariable["ObjectUID",_objectUID,true];
_holder setVariable ["OEMPos", _pos, true];
if(!isNull _obj and alive _obj) then {
_weapons = _obj getVariable["WeaponCargo",[]];
_magazines = _obj getVariable["MagazineCargo",[]];
_backpacks = _obj getVariable["BackpackCargo",[]];
_obj setVariable["packing",1];
// Remove locked vault
_weapons = _obj getVariable["WeaponCargo",[]];
_magazines = _obj getVariable["MagazineCargo",[]];
_backpacks = _obj getVariable["BackpackCargo",[]];
deleteVehicle _obj;
//player playActionNow "Medic";
sleep 1;
[player,"tentpack",0,false] call dayz_zombieSpeak;
sleep 5;
if (count _weapons > 0) then {
//Add weapons
_objWpnTypes = _weapons select 0;
_objWpnQty = _weapons select 1;
_countr = 0;
{
_holder addweaponcargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
//place tent (local)
_holder = createVehicle ["VaultStorage",_pos,[], 0, "CAN_COLLIDE"];
// Remove locked vault
deleteVehicle _obj;
_holder setdir _dir;
_holder setpos _pos;
player reveal _holder;
_holder setVariable["CharacterID",_ownerID,true];
_holder setVariable["ObjectID",_objectID,true];
_holder setVariable["ObjectUID",_objectUID,true];
_holder setVariable ["OEMPos", _pos, true];
if (count _weapons > 0) then {
//Add weapons
_objWpnTypes = _weapons select 0;
_objWpnQty = _weapons select 1;
_countr = 0;
{
_holder addweaponcargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
};
if (count _magazines > 0) then {
//Add Magazines
_objWpnTypes = _magazines select 0;
_objWpnQty = _magazines select 1;
_countr = 0;
{
_holder addmagazinecargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
};
if (count _backpacks > 0) then {
//Add Backpacks
_objWpnTypes = _backpacks select 0;
_objWpnQty = _backpacks select 1;
_countr = 0;
{
_holder addbackpackcargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
};
cutText ["Safe has been unlocked.", "PLAIN DOWN"];
};
if (count _magazines > 0) then {
//Add Magazines
_objWpnTypes = _magazines select 0;
_objWpnQty = _magazines select 1;
_countr = 0;
{
_holder addmagazinecargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
};
if (count _backpacks > 0) then {
//Add Backpacks
_objWpnTypes = _backpacks select 0;
_objWpnQty = _backpacks select 1;
_countr = 0;
{
_holder addbackpackcargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
};
cutText ["Safe has been unlocked.", "PLAIN DOWN"];
} else {
TradeInprogress = false;
cutText [format[(localize "str_player_beinglooted"),"Safe"] , "PLAIN DOWN"];
};
} else {
player playActionNow "Medic";
sleep 3;
sleep 1;
[player,"repair",0,false] call dayz_zombieSpeak;
null = [player,25,true,(getPosATL player)] spawn player_alertZombies;
sleep 5;