Jump to content
Sign in to follow this  
KaLGaNoff

How to ensure the safety zone of 40mm he grenade (EGLM)?

Recommended Posts

How to implement it in the script? :confused:

/*
GrenadeStop v0.8 for ArmA 3 Alpha by Bake

DESCRIPTION:
Stops players from throwing grenades in safety zones.

INSTALLATION:
Move grenadeStop.sqf to your mission's folder. Then add the
following line to your init.sqf file (create one if necessary):
execVM "grenadeStop.sqf";

CONFIGURATION:
Edit the #defines below.
*/

#define SAFETY_ZONES	[["respawn_west", 500], ["respawn_east", 500]] // Syntax: [["marker1", radius1], ["marker2", radius2], ...]
#define MESSAGE			"Do not throw grenades inside the base!\nPress I instead of G to" +\
					" open your inventory.\nRebind the throw key to avoid accidents."

if (isDedicated) exitWith {};
waitUntil {!isNull player};

player addEventHandler ["Fired", {
if ((_this select 2 == "HandGrenadeMuzzle") || (_this select 2 == "MiniGrenadeMuzzle") || (_this select 2 == "DirectionalMineRangeMuzzle") || (_this select 2 == "TimeBombMuzzle") || (_this select 2 == "PipeBombMuzzle") || (_this select 2 == "DemoChargeMuzzle") || (_this select 2 == "MineMuzzle") || (_this select 2 == "ClassicMineWireMuzzle") || (_this select 2 == "ClassicMineRangeMuzzle") || (_this select 2 == "BoundingMineRangeMuzzle") || (_this select 2 == "Launch_RPG32_F") || (_this select 2 == "launch_NLAW_F")) then
{
	// Lazy evaluation now supported by default? Curly brackets not working.

	if ({(_this select 0) distance getMarkerPos (_x select 0) < _x select 1} count SAFETY_ZONES > 0) then
	{
		deleteVehicle (_this select 6);
		titleText [MESSAGE, "PLAIN", 3];
	};
};
}];

Share this post


Link to post
Share on other sites

Add

|| (_this select 4 == "G_40mm_HE")

to the long if statement in that code would be easiest as the muzzle for the 40mm are different on the different weapons e.g EGLM on the katiba and GL_3GL_F on the MX

Share this post


Link to post
Share on other sites
_muzzle_arr = getArray (configfile >> "CfgWeapons" >> currentWeapon player >> "muzzles");

if (count _muzzle_arr > 1) then
{
    // code
};

Share this post


Link to post
Share on other sites
Add
|| (_this select 4 == "G_40mm_HE")

to the long if statement in that code would be easiest as the muzzle for the 40mm are different on the different weapons e.g EGLM on the katiba and GL_3GL_F on the MX

Grateful. Everything works!

Thanks for the answers!

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  

×