View Issue Details

IDProjectCategoryView StatusLast Update
0009441New issuesScriptingpublic2018-09-30 14:15
Reportereinheit-101Assigned To 
PrioritynormalSeverityminorReproducibilityrandom
Status closedResolutionno change required 
Summary0009441: onClientVehicleDamage() caused by explosions triggers twice for some vehicles
Description

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()
outputChatBox("trigger")
cancelEvent()--to prevent the test vehicles from blowing up
end
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.

Activities

qaisjp

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.)

einheit-101

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.

codylewiz

2016-10-26 12:41

viewer   ~~0025345

You could add a cool down timer.

einheit-101

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.

codylewiz

2016-10-26 20:29

viewer   ~~0025347

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

einheit-101

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()
outputChatBox(getTickCount())
end
addEventHandler("onClientVehicleDamage", root, handleVehicleDamage)

Output for example:
19141000
19141001

haron4igg

2018-07-16 16:57

viewer   ~~0026709

Found the same problem with S.W.A.T. It always getting doubled explosion damage for me. No difference what was the kind of explosions.

haron4igg

2018-07-16 16:59

viewer   ~~0026710

And i don't know might it be related or not, but sometimes i see 2x explosion log, from onVehicleExplode on server side, but not only for s.w.a.t.

qaisjp

2018-07-16 18:45

administrator   ~~0026713

Does this only happen with explosions? What if:

  • grenade explosion causes vehicle to explode
  • vehicle explosion causes itself to be damaged even further (can already exploded vehicles be damaged...? i.e with a punch?)

Are all of the onClientVehicleDamage arguments (element theAttacker, int theWeapon, float loss, float damagePosX, float damagePosY, float damagePosZ, int tireID) identical for both triggers?

haron4igg

2018-07-17 13:56

viewer   ~~0026746

Was trying to reproduce it again to record a video, but now without success on S.W.A.T,
Found this issue with exploded car (Elegy) today. So after explosion of car, each new explosion was leading to duplicated message in log. But after respawn - its gone.

But yes i can confirm that yesterday, it was:
single S.W.A.T in stream.
i tried different types of explosions, even scripted.
All of them were causing doubled message in message log, with 100% same parameters.
None of vehicles was exploded during yesterday experiment. (i did repair each time)

Later i spawned another vehicle (hotknife), but this vehicle was receiving single event.
Then i put them together, and Swat was receiving doubled event, but hotknife - not.

Issue History

Date Modified Username Field Change