Jump to content
Sign in to follow this  
ward1591

How Do I Add A Vehicle FIRED EventHandler

Recommended Posts

I am trying to add these two event handlers alongside with a player FIRED event handler which i know works. If anyone can help me with the issue i would most appreciate it THANKS!

#define SAFETY_ZONES    [["safezone1", 300]] // Syntax: [["marker1", radius1], ["marker2", radius2], ...]
#define MESSAGE "Firing/Grenades Disable while in safezone!"

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

player addEventHandler ["Fired", {
   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];
   };
}]; 

///////////////////////////I'M TRYING TO ADD EVERYTHING BELOW!!!//////////////////////////////////////////////

LandVehicle addEventHandler ["Fired", {
   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];
   };
}]; 

air addEventHandler ["Fired", {
   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

Here is the original script:

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

GrenadeStop v0.8 for ArmA 3 Alpha by Bake

In use it's the pre 2.80 Invade & Annex safe-zone script to stop people firing around the spawn area.

He's trying to implement the same effect for vehicles.

That safe-zone script is executed locally on the player, while a vehicle Fired EH should be added on the server machine.

Not sure which version you are working from, but find the setupUnit.sqf and put the code in there.

I never implemented a serverside Fired EH due to the performance burden of it, since it would apply to 40+ vehicles in that scenario.

If you want to do that, then it depends what version you're working from on where to put the EH.

If you're in a pre-2.79E version, find setupUnit.sqf and put your EH in there, pointing it to _unit instead of 'landvehicle' or 'air'.

If you're using a 279E or 2.80 version, find fn_vSetup02.sqf (in functions library) and put the code in there instead.

...

ward, there is a flaw with that method which is why it was never considered.

Vehicles can be 500m OUTSIDE the safezone and still fire upon players inside it. All this script would do in that case, is prevent the players from defending themselves by firing back.

If you were determined to go ahead with it, I would put a rating check on the crew of the vehicle.

ie.


<vehicle object> addEventHandler ["Fired", { 
_eComm = effectiveCommander (_this select 0);
if ((rating _eComm) < 0) exitWith { deleteVehicle (_this select 6);};
}];  

Rough and ready, but you get the idea.

If the player teamkills a few times, their rating will fall below 0. If their rating is below 0, ostensibly the vehicle will not allow the weapon system to fire. I have not tested this method, there may be locality issues with the rating command, but that is one way to go about it sensibly.

It is not perfect, all the offender would have to do is respawn and then their rating would be reset and they would be able to start teamkilling again. But it would give the other players a chance to defend themselves and/or call a staff member to ban the TKer.

Again I do not like this method because it adds a stack more evaluations to the server machine, but yea ...

Edited by MDCCLXXVI

Share this post


Link to post
Share on other sites
Here is the original script:

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

GrenadeStop v0.8 for ArmA 3 Alpha by Bake

In use it's the pre 2.80 Invade & Annex safe-zone script to stop people firing around the spawn area.

He's trying to implement the same effect for vehicles.

That safe-zone script is executed locally on the player, while a vehicle Fired EH should be added on the server machine.

Not sure which version you are working from, but find the setupUnit.sqf and put the code in there.

I never implemented a serverside Fired EH due to the performance burden of it, since it would apply to 40+ vehicles in that scenario.

If you want to do that, then it depends what version you're working from on where to put the EH.

If you're in a pre-2.79E version, find setupUnit.sqf and put your EH in there, pointing it to _unit instead of 'landvehicle' or 'air'.

If you're using a 279E or 2.80 version, find fn_vSetup02.sqf (in functions library) and put the code in there instead.

...

ward, there is a flaw with that method which is why it was never considered.

Vehicles can be 500m OUTSIDE the safezone and still fire upon players inside it. All this script would do in that case, is prevent the players from defending themselves by firing back.

If you were determined to go ahead with it, I would put a rating check on the crew of the vehicle.

ie.


<vehicle object> addEventHandler ["Fired", { 
_eComm = effectiveCommander (_this select 0);
if ((rating _eComm) < 0) exitWith { deleteVehicle (_this select 6);};
}];  

Rough and ready, but you get the idea.

If the player teamkills a few times, their rating will fall below 0. If their rating is below 0, ostensibly the vehicle will not allow the weapon system to fire. I have not tested this method, there may be locality issues with the rating command, but that is one way to go about it sensibly.

It is not perfect, all the offender would have to do is respawn and then their rating would be reset and they would be able to start teamkilling again. But it would give the other players a chance to defend themselves and/or call a staff member to ban the TKer.

Again I do not like this method because it adds a stack more evaluations to the server machine, but yea ...

OKAY THANKS MDCC! i couldn't see to figure out how to do it. Sorry dr_strangepete i just got back home so sorry for the late reply!

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  

×