Jump to content

[Release] Gebriel Safe Zones Maybe


Recommended Posts

Using the latest version of this script and encountered this problem.

 

When i use infistar to tp up in the air and fall down it doesnt hurt me. But when someone shoots, it does. I am talking about the 30 secs god mode.

 

here is a short vid

 

Link to comment
Share on other sites

Great Gr8Boi! Man, your video is awesome!

Try to change this:

[] spawn {
	while {!canbuild} do {
		player removeAllEventHandlers "handleDamage";
		uiSleep 0.02;
	};
};
To this:

[] spawn {
	while {inSafeZone} do {
		player removeAllEventHandlers "handleDamage";
		uiSleep 0.02;
	};
};
Edit: Changed !inSafeZone to inSafeZone.
Link to comment
Share on other sites

Yes, i can, buy i have not tested all those changes we two did. By the way you is testing it extensivelly, don't?

Yes, i am also modified the script on my own a little bit, works good so far, ofc there are some bugs still left for rpg backblast and throwing trash at people

Link to comment
Share on other sites

  • 3 weeks later...

3) [MISSION FOLDER]\DAYZ_CODE\COMPILE\FN_GEARMENUCHECKS.SQF

This code bellow goes at the end of your custom dayz_code\compile\fn_gearMenuChecks.sqf.

Thanks for Maca134 for the no-player-gear-acess-in-safe script.

To have a custom dayz_code\compile\fn_gearMenuChecks.sqf file you will need a custom dayz_code\init\compiles.sqf, since the first is called in game by the second, so you need a custom compiles.sqf that calls your custom fn_gearMenuChecks.sqf file, and since compiles.sqf is now custom, you need to change the call in init.sqf to it, since compiles.sqf is called in-game by init.sqf.

More on that later! Sorry for now! If you have any doubt, please ask!

//Prevents players opening others backpacks MACA123
if (isNil "inSafeZone") then {inSafeZone = false;};
if ((!canbuild || inSafeZone) 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;
};

//Gebriel Safezones
//by Donnovan from Brazil
if (!canbuild) then {
	private ["_don_iscar","_don_ismycar","_don_crew"];
	_don_iscar = false; _don_ismycar = false;
	if (_cTarget isKindOf "LandVehicle" || _cTarget isKindOf "Air" || _cTarget isKindOf "Ship" ) then {
		_don_crew = _cTarget getVariable ["don_crew", nil]; if (isNil "_don_crew") then {_don_crew = [getPlayerUID player];};
		_don_iscar = true; if ((getPlayerUID player) in _don_crew) then {_don_ismycar = true;};
	};
	if (_don_iscar && !_don_ismycar) then {
		[objNull, player, rSAY, "error1"] call RE;
		cutText ["You can't access this vehicle gear!" , "PLAIN DOWN"];
		_display closeDisplay 1;
	};
};

 

I really didnt understand a word from these...

 

1) Where from i can take this fn_gearmenuchecks.sqf? @Dayz_Epoch/addons/dayz_code/fn_gearmenuchecks.sqf ??

2) If this, so i copy that where?

3) And how do i call this fn_gearmenuchecks.sqf in compiles.sqf ?

4) And whats that code? What should i do with it?

 

P.s. sorry, im a bit newbie but i need to setup a server and i like this mod ;p

 

EDIT: Without above part i installed everything other and it says "no shooting on godon" so it should work, but zombies can kill me while im in trader city, and cant shoot. Ideas why?

Link to comment
Share on other sites

  • 4 weeks later...

Put fn_gearmenuchecks.sqf in your custom folder

go to your init.sqf make sure you have this line       (call compile preprocessFileLineNumbers "custom\compiles.sqf"; //Compile custom compiles)  without brackets 

That calls for your custom compiles file 

Then in compiles.sqf  Have this line                       (fn_gearMenuChecks = compile preprocessFileLineNumbers "custom\fn_gearMenuChecks.sqf";) without brackets

That calls for fn_gearmenuchecks.sqf

 

Hope that helps

Link to comment
Share on other sites

  • 3 weeks later...

I am trying to add in so that frindly tragets get acess to the vehicels, but i am a bit stuckt could somone please help me out :)?

Code i found to use so far:


