Drakath Posted June 15, 2014 Share Posted June 15, 2014 Add an event: "onVehicleHitByProjectile". This should trigger a function when a vehicle is hit by a projectile. Link to comment
lopezloo Posted June 21, 2014 Share Posted June 21, 2014 Or just extend onClientVehicleCollision and made it working with projectiles. Link to comment
arezu Posted June 21, 2014 Share Posted June 21, 2014 https://wiki.multitheftauto.com/wiki/OnClientVehicleDamage is triggered when vehicle is damaged by projectiles also. Link to comment
Drakath Posted June 22, 2014 Author Share Posted June 22, 2014 And how will you check if it was projectile who hit the vehicle? Link to comment
MTA Team botder Posted July 4, 2014 MTA Team Share Posted July 4, 2014 getElementType(theAttacker) == "projectile" Link to comment
Drakath Posted August 4, 2014 Author Share Posted August 4, 2014 Attacker is player, not projectile. And I think it would be even better to add onElementHitByProjectile Link to comment
myonlake Posted August 4, 2014 Share Posted August 4, 2014 Projectiles are not synchronized so this cannot be done, at least for now the only thing you can do is have an approximate, but that can vary under certain circumstances. Why exactly would you need to look if the vehicle was hit by a projectile anyway? Use onClientExplosion as an alternative, and in case we are talking about a single scene you should be doing exactly this, and have it be attached through inside the function on to the vehicle you want to check for possible projectile explosions. Projectiles explode when they hit something (or time out), it should be about the closest thing you can do for now. Link to comment
Bonsai Posted August 4, 2014 Share Posted August 4, 2014 Well, there are Shooter maps that could really need such an event. But for now the best way to detect seem to be colshapes. Link to comment
arezu Posted August 7, 2014 Share Posted August 7, 2014 Attacker is player, not projectile.And I think it would be even better to add onElementHitByProjectile Check for the weapon id and check if the player is in a vehicle? Maybe checking the weapon id is enough. Link to comment
Drakath Posted August 7, 2014 Author Share Posted August 7, 2014 No, it's not. If you are talking about onClientPlayerWeaponFire, when throwing grenades it will not detect vehicle as a hitElement most of the time, unless it would be aimed very correctly. Link to comment
myonlake Posted August 8, 2014 Share Posted August 8, 2014 onClientPlayerWeaponFire does not trigger with projectiles. Projectiles are not necessarily always launched by a player weapon. The only way is to do what I explained above. Link to comment
Recommended Posts