Jump to content
Sign in to follow this  
Nephris

player has fired red flare

Recommended Posts

Hi folks,

looks like i am too stupid to get the eventhandler working properly.

I want to react on a red flare fired.

I am using

player addEventHandler ["fired", {[_this select 5] execVM "myscript.sqf"}];

but what comes then?

I tried the following without any luck.

_projectile = _this select 0;
if (_projectile == "F_40mm_White") then {hint"hurra";} else {hint"ffs";}; 

Share this post


Link to post
Share on other sites

You are currently checking for the "Mode" used on the fire, not the weapon or projectile.

Event Handlers - Fired

More interesting is how you are currently dealing with the script, while you use the Fired Event Handler very well, you seem to miss part of how the execution of such actually happens.

You are executing a script from the EH (creating a new thread, scheduled one), while you definitely should put the code inside the execution part of the Event Handler.

Share this post


Link to post
Share on other sites

Got it working now by the following EH

player addeventhandler ["fired",{

_player = _this select 0;

_ammo = _this select 4;

if (_ammo == "F_40mm_White") then { hint "Whity fired" } else {hint "me fired a shit";};

}];

Share this post


Link to post
Share on other sites

Although this will never fire if you're looking for "red" flares, as in your original post. You are using "F_40mm_White"...:)

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  

×