Jump to content
bumyplum

Preventing Grenade Throwing

Recommended Posts

Is there away that anyone knows that will prevent the player from being able to throw grenades for a certain time period?

Share this post


Link to post
Share on other sites
Just now, FallujahMedic -FM- said:

context? There is a "weapons safe" script out there. 

 

Idm the ability to fire just don't want people to throw grenades for a certain time period at the start of a mission

Share this post


Link to post
Share on other sites

Search is your friend.

http://www.armaholic.com/page.php?id=18751

One of the first original ones. Back in the day when everyone learnt that G is for grenade.

Or create your own... Simple Fired/Throw EH, depends on if you want to prevent just grenades. Though you can filter Fired EH anyway.

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers

 

Share this post


Link to post
Share on other sites
38 minutes ago, HazJ said:

Search is your friend.

http://www.armaholic.com/page.php?id=18751

One of the first original ones. Back in the day when everyone learnt that G is for grenade.

Or create your own... Simple Fired/Throw EH, depends on if you want to prevent just grenades. Though you can filter Fired EH anyway.

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers

 

How would I add the grenade you just threw back to your inventory, I've tried;

throw1 = currentThrowable player;
player additem throw1;

however, currentThrowable returns, ["SmokeShellBlue","SmokeShellBlueMuzzle",[1.00693e+00]] which makes it not able to add the item, how would i get the purely just the class name of current throwable?

Share this post


Link to post
Share on other sites
player addEventHandler ["FiredMan",
{
	params ["_unit", "_firer", "_distance", "_weapon", "_muzzle", "_mode", "_ammo", "_gunner"];
	if ( ([_mode] call BIS_fnc_itemType select 1) isEqualTo "Grenade" ) exitWith
	{
		hintSilent "You are not authorised to throw grenades yet.";
		deleteVehicle _ammo;
		_unit addMagazine _mode;
	};
}];

Add the above to initPlayerLocal.sqf in mission root, create one if doesn't exist. Quickly done. Can't override this EH. Might be a better way to do it. Using inGameUISetEventHandler to prevent actual grenade being thrown but a bit busy right now. May update this thread later with alternative solution.

 

Share this post


Link to post
Share on other sites
12 minutes ago, HazJ said:

player addEventHandler ["FiredMan",
{
	params ["_unit", "_firer", "_distance", "_weapon", "_muzzle", "_mode", "_ammo", "_gunner"];
	if ( ([_mode] call BIS_fnc_itemType select 1) isEqualTo "Grenade" ) exitWith
	{
		hintSilent "You are not authorised to throw grenades yet.";
		deleteVehicle _ammo;
		_unit addMagazine _mode;
	};
}];

Quickly done. Can't override this EH. Might be a better way to do it. Using inGameUISetEventHandler to prevent actual grenade being thrown but a bit busy right now. May update this threat later with alternative solution.

 

Even if i don't use it it still would be useful to know how to get the base class name of a players currentthrowable, and thanks for the help. 🙂

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

×