Jump to content

[Tutorial] Non-P4L Automatically Add Plot Owner to Plot


BigEgg

Recommended Posts

First, credit goes to @Zupa for his amazing Plot Management Mod.

 

This short tutorial is for those of you who use Plot Management without Plot 4 Life. It automatically adds the builder of the Plot Pole to the "Friends" list on the Plot so they don't have to remember to add themselves.

 

For this tutorial, I used the player_build.sqf from snap/vector build pro. It is designed around this player_build so please be sure you are using it!

 

At the top of player_build.sqf, add this to the private array:

,"_nearPlots", "_selectedPlot", "_onPlot", "_uidPlayer", "_playerName"

Then, find this block of code (around line 667):

_tmpbuilt setVariable ["CharacterID",dayz_characterID,true];

// fire?
if(_tmpbuilt isKindOf "Land_Fire_DZ") then {
	_tmpbuilt spawn player_fireMonitor;
} else {
	PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,_vector],_classname];
	publicVariableServer "PVDZE_obj_Publish";
};

Replace that block with this:

_tmpbuilt setVariable ["CharacterID",dayz_characterID,true];

if (_tmpbuilt isKindof "Plastic_Pole_EP1_DZ") then {
	PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,_vector],_classname];
	publicVariableServer "PVDZE_obj_Publish";
	_nearPlots = nearestObjects [player, ["Plastic_Pole_EP1_DZ"],15];
	_selectedPlot = _nearPlots select 0;
	_onPlot = _selectedPlot getVariable ["plotfriends",[]];
	_uidPlayer = getPlayerUID player;
	_playerName = name player;
	_onPlot = _onPlot  + [[_uidPlayer,_playerName]];
	_selectedPlot setVariable ["plotfriends", _onPlot, true];
	PVDZE_veh_Update = [_selectedPlot,"gear"];
	publicVariableServer "PVDZE_veh_Update";
	if (isServer) then {
		PVDZE_veh_Update call server_updateObject;
	};
} else {
	if(_tmpbuilt isKindOf "Land_Fire_DZ") then {
		_tmpbuilt spawn player_fireMonitor;
	} else {
		PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,_vector],_classname];
		publicVariableServer "PVDZE_obj_Publish";
	};
};

 

Go in game and test it out!

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

×
×
  • Create New...