Sign in to follow this  
JakeHekesFists

Disable UAV in SafeZone (Script)

5 posts in this topic

ExileClient_object_player_thread_safeZone.sqf
This script was made to stop people from being cheap and using the UAV in a god mode area. 
copy the contents of the pastebin link below to your mission pbo, add overwrite to CfgExileCustomCode.

eg. for example if you place the script in an exileOverwrites folder, do as below.

class CfgExileCustomCode {
	ExileClient_object_player_thread_safeZone = "exileOverwrites\ExileClient_object_player_thread_safeZone.sqf"; // disable UAV/Bicycles in Safezone
};

pastebin link below
https://pastebin.com/FnFm1tKy
 

/**
 * ExileClient_object_player_thread_safeZone
 *
 * Exile Mod
 * exile.majormittens.co.uk
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
/*****	JakeHekesFists Edit: 2017	*****/

private _vehicle = vehicle player;

// use these settings to toggle features on and off
private _disableUAV = true;				// disables player from connecting UAV to terminal in safe zone
private _disableBikes = false; 			// ejects players from bicycles in safe zone to prevent crazy bicycle ramming  - players can still pack bike if using enigma script. 

if (!ExilePlayerInSafezone) exitWith {false}; 

if (_disableUAV) then {
	if (alive (getConnectedUAV player)) then {
		player connectTerminalToUAV objNull;
		["ErrorTitleAndText", ["Warning!", "Do not operate the UAV from inside the Safe Zone"]] call ExileClient_gui_toaster_addTemplateToast;
	};
};

if (_vehicle isEqualTo player) then {
	if !(isNull ExileClientSafeZoneVehicle) then {
		ExileClientSafeZoneVehicle removeEventHandler ["Fired", ExileClientSafeZoneVehicleFiredEventHandler];	
		ExileClientSafeZoneVehicle = objNull;
		ExileClientSafeZoneVehicleFiredEventHandler = nil;
	};
} else {
	if (local _vehicle) then {	_vehicle allowDamage false;	};
	
	if (_disableBikes) then {
		if (_vehicle isKindOf "Bicycle") then {
			player setVelocity [0, 0, 0];
			player action [ "eject", _vehicle ];
			["ErrorTitleAndText", ["OFF YA BIKE M8", "Bicycles are not allowed in the SafeZone"]] call ExileClient_gui_toaster_addTemplateToast;
		};
	};
	
	if !(_vehicle isEqualTo ExileClientSafeZoneVehicle) then {
		if !(isNull ExileClientSafeZoneVehicle) then {
			ExileClientSafeZoneVehicle removeEventHandler ["Fired", ExileClientSafeZoneVehicleFiredEventHandler];	
			ExileClientSafeZoneVehicle = objNull;
			ExileClientSafeZoneVehicleFiredEventHandler = nil;
		};
		ExileClientSafeZoneVehicle = _vehicle;
		ExileClientSafeZoneVehicleFiredEventHandler = _vehicle addEventHandler ["Fired", {_this call ExileClient_object_player_event_onFiredSafeZoneVehicle}];
	};
};
true

Script works in a very simple way, it just checks if a player is connected to a UAV in the traders, and if they are. it disconnects them. 

There is also a feature in this script to automatically eject players from bicycles in the safezone, I have disabled it by default. I had some major issues with people griefing with the crazy collision physics of the bicycle in the traders. Can save your admins a lot of headaches if you turn it on.
Edit line 15 and 16 to toggle the features on/off. 

Feel free to use and edit the code however you see fit. 

  • Like 4

Share this post


Link to post
Share on other sites
Advertisement

I can not get this to work :( (unless it is deactivated for admins?)

I added the following to the config.cpp file (I just added the ExileClient_object... part under the current class CfgExileCustomCode

class CfgExileCustomCode {
	ExileClient_object_player_thread_safeZone = "exileOverwrites\ExileClient_object_player_thread_safeZone.sqf"; // disable UAV/Bicycles in Safezone
};

And created a folder called exileOverwrites in which there is now a exileOverwrites\ExileClient_object_player_thread_safeZone.sqf file with the rest of the code in it.

I can still access the UAV terminal in the trader safe zone.

Please can you assist?

Share this post


Link to post
Share on other sites
Advertisement

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.