Jump to content
  • 0

Safezones without Gear Menu "Open Backpack"


Cryten

Question

is it possible to disable the Gear menu "Open Backpack" so that other players can steal anything?

 

besr regards Cryten

 

is used this script.

Private ["_EH_Fired"];

if (isNil "inSafezone") then {
	inSafezone = false;
};

while {true} do {
	waitUntil { inSafeZone };
	titleText [format["Du betritts die SafeZone. GodMod Aktiviert!"],"PLAIN DOWN"]; titleFadeOut 4;

	waitUntil { player == vehicle player };

	thePlayer = vehicle player;
	_EH_Fired = thePlayer addEventHandler ["Fired", {
		titleText ["Deine Waffen sind deaktiviert!","PLAIN DOWN"]; titleFadeOut 4;
		NearestObject [_this select 0,_this select 4] setPos[0,0,0];
	}];

	player_zombieCheck = {};
	fnc_usec_damageHandler = {};
	fnc_usec_unconscious  = {};
	thePlayer removeAllEventHandlers "handleDamage";
	thePlayer addEventHandler ["handleDamage", {false}];
	thePlayer allowDamage false;

	waitUntil { !inSafeZone };

	titleText [format["Du verlaesst die Safezone. GodMod deaktiviert!"],"PLAIN DOWN"]; titleFadeOut 4;
	thePlayer removeEventHandler ["Fired", _EH_Fired];

	player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf";
	fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf";
	fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
	thePlayer addEventHandler ["handleDamage", {true}];
	thePlayer removeAllEventHandlers "handleDamage";
	thePlayer allowDamage true;
};
Link to comment
Share on other sites

Recommended Posts

  • 0

I may have a way to solve this. Im thinking:

  1. Player has self action to lock backpack.
  2. When they lock it removed the backpack and/or contents and stores it as a variable attached to the player
  3. Player gets self action to revert.

The server code would have to read that variable is present and use it instead. Also if a player put another back on, it would not be saved and would be lost when the player reverts.

 

Thoughts?

Link to comment
Share on other sites

  • 0

I suggest something similar once before on another forum. My idea was to tie the ability to tag as friendly into the safe zone system Instead of locking the backpacks.

 

++++++++++++++++++++
If a player enters a safe zone a script is activated that removes the "Open Backpack" option from the scroll menu thereby removing the ability to steal from a players backpack. This can be bypassed by tagging the other player as friendly basically saying "Hey, if you can build on my base you can take stuff out of my backpack."

Pseudo code
//Decides whether to allow the player to use the open backpack option based on the "Tagged as Friendly" system
void BackpackCheck() // This should be added to the process that builds the scroll menu when a player aims at an object
{
if (target.location = SAFEZONE) { // might want to also check if the object is a player first in order to cut down on bugs
     if target.TaggedAsFriendly {
           ScrollMenuOption.OpenBackpack.enabled = true
     }
     else {
           ScrollMenuOption.OpenBackpack.enabled = false
     }
}
     else {
          ScrollMenuOption.OpenBackpack.enabled = true
     }
};

+++++++++++++++++++++++++++++++++++

Link to comment
Share on other sites

  • 0

Does anyone know in which file(s) the code for "Open Backpack" resides, or is that all part of Arma 2?

 

Found this in another forum:

 

 

Could we have a Hint for a player whose backpack is being looked into (%player% is looking into your backpack.) and for the guy who's trying to steal (You're looking into %player%'s backpack. Any stolen items may result in kick/ban as it's against the rules.)?

 

Sounds like a pretty good alternative.

Link to comment
Share on other sites

  • 0

Am pretty sure that the open backpack is buried deep in the arma code.

 

The idea of removing the backpack and storing as a variable on the player is a good one. Better still store it somewhere in the safezone, one of the traders maybe ? Allow the variable to be public and include your player UID, that way if you log or lose connection you may still be able to retrieve your backpack after re-joining, if before a server restart..?

Link to comment
Share on other sites

  • 0

Even betterer. so 'hide backpack' option when in safe areas, that removes and stores backpack as variable. Player synch code: if backpack variable not empty then skip backpack sync to db ? actually removes work from the hive. Player has option to restore backpack while the backpack variable exists. Db unchanged. Can it be exploited :)

Link to comment
Share on other sites

  • 0

Well i suppose a hacker could change the variable...

 

I suppose you could you could do the swapping process on the server and store the var locally on the server. Not sure how it would do on a laggy server tho...

 

This would probably prevent duplication too  :wacko:

Link to comment
Share on other sites

  • 0

