View Issue Details

IDProjectCategoryView StatusLast Update
0009441New issuesScriptingpublic2018-02-10 03:46
Reportereinheit-101Assigned To 
Status newResolutionopen 
Summary0009441: onClientVehicleDamage() caused by explosions triggers twice for some vehicles

As the description says, for some reason onClientVehicleDamage() triggers explosions twice for some vehicles. Its not limited to a model ID or so, its just happening randomly, it looks like MTA chooses a vehicle and decides to trigger twice, always. For example you have 2x Boxville, Boxville 1 triggers only 1 grenade explosion but Boxville 2 triggers twice.

I am trying to find out if my script is causing it, but had no luck so far, especially because its so god damn randomly happening. I have spawned 20 tanks of the same model without doing anything special and 3 are triggering twice.

Steps To Reproduce

function handleVehicleDamage()
cancelEvent()--to prevent the test vehicles from blowing up
addEventHandler("onClientVehicleDamage", root, handleVehicleDamage)

->Throw grenades to test vehicles, some vehicles may or may not put 2 lines of "trigger" into the chatbox.

TagsNo tags attached.



2016-10-26 00:51

administrator   ~~0025342

Is one vehicle receiving damage from both an exploding vehicle, and the grenade?

(If you put two vehicles next to each other, and then set the health of vehicle1 to 100, when vehicle1 explodes vehicle2 will receive damage.)


2016-10-26 01:00

reporter   ~~0025343

No, i really made sure that there is only this one vehicle in a radius of 20 meters or so. I cancelled any damage to the tanks so they wont explode to cause further explosions. Source vehicle userdata is in both triggers the same.


2016-10-26 12:41

viewer   ~~0025345

You could add a cool down timer.


2016-10-26 16:22

reporter   ~~0025346

That could prevent the event from triggering when another vehicle is damaged within the timer cooldown.
Instead it would be better to find out, why it even happens.


2016-10-26 20:29

viewer   ~~0025347

Noo I mean, cool down for that vehicle; not a global cool down.


2018-02-10 03:46

reporter   ~~0026425

Another interesting thing i discovered:
Whenever such an explosion triggers the event twice, the tick count increases by 1. So it doesnt happen absolutely simultaneously and a somewhat "safe" cooldown should be possible.

function handleVehicleDamage()
addEventHandler("onClientVehicleDamage", root, handleVehicleDamage)

Output for example:

Issue History

Date Modified Username Field Change