Arma 3
aK Apr 26, 2022 @ 10:24am
Safe Zone PUB ZEUS
so i found something on reddit while searching for this topic.
the issue is that the safezone works only on me and not others, also it does not disable itself when i use removeEventHander like this:
player removeEventHandler ["FiredMan", grenadeSafety];

can anyone guide?


the safe zone code:

grenadeSafety = player addEventHandler ["FiredMan",
{
params ["", "_weapon", "", "", "", "_magazine", "_projectile"];

deleteVehicle _projectile;

if ( toLower _weapon in ["put","throw"] ) then
{
player addMagazine _magazine;
};
}];
< >
Showing 1-1 of 1 comments
iceman1980 May 15, 2022 @ 8:58pm 
Originally posted by aK حیکر:
so i found something on reddit while searching for this topic.
the issue is that the safezone works only on me and not others, also it does not disable itself when i use removeEventHander like this:
player removeEventHandler ["FiredMan", grenadeSafety];

can anyone guide?


the safe zone code:

grenadeSafety = player addEventHandler ["FiredMan",
{
params ["", "_weapon", "", "", "", "_magazine", "_projectile"];

deleteVehicle _projectile;

if ( toLower _weapon in ["put","throw"] ) then
{
player addMagazine _magazine;
};
}];

When run in the debug environment you have to run it on ALL machines. The way ArmA 3 does "multiplayer" it uses something called a client-server architecture, this means the way everything is handled has a "execution scope" this scope defines where the script, function or file will be run if you want this on all players at mission start and only run on players and not the server you can do the following.

Put that code into the init.sqf and then put
if (hasInterface player) then { grenadeSafety = player addEventHandler ["FiredMan", { params ["", "_weapon", "", "", "", "_magazine", "_projectile"]; deleteVehicle _projectile; if ( toLower _weapon in ["put","throw"] ) then { player addMagazine _magazine; }; }]; }

Bare in mind to add more to this you need to run a check if the player is near the safe zone by adding an if condition and checking the distance between your safe zone and the player if it is below a certain threshold then enable it if it is above it, then disable it. This then will make any player that attempts to throw a grenade not able to throw it.
Last edited by iceman1980; May 15, 2022 @ 9:00pm
< >
Showing 1-1 of 1 comments
Per page: 1530 50