could describe it? would it be possible? 
 

	// Allow Owner to lock and unlock vehicle  
	if(_player_lockUnlock_crtl) then {
		if (s_player_lockUnlock_crtl < 0) then {
			_hasKey = _ownerID in _temp_keys;
			_oldOwner = (_ownerID == dayz_playerUID);
			if(locked _cursorTarget) then {
				if(_hasKey or _oldOwner) then {
					_Unlock = player addAction [format["Unlock %1",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",_cursorTarget, 2, true, true, "", ""];
					s_player_lockunlock set [count s_player_lockunlock,_Unlock];
					s_player_lockUnlock_crtl = 1;
				} else {
					_Unlock = player addAction ["<t color='#ff0000'>Locked</t>", "",_cursorTarget, 2, true, true, "", ""];
					s_player_lockunlock set [count s_player_lockunlock,_Unlock];
					s_player_lockUnlock_crtl = 1;
				};
			} else {
				if(_hasKey or _oldOwner) then {
					_lock = player addAction [format["Lock %1",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true, "", ""];
					s_player_lockunlock set [count s_player_lockunlock,_lock];
					s_player_lockUnlock_crtl = 1;
				};
			};
		};
		 
	} else {
		{player removeAction _x} forEach s_player_lockunlock;s_player_lockunlock = [];
		s_player_lockUnlock_crtl = -1;
	};
Link to comment
Share on other sites

  • 0

I don't think the back pack works like a vehicle.is more part of the player and inventory. is how I see it. Though not spent much time looking into it.

To add to this, there's a lot if talk of invulnerability when trading but people can still shoot out of the area. so, along with removing the backpack, remove all weapons ?

Area would need to be safe from zeds, have been killed by a zed at starry when trading guns in the tent..

Link to comment
Share on other sites

  • 0

I might have found a way, but i could only get this far using maca's safezone script:

Private ["_EH_Fired"];

if (isNil "inSafezone") then {
    inSafezone = false;
};

anti_theft = {
    Private ["_handled"];
    _handled = true;
    
    if ((_this select 1) == 2) then {
        [] spawn {
            sleep 3;
            (findDisplay 106) closeDisplay 2;
        };
    };
    
    _handled;
};
while {true} do {
    waitUntil { inSafeZone };
    titleText [format["Entering Trader Area - God Mode Enabled"],"PLAIN DOWN"]; titleFadeOut 4;
    
    ehID = (findDisplay 46) displayAddEventHandler ["MouseButtonDown", "_this call anti_theft"];

    waitUntil { player == vehicle player };
 
    thePlayer = vehicle player;
    _EH_Fired = thePlayer addEventHandler ["Fired", {
        titleText ["You can not fire your weapon in a Trader City Area","PLAIN DOWN"]; titleFadeOut 4;
        NearestObject [_this select 0,_this select 4] setPos[0,0,0];
    }];

    player_zombieCheck = {};
    fnc_usec_damageHandler = {};
    thePlayer removeAllEventHandlers "handleDamage";
    thePlayer addEventHandler ["handleDamage", {false}];
    thePlayer allowDamage false;  
    waitUntil { !inSafeZone };

    titleText [format["Exiting Trader Area - God Mode Disabled"],"PLAIN DOWN"]; titleFadeOut 4;
    thePlayer removeEventHandler ["Fired", _EH_Fired];

    player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf";
    fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf";
    thePlayer addEventHandler ["handleDamage", {true}];
    thePlayer removeAllEventHandlers "handleDamage";
    thePlayer allowDamage true;
    (findDisplay 46) displayRemoveEventHandler ["MouseButtonDown",ehID];
};

Here's how its supposed to work:

When somebody presses a mouse button inside the safezone, a mousebuttondown event gets fired. It checks if the mouse button is the middle one, and if the cursortarget is another player (+bonus check if friendly)

Then it checks in a loop for x seconds if the gear display is open, and closes it.

 

I tried adding the loop, but it broke the script :(

Maybe one of you can figure it out.

Link to comment
Share on other sites

  • 0

Hello,

 

I made a script to detect when the gear menu is open, and to force open your own gear menu. This prevents accessing gear from other players and vehicles.

 

Install instructions:

 

1. Save the code at the bottom of this post to "theft.sqf" in your mission pbo folder.

2. Open your "mission.sqm" file.

3. Find each occurrence of "canbuild = false;"

4. Append this afterwards: execVM ""theft.sqf"";

5. Save and play!

 

This is how one of the lines should look in the mission pbo:

expActiv="TitleText[""Now entering trader city Stary"",""PLAIN DOWN""]; canbuild = false; execVM ""theft.sqf"";";

// This script was written by SilverShot.
_fix = false;
while { !canbuild } do
{
	sleep 0.1;

	if( !isNull (FindDisplay 106) ) then
	{
		if( !_fix ) then
		{
			player action ["GEAR", ""];
			titleText["\n\nCan only access your gear in the safe zone.", "PLAIN DOWN",0];
			_fix = true;
		};
	} else {
		if( _fix ) then
		{
			_fix = false;
		};
	};
};
Link to comment
Share on other sites

  • 0

Done it exactly as above, get this error

ErrorMessage: File mpmissions\DayZ_Epoch_11.Chernarus\mission.sqm, line 1335: Config: End of line encountered after theft.sqf";ume

And how my line looks

expActiv="TitleText[""Now entering trader city Bash - god mode on"",""PLAIN DOWN""]; canbuild = false;"; execVM ""theft.sqf"";
Link to comment
Share on other sites

  • 0

Sorry I messed up the end, I have changed my post, it should be something like this, I am unable to check atm:

 

expActiv="TitleText[""Now entering trader city Stary"",""PLAIN DOWN""]; canbuild = false; execVM ""theft.sqf"";";

 

Thanks will test

Edit - Works nice, thanks

Link to comment
Share on other sites

  • 0

Sorry I messed up the end, I have changed my post, it should be something like this, I am unable to check atm:

 

expActiv="TitleText[""Now entering trader city Stary"",""PLAIN DOWN""]; canbuild = false; execVM ""theft.sqf"";";

 

This is like the most insane script addition a server can make today, I LOVE YOU FOR THAT!

Link to comment
Share on other sites

  • 0

Very very nice, how would this be added alongside the safezone script? Would you just add it to the bottom of that script?

 

I think it's best to keep the safezones and gear theft protection separate. The gear theft runs every 0.5 seconds where the safezones waits until you enter/leave the safe zones.

Link to comment
Share on other sites

  • 0

 

Hello,

 

I made a script to detect when the gear menu is open, and to force open your own gear menu. This prevents accessing gear from other players and vehicles.

 

Install instructions:

 

1. Save the code at the bottom of this post to "theft.sqf" in your mission pbo folder.

2. Open your "mission.sqm" file.

3. Find each occurrence of "canbuild = false;"

4. Append this afterwards: execVM ""theft.sqf"";

5. Save and play!

 

This is how one of the lines should look in the mission pbo:

expActiv="TitleText[""Now entering trader city Stary"",""PLAIN DOWN""]; canbuild = false; execVM ""theft.sqf"";";

// This script was written by SilverShot.
_fix = false;
while { !canbuild } do
{
	sleep 0.1;

	if( !isNull (FindDisplay 106) ) then
	{
		if( !_fix ) then
		{
			player action ["GEAR", ""];
			titleText["\n\nCan only access your gear in the safe zone.", "PLAIN DOWN",0];
			_fix = true;
		};
	} else {
		if( _fix ) then
		{
			_fix = false;
		};
	};
};

Ok guys i'm looking at my mission .sqm and it doesnt say anything about canbuild=false, but what it does have is:

 

"snip"

class Item0
		{
			position[]={4053.8501,364.76645,11668.645};
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="zonebash";
			expCond="(player distance zonebash) < 50;";
			expActiv="TitleText[""Now entering trader city Bash"",""PLAIN DOWN""]; placevault = false;";
			expDesactiv="TitleText[""Now leaving trader city Bash"",""PLAIN DOWN""]; placevault = true;";
			class Effects
			{
				soundDet="arabian_market_1";
			};
		};
		class Item1
		{
			position[]={11463.747,317.3078,11349.89};
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="zoneklen";
			expCond="(player distance zoneklen) < 50;";
			expActiv="TitleText[""Now entering trader city Klen"",""PLAIN DOWN""]; placevault = false;";
			expDesactiv="TitleText[""Now leaving trader city Klen"",""PLAIN DOWN""]; placevault = true;";
			class Effects
			{
				soundDet="arabian_market_1";
			};
		};
		class Item2
		{
			position[]={6344.8081,304.99023,7806.7598};
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="zonestary";
			expCond="(player distance zonestary) < 50;";
			expActiv="TitleText[""Now entering trader city Stary"",""PLAIN DOWN""]; placevault = false;";
			expDesactiv="TitleText[""Now leaving trader city Stary"",""PLAIN DOWN""]; placevault = true;";
			class Effects
			{
				soundDet="arabian_market_1";
			};
		};
	};
};

If i put it like,

expActiv="TitleText[""Now entering trader city Stary"",""PLAIN DOWN""]; canbuild = false; execVM ""theft.sqf"";";

 

 

Would that still work???

link for dropbox full mission.sqm

https://www.dropbox.com/s/jhizc6qq1gr8ewz/mission.sqm

Edited by Bags2247
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...