multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.38k stars 424 forks source link

onClientProjectileCreation won't be called if rocket explodes immediately #2393

Open ds1-e opened 2 years ago

ds1-e commented 2 years ago

Describe the bug Event won't be called if projectile (rocket) explodes pretty much instantly.

To reproduce

  1. Run code given below.
  2. Get rocket launcher.
  3. Shoot directly under your feet.
  4. Profit.
function onClientProjectileCreation()
    local tickCount = getTickCount()

    print(tickCount)
end
addEventHandler("onClientProjectileCreation", root, onClientProjectileCreation)

Expected behaviour It should be called.

Screenshots /

Version Client/server: MTA:SA Server v1.5.9-release-21002

Additional context /

MegadreamsBE commented 2 years ago

Question: is that projectile ever really created in this scenario?

ds1-e commented 2 years ago

Only explosion occurs, i've tested with getElementsByType and it shows 0 all the time. I (think that) might solve my issue by using onClientExplosion combined with onClientProjectileCreation - because onClientPlayerWeaponFire isn't reliable for rocket launcher.

Proxy-99 commented 3 months ago

more like a game bug

MegadreamsBE commented 3 months ago

more like a game bug

Not exactly, a bug implies that it wasn't intentional. However, if the explosion happens immediately there's never a need to create a projectile, which is something that R* devs quite likely considered when writing this code. Intentional game design that unfortunately clashes with our implementation of the projectile creation event.