_friendlies = player getVariable ["friendlyTo",[]];
if(_friendlies in _don_veh_crew) then {
??
};
Link to comment
Share on other sites

 

I am trying to add in so that frindly tragets get acess to the vehicels, but i am a bit stuckt could somone please help me out :)?

Code i found to use so far:


_friendlies = player getVariable ["friendlyTo",[]];
if(_friendlies in _don_veh_crew) then {
??
};

I would like to see this, as well as If people are in a same group making it compatible with DZGM

Link to comment
Share on other sites

  • 2 weeks later...

 

I am trying to add in so that frindly tragets get acess to the vehicels, but i am a bit stuckt could somone please help me out :)?

Code i found to use so far:


_friendlies = player getVariable ["friendlyTo",[]];
if(_friendlies in _don_veh_crew) then {
??
};

Could someone please help me out awaiting reply :)  Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

i dont think u have godmode against bullets at all, at least as soon as u come out of the safezone and you go into the timer, anyone can kill you with a weapon.

The godmode protects against zombies and bumps but not against bullets.

 

hope Donnovan is still active and can work on this again

 

the protection against thieves inside safezones is great, makes it well worth safezone script.

 

EDIT: anyone got godmode working on this ? ive tried everything that i could;

Link to comment
Share on other sites

  • 4 weeks later...

Here the script for Arma 3:
 
I believe they will aprove the topic soon, so it will appears on the Arma 3 Section, with more info. Hope you guys like it:

 

Main change: People in the same group can access others gear.

 

INSTALATION

 

Just run it in the mission file init.sqf.

//===============
// KONFIGURATION
//===============

//Altis Safezones
donn_traders = [
	["Altis Trader City 1",[13323,14527,0]],
	["Altis Trader City 2",[6177,16835,0]],
	["Altis Trader City 3",[18460,14259,0]]
];

//====================
// CLIENT SIDE SCRIPT
//====================

