Jump to content
Sign in to follow this  
dzrealkiller

Stop players looting and dropping specific items...

Recommended Posts

Hello, I am working on a cool little mission and I am trying to stop players dropping items such as "ToolKit","MediKit" and also want to stop players looting these items from dead players.. How can I do this?

 

Any help Is appreciated. 

Share this post


Link to post
Share on other sites

create a onPlayerKilled.sqf in your mission folder and add the following

player removeItem "Medikit";
player removeItem "Toolkit";

That should work in theory, if you only want to remove those items from player units.

Share this post


Link to post
Share on other sites

Hmm sounds promising but thinking about it, wouldn't that delete the item? but if the dead player gets revived they wont no longer have their toolkit or medikit :S maybe a way to stop players looting bodies full stop?

Share this post


Link to post
Share on other sites

Hmm sounds promising but thinking about it, wouldn't that delete the item? but if the dead player gets revived they wont no longer have their toolkit or medikit :S maybe a way to stop players looting bodies full stop?

 

What revieve system do you use, usually players are not killed when they can be revieve, therefore the onPlayerKilled.sqf won't be executed.

Share this post


Link to post
Share on other sites

Currently non as I cant find any thing thats lightweight and /or working still working on that part but I am planning ahead :)

Share this post


Link to post
Share on other sites

I saw that you may have found a solution for this in another thread, but another option is using the "Take" event handler. I made a short video showing this as an example last week in response to a semi-related question.

 

In your case the following should work, it's admittedly a bit hacky of a way to do since containers get messy on dead units and backpacks.

player addEventHandler ["Take",{
	_unit = _this select 0; 
	_container = _this select 1;
	_item = _this select 2;

	if(_item isEqualTo "Medikit" || _item isEqualTo "ToolKit") then {
		_nearObjects = nearestObjects [_container, [], 3];
		_clear = true;
		{
			if(_x isKindOf "Man" && !alive _x) exitWith {
				_clear = false;
			};
		} count _nearObjects;

		if(!_clear) then {
			_unit removeItem _item;
			_container addItemCargoGlobal [_item, 1];
			hint "You can't pick that up!"
		};
	};
}];

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
Sign in to follow this  

×