Jump to content
  • 0

cannot log out in a plot you do not own


Buck0

Question

3 answers to this question

Recommended Posts

  • 0

Maybe something like this?

_isPole = (_classname == "Plastic_Pole_EP1_DZ");

_distance = DZE_PlotPole select 0;

if(_isPole) then {
	_distance = DZE_PlotPole select 1;
};

// check for near plot
_findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];
_findNearestPole = [];

{
	if (alive _x) then {
		_findNearestPole set [(count _findNearestPole),_x];
	};
} count _findNearestPoles;

_IsNearPlot = count (_findNearestPole);

canbuild = false;

if(_IsNearPlot == 0) then {

	// Allow building of plot
	if(_requireplot == 0) then {
		canbuild = true;
	};

} else {
	// Since there are plots nearby we check for ownership and then for friend status
	
	// check nearby plots ownership and then for friend status
	_nearestPole = _findNearestPole select 0;

	// Find owner 
	_ownerID = _nearestPole getVariable ["ownerPUID","0"];

	diag_log format["Player_build start: [PlayerUID = %1]  [OwnerID = %2]", _playerUID, _ownerID];

	// check if friendly to owner
	if(_playerUID == _ownerID) then {  //Keep ownership
		// owner can build anything within his plot except other plots
		if(!_isPole) then {
			canbuild = true;
		};

	} else {
		_friendlies = _nearestPole getVariable ["plotfriends",[]];
		_fuid  = [];
		{
			 _friendUID = _x select 0;
			 _fuid  =  _fuid  + [_friendUID];
		} forEach _friendlies;
		
		_builder  = getPlayerUID player;
		// check if friendly to owner
		if(_builder in _fuid) then {
			canbuild = true;
		};  
	};
};

That's just copied out of player Build.

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
  • Advertisement
  • Discord

×
×
  • Create New...