Jump to content
Daiber

Personal locker or crate

Recommended Posts

Hello everyone, I'm making a tarkov style mission for my server but i've got a little problem, i can't find any script that could ( in multiplayer ) lock a chest ( or a crate ) to only one of my unit ( with a unique variable name ), i tried to search for a solution on google but i didn't find anything but some unfinished script, my purpose is not to find an entirely finished script but to understand how it could be done for a multiplayer purpose.
Thank you in advance

Share this post


Link to post
Share on other sites

Combine an inventory opened eventhandler with something like a UID in a setvariable.

 

So some code:

player addEventhandler ["InventoryOpened", {
	params ["_unit", "_container"];
	private _isAllowedIn = true;
	if (_container getVariable ["isPersonalLocker", false]) then {
		_isAllowedIn = (_container) getVariable ["personalLockerOwner", ""] == getPlayerUID _unit;
	
		if (_isAllowedIn) then {
			hint "welcome to your locker";
		} else {
			hint "this is not your locker";
		};
	};

	_isAllowedIn
}];

Untested.  You'll need to setVariable isPersonalLocker to true on any locker you want to be a personal locker and setVariable personalLockerOwner to the UID of the owner. 

Share this post


Link to post
Share on other sites

Okay thank you very much it will be a good base for the script ! I'll tell you if it works in a few days !

Share this post


Link to post
Share on other sites

After a long long long time trying to sort all of this i finally found a friend who did a new inventory system with Inidb2, but thank you very much for your answer ! 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×