Jump to content

[HELP] Detect when a player throws a projectile


Recommended Posts

Posted

Hello,

I'm looking for a way to detect throwing a grenade/molotov/etc. onClientPlayerWeaponFire doesn't trigger for this. I was thinking about onClientKey + getPedWeapon, but my server has many situations where the "fire" control is disabled, so you can't shoot/throw a grenade. (Safe zone, god mode, and much more) So it would be really painful to put them in an "if" as exceptions and I might miss some of them. So onClientKey is very tricky, but I don't have a better solution. If someone has an idea, can they share with me/us, please?

Thanks for reading!

  • Moderators
Posted

Hi.

There is a dedicated event for this: https://wiki.multitheftauto.com/wiki/OnClientProjectileCreation
Event's first parameter is the creator who throws the projectile.

Cancel effect

This event cannot be cancelled. To remove the projectile you can use setElementPosition (some where far away) and then destroyElement (which makes it explode).

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...