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

 

Hi,

 

I modified the version I made to allow the same as above, picking up ground items, but prevent access to vehicles/players. See my original message/instructions several posts up.

 

This version is based on the vehicle locked gear script by Zabn. It closes the gear menu when trying to access something that's invalid.

 

EDIT: It is still possible to access stuff you are not supposed to... urgh. I won't explain how but something needs to be done, this method is obviously not good enough.

// This script was written by SilverShot.

while { !canbuild } do

{

    waitUntil{canbuild or !isNull (FindDisplay 106)};

    if( !isNull (FindDisplay 106) ) then

    {

        if( !isNull cursorTarget ) then

        {

            _cTarget = cursorTarget;

            _blk = false;

            {

                if(!_blk) then {

                    _blk = _cTarget isKindOf _x;

                };

            } forEach ["LandVehicle","Air","Man"];

            if( _blk ) then {

                titleText["\n\nCan only access your gear in the safe zone.", "PLAIN DOWN",0];

                (FindDisplay 106) closeDisplay 1;

            };

        };

    };

};

 

 

great, very very great script! much for easier administration! But tell me more is how you can prevent Dress Costume in a safe area? (After the player to change clothes suit him for a while it is possible to steal), and even completely disable parts removed from vehicles in a safe zone (salvage vehicle) will tell if immensely gratefull

Link to comment
Share on other sites

  • 0

If you guys override the fn_gearMenuChecks.sqf and add these, it has the same effect without having a big loop on the go...

 

// Prevents players opening others backpacks
if (!canbuild and _cTarget isKindOf "Man" and alive _cTarget and (((vehicle player) distance _cTarget) < 12)) then {
cutText ["Cannot access other players gear in the safezone." , "PLAIN DOWN"];
_display closeDisplay 1;
};
Link to comment
Share on other sites

  • 0

Hey Guys,

 

my fn_gearMenuChecks.sqf is lookin like this:

private ["_cTarget","_isOk","_display","_inVehicle"];
disableSerialization;
_display = (_this select 0);
_inVehicle = (vehicle player) != player;
_cTarget = cursorTarget;
if(_inVehicle) then {
	_cTarget = (vehicle player);
};

_isOk = false;
{
	if(!_isOk) then {
		_isOk = _cTarget isKindOf _x;
	};
} forEach ["LandVehicle","Air", "Ship"];

if((locked _cTarget) and _isOk and (((vehicle player) distance _cTarget) < 12)) then {
	cutText [(localize "str_epoch_player_7") , "PLAIN DOWN"];
	_display closeDisplay 1;
};
if (!canbuild and _cTarget isKindOf "Man" and alive _cTarget and (((vehicle player) distance _cTarget) < 12)) then {
titleText["\n\nYou may only access your own gear in this area.", "PLAIN DOWN",0];
_display closeDisplay 1;
};

But I can still have access to players backpack in traderzones.

 

Does anyone know why this is happening?

I just pulled out the fn_gearMenuChecks.sqf of my dayz_code/compiles folder edited it and put it back into in, repacking dayz_code, uploaded it and restarted the server.

 

Would be nice if someone could help me,

 

 

Greetings

Link to comment
Share on other sites

  • 0

I just pulled out the fn_gearMenuChecks.sqf of my dayz_code/compiles folder edited it and put it back into in, repacking dayz_code, uploaded it and restarted the server.

 

Not sure what you mean by repacking/uploading dayz_code since that's client side...but the edited fn_gearMenuChecks.sqf needs to be packaged into your mission file, with a corresponding override in a custom compiles.sqf:

 

From:

fn_gearMenuChecks = compile preprocessFileLineNumbers "custom\fn_gearMenuChecks.sqf";

To (assuming file is in root menu):

fn_gearMenuChecks = compile preprocessFileLineNumbers "fn_gearMenuChecks.sqf";
Link to comment
Share on other sites

  • 0

Thanks mate, its working.

 

Do u know how to handle that u can get access to the backpack of  players whos tagged as friendly?

 

 

Thanks again

 

Greetings

Try something like this:

_Backpack_AllowFriendlyTaggedAccess = true;
if ( _ip ) then {
						_ctOwnerID = _ct getVariable["CharacterID","0"];
						_friendlies	= player getVariable ["friendlyTo",[]];
						if(_ctOwnerID in _friendlies) then {	
							if ( _Backpack_AllowFriendlyTaggedAccess ) then
							{
								_if = true;
							};
						};
					};
					
					
					//Is player friendly?
					if ( _if ) then { _skip = true; };
				};

if ( _skip && _if ) then {
systemChat ("This player is tagged friendly, you have access to this players bag");
};

 

This is code that was used for my anti-theft, it would be better to code it in the safezone.sqf if you have one.

You might need to declare the private variables.

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...