if (hasInterface) then {
	//SENSORS
	donn_notSafe = true;
	donn_safeZone_name = "(nothing)";
	{
		_x spawn {
			private ["_dist","_tPos","_tName","_maxVel","_tRad"];
			_tName = _this select 0;
			_tPos = _this select 1;
			_maxVel = 100;
			_tRad = 250;
			waitUntil {sleep 0.25;speed player > 1};
			while {true} do {
				_dist = player distance _tPos;
				while {_dist > 150} do {
					sleep ((((_dist - _tRad)/_maxVel) max 0.25) min 5);
					_dist = player distance  _tPos;
				};
				donn_notSafe = false;
				donn_safeZone_name = _tName;
				systemChat ("You are in safezone city: " + _tName);
				while {_dist < 150} do {
					sleep 0.25;
					_dist = player distance _tPos;
				};
				donn_notSafe = true;
				donn_safeZone_name = "(nenhuma)";
				systemChat ("You leaved safezone city: " + _tName);
			};
		};
	} forEach donn_traders;

	//Safe zone Functions
	donn_avoidGearAccess = {
		_protecting = [];
		_toProtect = donn_pv_protected_veh select 1;
		_toUnprotect = [];
		_protectVersion = donn_pv_protected_veh select 0;
		while {!donn_notSafe} do {
			{
				_x addEventHandler ["ContainerOpened", {
					_veh = _this select 0;
					_player = _this select 1;
					_veh_crew = _veh getVariable ['don_crew', nil];
					if (isNil '_veh_crew') then {_veh_crew = [getPlayerUID _player];};
					_groupUnits = units _player;
					_canAccess = false;
					{
						if (getPlayerUID _x in _veh_crew) then {
							_canAccess = true;
						};
					} forEach _groupUnits;
					if (!_canAccess)then {
						systemChat format ['%1, you cant access this gear.', name _player];
						_player action ["Gear", objNull];
					};
				}];
			} forEach _toProtect;
			{
				_x removeAllEventHandlers "ContainerOpened";
			} forEach _toUnprotect;
			_protecting = _protecting + _toProtect - _toUnprotect;
			waitUntil {sleep 0.2;donn_pv_protected_veh select 0 > _protectVersion};
			_toProtect = (donn_pv_protected_veh select 1) - _protecting;
			_toUnprotect = _protecting - (donn_pv_protected_veh select 1);
		};
		{
			_x removeAllEventHandlers "ContainerOpened";
		} forEach _protecting;
	};
	
	//Safezone
	don_incar = false;
	don_firedEH_1 = nil;
	donn_godMode = false;
	[] spawn {
		private ['_runOneTime','_donn_notSafe','_don_passengers','_don_veh_crew','_don_player_veh','_don_veh_driver'];
		waitUntil {!(isNil 'donn_notSafe')};
		_runOneTime = false;
		_donn_notSafe = donn_notSafe;
		while {true} do {
			waitUntil {!((_donn_notSafe && donn_notSafe) || (!_donn_notSafe && !donn_notSafe)) || !_runOneTime};
			_donn_notSafe = donn_notSafe;
			if (!_donn_notSafe) then {
				//Player God Mode
				player allowDamage false;
				donn_sz_fired = player addEventHandler ['Fired',{deleteVehicle (_this select 6);}];
				donn_godMode = true;
				
				//Protect Player Gear
				donn_pv_protected_veh_add = player;
				publicVariableServer "donn_pv_protected_veh_add";
				
				//Avoid player to access other Gears (turn off is automatic)
				[] spawn donn_avoidGearAccess;
			};
			if (_donn_notSafe && _runOneTime) then {
				//Player God Mode Off
				player allowDamage true;
				player removeEventHandler ["Fired",donn_sz_fired];
				donn_godMode = false;
				
				//Clear Player Gear Protection
				donn_pv_protected_veh_sub = player;
				publicVariableServer "donn_pv_protected_veh_sub";
			};
			if (!_donn_notSafe && don_incar) then {
				
				//Get Info
				_don_player_veh = don_player_veh;
				don_veh_crew = crew _don_player_veh;
				_don_veh_driver = driver _don_player_veh;
				
				if (player == _don_veh_driver) then {
					//Car God Mode
					_don_player_veh allowDamage false;
					_don_player_veh removeAllEventHandlers 'handleDamage';
					_don_player_veh addEventHandler ['handleDamage', {0}];
					_don_player_veh removeAllEventHandlers 'Fired';
					_don_player_veh addEventHandler ['Fired',{deleteVehicle (_this select 6);}];
					
					//Passenger Names
					_don_passengers = '';
					{if (alive _x) then {_don_passengers = _don_passengers + format [' %1',name _x];};} forEach don_veh_crew;
					
					//Passenger PlayerUID
					_don_veh_crew = [];
					{if (alive _x) then {_don_veh_crew = _don_veh_crew + [getPlayerUID _x];};} forEach don_veh_crew;

					//Put info on Vehicle
					_don_player_veh setVariable ['don_ownerity_code', format ['%1_%2', getPlayerUID player, round diag_tickTime], true];
					_don_player_veh setVariable ['don_crew', _don_veh_crew, true];
					_don_player_veh setVariable ['don_passengers', _don_passengers, true];

					//Protect Vehicle Gear
					donn_pv_protected_veh_add = _don_player_veh;
					publicVariable "donn_pv_protected_veh_add";
				};
				
			};
			if (_donn_notSafe && don_incar && _runOneTime) then {
				
				//Get Info
				_don_player_veh = don_player_veh;
				_don_veh_driver = driver _don_player_veh;			
				
				if (player == _don_veh_driver) then {
					//Clear Vehicle Protection Variables
					_don_player_veh setVariable ['don_ownerity_code', nil, true];
					_don_player_veh setVariable ['don_crew', nil, true];
					_don_player_veh setVariable ['don_passengers', nil, true];
				
					//Car God Mode Off
					_don_player_veh allowDamage true;
					_don_player_veh removeAllEventHandlers 'handleDamage';
					_don_player_veh removeAllEventHandlers 'Fired';
					
					//Clear Vehicle Gear Protection
					donn_pv_protected_veh_sub = _don_player_veh;
					publicVariableServer "donn_pv_protected_veh_sub";
				};
			};
			_runOneTime = true;
		};
	};
	[] spawn {
		private ['_don_veh_crew','_wait_time','_last_mark','_max_time'];
		while {true} do {
			_max_time = 480;
			waitUntil {sleep 0.0625; vehicle player != player};
			don_player_veh = vehicle player;
			don_incar = true;
			if (!donn_notSafe) then {
				_don_veh_crew = don_player_veh getVariable ['don_crew', nil];
				if (isNil '_don_veh_crew') then {_don_veh_crew = [getPlayerUID player];};
				_groupUnits = units player;
				_canAccess = false;
				{
					if (getPlayerUID _x in _don_veh_crew) then {
						_canAccess = true;
					};
				} forEach _groupUnits;
				if (!_canAccess) then {
					call compile format ['if (isNil ''don_%1'') then {don_%1 = diag_tickTime;}; _last_mark = don_%1;', don_player_veh getVariable ['don_ownerity_code', 0]];
					_wait_time = diag_tickTime - _last_mark;
					if (_wait_time < _max_time) then {
						while {player != vehicle player} do {
							player action ['getOut', don_player_veh];
							uiSleep 0.01;
						};
						cuttext [format ['Owners:%1. %2 seconds to liberate.', don_player_veh getVariable ['don_passengers','Owners not found'], round (_max_time - _wait_time)], 'PLAIN DOWN'];
						cad_pvar_smessage = [format ['%1 is messing with your vehicle! %2 seconds to liberate!', name player, round (_max_time - _wait_time)], _don_veh_crew];
						publicVariable 'cad_pvar_smessage';
					} else {
						call compile format ['don_%1 = nil;', don_player_veh getVariable ['don_ownerity_code', 0]];
						don_player_veh setVariable ['don_ownerity_code', nil, true];
						don_player_veh setVariable ['don_crew', nil, true];
						don_player_veh setVariable ['don_passengers', nil, true];
						cuttext [format ['Vehicle is now free for all!'], 'PLAIN DOWN'];
						cad_pvar_smessage = [format ['Vehicle invaded by %1!', name player], _don_veh_crew];
						publicVariable 'cad_pvar_smessage';
					};
				};
				don_player_veh allowDamage false;
				don_player_veh removeAllEventHandlers 'handleDamage';
				don_player_veh addEventHandler ['handleDamage', {0}];
				don_player_veh removeAllEventHandlers 'Fired';
				don_player_veh addEventHandler ['Fired',{deleteVehicle (_this select 6);}];
			};
			if (donn_notSafe) then {
				don_player_veh allowDamage true;
				don_player_veh removeAllEventHandlers 'handleDamage';
				don_player_veh removeAllEventHandlers 'Fired';
				if (player == driver don_player_veh) then {
					don_player_veh setVariable ['don_ownerity_code', nil, true];
					don_player_veh setVariable ['don_crew', nil, true];
					don_player_veh setVariable ['don_passengers', nil, true];
				};
			};
			waitUntil {sleep 0.0625; vehicle player == player};
			don_incar = false;
			don_player_veh = nil;
		};
	};
	//Remote Mensages
	'cad_pvar_smessage' addPublicVariableEventHandler {
		private ['_message', '_receivers'];
		_message = (_this select 1) select 0; _receivers = (_this select 1) select 1;
		if (getPlayerUID player in _receivers) then {cutText [_message, 'PLAIN DOWN'];};
	};
	diag_log "! SAZON OK !";
};

//=============
// SERVER SIDE
//=============
if (isServer) then {
	//DONN SaZon Protected Veh
	donn_pv_protected_veh = [0,[]];
	publicVariable "donn_pv_protected_veh";
	"donn_pv_protected_veh_add" addPublicVariableEventHandler {
		donn_pv_protected_veh set [0,(donn_pv_protected_veh select 0) + 1];
		donn_pv_protected_veh set [1,(donn_pv_protected_veh select 1) + [_this select 1]];
		publicVariable "donn_pv_protected_veh";
		diag_log ("[SAZON] Added veh to protection: " + str (_this select 1));
	};
	"donn_pv_protected_veh_sub" addPublicVariableEventHandler {
		donn_pv_protected_veh set [0,(donn_pv_protected_veh select 0) + 1];
		donn_pv_protected_veh set [1,(donn_pv_protected_veh select 1) - [_this select 1]];
		publicVariable "donn_pv_protected_veh";
		diag_log ("[SAZON] Deadded veh to protection: " + str (_this select 1));
	};
};
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...