+ [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"]; }; if(TradeInprogress) exitWith { cutText ["Take item already in progress." , "PLAIN DOWN"]; };
TradeInprogress = true; 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; _array = _this select 3;
_type = _array select 0; _type = _array select 0;
_classname = _array select 1; _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"]; }; if(TradeInprogress) exitWith { cutText ["Trade already in progress." , "PLAIN DOWN"]; };
TradeInprogress = true; 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]; // [part_out,part_in, qty_out, qty_in, loc];
_activatingPlayer = _this select 1; _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"]; }; if(TradeInprogress) exitWith { cutText ["Trade already in progress." , "PLAIN DOWN"]; };
TradeInprogress = true; 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]; // [part_out,part_in, qty_out, qty_in, loc];
_activatingPlayer = _this select 1; _activatingPlayer = _this select 1;

View File

@@ -12,6 +12,10 @@ _obj = _this;
// Silently exit if object no longer exists // Silently exit if object no longer exists
if(isNull _obj) exitWith { TradeInprogress = false; }; 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"]; _ownerID = _obj getVariable["CharacterID","0"];
_objectID = _obj getVariable["ObjectID","0"]; _objectID = _obj getVariable["ObjectID","0"];
_objectUID = _obj getVariable["ObjectUID","0"]; _objectUID = _obj getVariable["ObjectUID","0"];

View File

@@ -9,7 +9,11 @@ TradeInprogress = true;
_obj = _this; _obj = _this;
// Silently exit if object no longer exists // 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"]; _ownerID = _obj getVariable["CharacterID","0"];
_objectID = _obj getVariable["ObjectID","0"]; _objectID = _obj getVariable["ObjectID","0"];
@@ -36,38 +40,37 @@ if(_location1 distance _location2 > 0.1) exitWith {
_obj setVariable["packing",0]; _obj setVariable["packing",0];
}; };
player playActionNow "Medic";
_dir = direction _obj; _dir = direction _obj;
_pos = _obj getVariable["OEMPos",(getposATL _obj)]; _pos = _obj getVariable["OEMPos",(getposATL _obj)];
if(!isNull _obj and alive _obj) then {
player playActionNow "Medic";
[player,"tentpack",0,false] call dayz_zombieSpeak; [player,"tentpack",0,false] call dayz_zombieSpeak;
sleep 3; sleep 3;
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;
_weapons = getWeaponCargo _obj; _weapons = getWeaponCargo _obj;
_magazines = getMagazineCargo _obj; _magazines = getMagazineCargo _obj;
_backpacks = getBackpackCargo _obj; _backpacks = getBackpackCargo _obj;
//["dayzDeleteObj",[_objectID,_objectUID]] call callRpcProcedure; // Remove from database
dayzDeleteObj = [_objectID,_objectUID]; dayzDeleteObj = [_objectID,_objectUID];
publicVariableServer "dayzDeleteObj"; 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; deleteVehicle _obj;
_bag setdir _dir;
_bag setpos _pos;
player reveal _bag;
// Empty weapon holder
_holder = "WeaponHolder" createVehicle _pos;
//Add weapons //Add weapons
_objWpnTypes = _weapons select 0; _objWpnTypes = _weapons select 0;
_objWpnQty = _weapons select 1; _objWpnQty = _weapons select 1;
@@ -95,7 +98,6 @@ if(!isNull _obj) then {
_countr = _countr + 1; _countr = _countr + 1;
} forEach _objWpnTypes; } forEach _objWpnTypes;
cutText ["Your Safe has been packed", "PLAIN DOWN"]; cutText ["Your Safe has been packed", "PLAIN DOWN"];
s_player_packvault = -1; s_player_packvault = -1;

View File

@@ -6,41 +6,64 @@ private ["_objectID","_objectUID","_obj","_ownerID","_dir","_pos","_holder","_we
if(TradeInprogress) exitWith { cutText ["Unlock already in progress." , "PLAIN DOWN"]; }; if(TradeInprogress) exitWith { cutText ["Unlock already in progress." , "PLAIN DOWN"]; };
TradeInprogress = true; 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 = []; {player removeAction _x} forEach s_player_combi;s_player_combi = [];
s_player_unlockvault = 1; s_player_unlockvault = 1;
_obj = _this; // Silently exit if object no longer exists or alive
if(isNull _obj or !(alive _obj)) exitWith { TradeInprogress = false; };
// Silently exit if object no longer exists
if(isNull _obj) exitWith { TradeInprogress = false; };
_ownerID = _obj getVariable["CharacterID","0"]; _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; cutText ["That Safe is already being unlocked." , "PLAIN DOWN"]};
if (_alreadyPacking == 1) exitWith {TradeInprogress = false; s_player_unlockvault = -1; cutText ["That Safe is already being unlocked." , "PLAIN DOWN"]};
// Promt user for password if _ownerID != dayz_playerUID // Promt user for password if _ownerID != dayz_playerUID
if ((_ownerID == dayz_combination) or (_ownerID == dayz_playerUID)) then { if ((_ownerID == dayz_combination) or (_ownerID == dayz_playerUID)) then {
// 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 = _obj getVariable["OEMPos",(getposATL _obj)];
_objectID = _obj getVariable["ObjectID","0"];
_objectUID = _obj getVariable["ObjectUID","0"];
_claimedBy = _holder getVariable["claimed","0"];
if (_claimedBy != _playerID) then {
if(!isNull _obj and alive _obj) then {
_obj setVariable["packing",1]; _obj setVariable["packing",1];
_dir = direction _obj; _weapons = _obj getVariable["WeaponCargo",[]];
// _pos = getposATL _obj; _magazines = _obj getVariable["MagazineCargo",[]];
_pos = _obj getVariable["OEMPos",(getposATL _obj)]; _backpacks = _obj getVariable["BackpackCargo",[]];
//player playActionNow "Medic"; //player playActionNow "Medic";
sleep 1; sleep 1;
[player,"tentpack",0,false] call dayz_zombieSpeak; [player,"tentpack",0,false] call dayz_zombieSpeak;
sleep 5; sleep 5;
if(!isNull _obj) then {
//place tent (local) //place tent (local)
_holder = createVehicle ["VaultStorage",_pos,[], 0, "CAN_COLLIDE"]; _holder = createVehicle ["VaultStorage",_pos,[], 0, "CAN_COLLIDE"];
// Remove locked vault
deleteVehicle _obj;
_holder setdir _dir; _holder setdir _dir;
_holder setpos _pos; _holder setpos _pos;
player reveal _holder; player reveal _holder;
@@ -50,14 +73,6 @@ if ((_ownerID == dayz_combination) or (_ownerID == dayz_playerUID)) then {
_holder setVariable["ObjectUID",_objectUID,true]; _holder setVariable["ObjectUID",_objectUID,true];
_holder setVariable ["OEMPos", _pos, true]; _holder setVariable ["OEMPos", _pos, true];
_weapons = _obj getVariable["WeaponCargo",[]];
_magazines = _obj getVariable["MagazineCargo",[]];
_backpacks = _obj getVariable["BackpackCargo",[]];
// Remove locked vault
deleteVehicle _obj;
if (count _weapons > 0) then { if (count _weapons > 0) then {
//Add weapons //Add weapons
_objWpnTypes = _weapons select 0; _objWpnTypes = _weapons select 0;
@@ -93,9 +108,13 @@ if ((_ownerID == dayz_combination) or (_ownerID == dayz_playerUID)) then {
cutText ["Safe has been unlocked.", "PLAIN DOWN"]; cutText ["Safe has been unlocked.", "PLAIN DOWN"];
}; };
} else {
TradeInprogress = false;
cutText [format[(localize "str_player_beinglooted"),"Safe"] , "PLAIN DOWN"];
};
} else { } else {
player playActionNow "Medic"; player playActionNow "Medic";
sleep 3; sleep 1;
[player,"repair",0,false] call dayz_zombieSpeak; [player,"repair",0,false] call dayz_zombieSpeak;
null = [player,25,true,(getPosATL player)] spawn player_alertZombies; null = [player,25,true,(getPosATL player)] spawn player_alertZombies;
sleep 5; sleep 5;