Jump to content
BigEgg

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

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!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...