Duping script - Fix?

Brave Sir Robin

Valued Member!
Hi guys. I have a duping script that works ok. Cudos to whoever wrote it I have no idea.
The problem i am having is that it uses the cursertarget as a reference so if a player tries to dupe and looks at the staorage box its fine, if they look away from it though it doesn't work.
I am sure you can change it to use nearEntities. This is the original:
Code:
private ["_escMenu","_typf","_mxBckpcks"];

disableSerialization;
waitUntil {!isNull findDisplay 49};
_escMenu = findDisplay 49;
{
   _typf = typeOf cursortarget;
   _mxBckpcks = getNumber (configFile >> "CfgVehicles" >> _typf >> "transportmaxbackpacks");
   if (!(isNull _x) && (canbuild) && !(_x == player || typeOf _x in ["WeaponHolder","DebugBoxPlayer_DZ"]) && (_mxBckpcks > 0)) exitWith
   {
      titleText ["<Anti-Dupe>: You cannot log out near a storage unit!", "PLAIN DOWN", 3];
      systemchat "<Anti-Dupe>: You cannot log out near a storage unit!";
      _escMenu closedisplay 0;
   };
} foreach (nearestObjects [player, ["All"], 7.5]);
And this is what I think:
Code:
private ["_escMenu","_typf","_mxBckpcks"];

disableSerialization;
waitUntil {!isNull findDisplay 49};
_escMenu = findDisplay 49;
{
   _typf = typeOf cursortarget;
   _mxBckpcks = getNumber (configFile >> "CfgVehicles" >> _typf >> "transportmaxbackpacks");
   if (!(isNull _x) && (canbuild) && !(_x == player || typeOf _x in ["WeaponHolder","DebugBoxPlayer_DZ"]) && (_mxBckpcks > 0)&& nearEntities [["DZE_LockableStorage","DZE_isNewStorage"],5]) exitWith
   {
      titleText ["<Anti-Dupe>: You cannot log out near a storage unit!", "PLAIN DOWN", 3];
      systemchat "<Anti-Dupe>: You cannot log out near a storage unit!";
      _escMenu closedisplay 0;
   };
} foreach (nearestObjects [player, ["All"], 7.5]);
This uses the DZE_LockableStorage and DZE_isNewStorage global variables to pick out the epoch storage.
 
one question:

is this working for you?
i havent tested it yet, but when i read the following, i think there are missing something:

https://community.bistudio.com/wiki/nearEntities


how about this?:

Code:
private ["_escMenu","_typf","_mxBckpcks"];

disableSerialization;
waitUntil {!isNull findDisplay 49};
_escMenu = findDisplay 49;
{
   _typf = typeOf cursortarget;
   _mxBckpcks = getNumber (configFile >> "CfgVehicles" >> _typf >> "transportmaxbackpacks");
   if (!(isNull _x) && (canbuild) && !(_x == player || typeOf _x in ["WeaponHolder","DebugBoxPlayer_DZ"]) && (_mxBckpcks > 0) && (count (player nearEntities [["DZE_LockableStorage","DZE_isNewStorage"],5]) > 0)) exitWith
   {
      titleText ["<Anti-Dupe>: You cannot log out near a storage unit!", "PLAIN DOWN", 3];
      systemchat "<Anti-Dupe>: You cannot log out near a storage unit!";
      _escMenu closedisplay 0;
   };
} foreach (nearestObjects [player, ["All"], 7.5]);
 
Back
Top