Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onPlayerProjectileCreation does not work properly #3410

Closed
1 task done
ffsPLASMA opened this issue May 28, 2024 · 11 comments
Closed
1 task done

onPlayerProjectileCreation does not work properly #3410

ffsPLASMA opened this issue May 28, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@ffsPLASMA
Copy link

Describe the bug

The event does not trigger for following actions:

  • Shooting a tank
  • creating projectiles via createProjectile

Event works fine for:

  • Shooting hunter rockets and hydra flare/rockets
  • Shooting with rocketlauncher, throwing grenades/molotovs on foot

Steps to reproduce

Add the event and shoot a tank or use the code:

crun setTimer(createProjectile, 1000, 5, localPlayer, 19)

Version

Server: MTA:SA Server v1.6-release-22472

Additional context

No response

Relevant log output

No response

Security Policy

  • I have read and understood the Security Policy and this issue is not security related.
@ffsPLASMA ffsPLASMA added the bug Something isn't working label May 28, 2024
@srslyyyy
Copy link
Contributor

As far i remember tank only creates explosion, and not projectile.

@ffsPLASMA
Copy link
Author

As far i remember tank only creates explosion, and not projectile.

Isnt it a tank grenade which is sort of projectile, could be totally wrong here.
Even then there should be a hint saying about that.

@srslyyyy
Copy link
Contributor

srslyyyy commented May 28, 2024

As far i remember tank only creates explosion, and not projectile.

Isnt it a tank grenade which is sort of projectile, could be totally wrong here. Even then there should be a hint saying about that.

I don't see tank grenade in createProjectile wiki page. But it is here, see: explosion types

@MegadreamsBE
Copy link
Member

I believe tank grenades are indeed not an actual projectile. The game just creates an explosion at the location you're aiming at but does not create a projectile in the process.

@ffsPLASMA
Copy link
Author

Alright but why is it not triggering for createProjectile?

@botder
Copy link
Member

botder commented May 29, 2024

Alright but why is it not triggering for createProjectile?

I guess because the event is coming from a hook when projectiles get created, and the game never creates an actual projectile for explosions.

@ffsPLASMA
Copy link
Author

Alright but why is it not triggering for createProjectile?

I guess because the event is coming from a hook when projectiles get created, and the game never creates an actual projectile for explosions.

so the wiki entry is wrong:

This event is triggered every time a projectile is created by a player - either through a weapon, a vehicle weapon or createProjectile.

@botder
Copy link
Member

botder commented May 29, 2024

so the wiki entry is wrong:

This event is triggered every time a projectile is created by a player - either through a weapon, a vehicle weapon or createProjectile.

Sorry, I was thinking about the client-side. This is server-side:

if (pPlayer && pPlayer->IsJoined())

and some lines below:
if (!pPlayer->CallEvent("onPlayerProjectileCreation", arguments))

Edit: Each "clientside local" projectile that triggers onClientProjectileCreation sends a projectile sync packet to the server.

@Zangomangu
Copy link
Contributor

Alright but why is it not triggering for createProjectile?

The reason is that the game doesn't spawn a projectile if it gets instantly blocked, it's documented on the wiki page srsly linked

image

@ffsPLASMA
Copy link
Author

Alright but why is it not triggering for createProjectile?

The reason is that the game doesn't spawn a projectile if it gets instantly blocked, it's documented on the wiki page srsly linked

image

Thanks for clarification :3

@ffsPLASMA
Copy link
Author

resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants