Jump to content
  • 0

Plot management


Emerghency

Question

Hello everyone, i recently installed plot management, group management, and door management from zupa. group and door management all work great. and it seems plot management does too, however when players are added to the friendly list on the plot and still does not allow them to build, it says the message "this building requires a plot within 30m" or whatever. There doesnt seem to be any errors in my RPT either.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Also make the change to player_build_plotCheck.sqf like so 

 

if(!DZE_ActionInProgress) exitWith {};
private ["_passArray","_isPole","_needText","_distance","_findNearestPoles","_findNearestPole","_IsNearPlot","_requireplot","_isLandFireDZ","_canBuildOnPlot","_nearestPole","_ownerID","_friendlies", "_playerUID"];

_isPole = _this select 0;
_requireplot = _this select 1;
_isLandFireDZ = _this select 2;

_needText = localize "str_epoch_player_246"; //text for when requirements not met
_canBuildOnPlot = false;
_nearestPole = objNull;
_ownerID = 0;
_friendlies = [];

if(_isPole) then { //check if object is plotpole and adjust distance accordingly 
	_distance = DZE_PlotPole select 1;
} else {
	_distance = DZE_PlotPole select 0;
};

_findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance]; //create an array of nearby objects that are plotpoles, nearest will always be first in array
_findNearestPole = []; //must define an empty array to avoid problems

{
	if (alive _x) then { //only look for non-destroyed plotpoles
		_findNearestPole set [(count _findNearestPole),_x]; //build an array of live plotpoles found nearby
	};
} count _findNearestPoles; //count each item in previously created array of nearby plotpoles

_IsNearPlot = count (_findNearestPole); 

if(_IsNearPlot == 0) then { 
	// Allow building of plot
	if(_requireplot == 0 || _isLandFireDZ) then {
		_canBuildOnPlot = true;
	};
} else {
	_nearestPole = _findNearestPole select 0; 

	if (DZE_APlotforLife) then {
		_playerUID = [player] call FNC_GetPlayerUID;
	}else{
		_playerUID = dayz_characterID;
	};

	_ownerID = _nearestPole getVariable ["ownerPUID","0"];

	if(_playerUID == _ownerID) then {  
		// owner can build anything within his plot except other plots
		if(!_isPole) then {
			_canBuildOnPlot = true;
		};
	} else {
		// disallow building plot
		if(!_isPole) then {
			_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 {
		_canBuildOnPlot = true;
	};
		};
	};
};

_passArray = [_IsNearPlot,_nearestPole,_ownerID,_friendlies]; 

// End script if item is plot pole and another one exists within defined radius
if(_isPole && _IsNearPlot > 0) exitWith { 
	DZE_ActionInProgress = false;
	cutText [(format [localize "str_epoch_player_44", DZE_PlotPole select 1]) , "PLAIN DOWN"];
	_passArray
};

if(!_canBuildOnPlot) exitWith { 
	DZE_ActionInProgress = false;
	cutText [format[(localize "STR_EPOCH_PLAYER_135"),_needText,_distance] , "PLAIN DOWN"];
	_passArray
};
_passArray //[int,Obj,int,array]

 

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