Drakath Posted June 12, 2014 Share Posted June 12, 2014 When someone throws a grenade at a vehicle, script sets its health to 450 but it still explodes. Why? Link to comment
Drakath Posted June 12, 2014 Author Share Posted June 12, 2014 onClientPlayerWeaponFire Link to comment
MIKI785 Posted June 12, 2014 Share Posted June 12, 2014 I don't think that that gets triggered at all.. you're looking for this: onClientProjectileCreation. But still that gets called before the grenade explodes. Link to comment
Drakath Posted June 12, 2014 Author Share Posted June 12, 2014 It triggers, I tried it with outputChatBox. Link to comment
Drakath Posted June 12, 2014 Author Share Posted June 12, 2014 Oh, it does not pass vehicle as hitElement condition. Is there any other way to detect when grenade hits a vehicle? Link to comment
MIKI785 Posted June 12, 2014 Share Posted June 12, 2014 But still.. it gets called before it explodes... youre setting the health before it gets damaged. Maybe onClientVehicleDamage. Link to comment
Drakath Posted June 12, 2014 Author Share Posted June 12, 2014 When it gets damaged it does not explode instantly so setting the health would prevent it from exploding. Anyway, with onClientVehicleDamage I cannot check if it was grenade what hit the vehicle. Link to comment
Max+ Posted June 12, 2014 Share Posted June 12, 2014 Maybe this , would help , getPedTarget Link to comment
Drakath Posted June 12, 2014 Author Share Posted June 12, 2014 Well, it works when I actually aim (right mouse button) but no one does that with grenades. Any other way? Link to comment
Max+ Posted June 13, 2014 Share Posted June 13, 2014 This May work , addEventHandler('onClientPlayerWeaponFire', root , -- event function ( weapon , hitElement , hitX, hitY, hitZ ) -- Parameters if ( weapon == 16 and getElementType( hitElement )== "vehicle" )then -- if the weapon was grenade and the element got hit was vehicle then createExplosion (hitX, hitY, hitZ, 2, true, 0, true ) --- make an explosion( rocket ) at the place the grenade was hit and it will make the vehicle blow instantly end end ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now