Sign in to follow this  
MGTDB

Prevent logging out in enemy territory

5 posts in this topic

Not technically preventing logging out as players could just alt+f4, but moving them if they log out in an enemy territory. The X and Y amount the player is moved is based on territory radius plus a small amount

In ExileServer_system_network_event_onHandleDisconnect just below

if !(_unit getVariable ["ExileIsDead", false]) then
	{

Add the following

_territory = _unit call ExileClient_util_world_getTerritoryAtPosition;
		if!(isNull _territory)then
		{
			if!((_uid) in (_territory getVariable ["ExileTerritoryBuildRights",[]]))then
			{
				_radius = _territory getVariable ["ExileTerritorySize", 10];//if your level 1 radius is less than 15m adjust here
				_radius = _radius + 10;

				_pos0 = (_pos select 0) + _radius;
				_pos1 = (_pos select 1) + _radius;
				_pos2 = _pos select 2;
				if(_pos2 > 0.5) then //prevent player spawning back in the air if they logged out above ground in base
				{
					_pos2 = 0.1;
				};
				_positionnew = [_pos0,_pos1,_pos2];
				_unit setPos _positionnew;		

				//_logoutenemy = format ["%1 %2 logged out in enemy territory @ %3 %4 now moved %5m to %6 %7",_name,_uid,mapGridPosition _pos,_pos,_radius + 10,mapGridPosition _positionnew,_positionnew];// uncomment this line if you want infiSTAR logging
				//["LOGOUTENEMYBASE",_logoutenemy] call FNC_A3_CUSTOMLOG;// uncomment this line if you want infiSTAR logging

				//["toastRequest", ["InfoTitleAndText", ["A prisoner logged out in enemy territory @",mapGridPosition _unit]]] call ExileServer_system_network_send_broadcast;// uncomment this line if you want to broadcast logout to whole server
			};
		};

Then pack up  your server pbo and you're good to go
Edit: Updated to include better coordinates in logging, also option to alert whole server with a toast

Edited by MGTDB
  • Like 9

Share this post


Link to post
Share on other sites
Advertisement
On 1/14/2018 at 8:08 PM, MGTDB said:

Not technically preventing logging out as players could just alt+f4, but moving them if they log out in an enemy territory. The X and Y amount the player is moved is based on territory radius plus a small amount

In ExileServer_system_network_event_onHandleDisconnect just below


if !(_unit getVariable ["ExileIsDead", false]) then
	{

Add the following


_territory = _unit call ExileClient_util_world_getTerritoryAtPosition;
		if!(isNull _territory)then
		{
			if!((_uid) in (_territory getVariable ["ExileTerritoryBuildRights",[]]))then
			{
				_radius = _territory getVariable ["ExileTerritorySize", 10];//if your level 1 radius is less than 15m adjust here
				_radius = _radius + 10;

				_pos0 = (_pos select 0) + _radius;
				_pos1 = (_pos select 1) + _radius;
				_pos2 = _pos select 2;
				if(_pos2 > 0.5) then //prevent player spawning back in the air if they logged out above ground in base
				{
					_pos2 = 0.1;
				};
				_positionnew = [_pos0,_pos1,_pos2];
				_unit setPos _positionnew;		

				//_logoutenemy = format ["%1 %2 logged out in enemy territory @ %3 %4 now moved %5m to %6 %7",_name,_uid,mapGridPosition _pos,_pos,_radius + 10,mapGridPosition _positionnew,_positionnew];// uncomment this line if you want infiSTAR logging
				//["LOGOUTENEMYBASE",_logoutenemy] call FNC_A3_CUSTOMLOG;// uncomment this line if you want infiSTAR logging

				//["toastRequest", ["InfoTitleAndText", ["A prisoner logged out in enemy territory @",mapGridPosition _unit]]] call ExileServer_system_network_send_broadcast;// uncomment this line if you want to broadcast logout to whole server
			};
		};

Then pack up  your server pbo and you're good to go
Edit: Updated to include better coordinates in logging, also option to alert whole server with a toast

After i Add it the bodys when they disconnect because lose connection, the body's of the players stay on the map and not dissapear.
Did i did something wrong ?
i just add the scritp not override nothing.
Likes are dupping the bodies.

Share this post


Link to post
Share on other sites

How would I modify this to be a set area instead of enemy territory?  I'm trying to build a Sector B-like island (Remember Taviana?) and want to set it so people cannot log out there and not build there - just like the original.  I've got the no-build zone but how to modify this code for a specific area and radius (my Sector B island)?

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.