Mr.unpredictable. Posted March 14, 2015 Share Posted March 14, 2015 (edited) I was trying make vehicles get less damage from rocket launcher one of my friend told to use these functions to do that OnClientVehicleDamage CancelEvent GetElementHealth SetElementHealth I made the vehicle damage proof with weapons but not able to set vehicle heath with SetElementHealth function fakyu(attacker, weapon, loss, x, y, z, tyre) if (weapon) then cancelEvent() end setElementHealth(source,getElementHealth(source) - 50) end addEventHandler("onClientVehicleDamage", root, fakyu) Edited March 14, 2015 by Guest Link to comment
Enargy, Posted March 14, 2015 Share Posted March 14, 2015 function fakyu(attacker, weapon, loss, x, y, z, tyre) if (weapon) then cancelEvent() end setElementHealth(source,getElementHealth(source) - 50) end addEventHandler("onClientVehicleDamage", root, fakyu) what do you want achieve with this? Link to comment
Mr.unpredictable. Posted March 14, 2015 Author Share Posted March 14, 2015 function fakyu(attacker, weapon, loss, x, y, z, tyre) if (weapon) then cancelEvent() end setElementHealth(source,getElementHealth(source) - 50) end addEventHandler("onClientVehicleDamage", root, fakyu) what do you want achieve with this? I want vehicle to get less damage from weapons, even rocket launcher should do less damage to vehicle. ik there is a function setWeaponProperty but it doesn't work with rocket laucher. Link to comment
Mr.unpredictable. Posted March 14, 2015 Author Share Posted March 14, 2015 (edited) ok Here's a clear explanation on what i'm trying to make I wanted to reduce damage from rocket launcher to vehicle, Rocket launcher should only take 50% of heath of the enemy car my friend said that you can use these to functions do that OnClientVehicleDamage CancelEvent GetElementHealth SetElementHealth function fakyu(attacker, weapon, loss, x, y, z, tyre) if (weapon) then cancelEvent() end setElementHealth(source,getElementHealth(source) - 50) end addEventHandler("onClientVehicleDamage", root, fakyu) but not able to do that Edited March 15, 2015 by Guest Link to comment
Enargy, Posted March 14, 2015 Share Posted March 14, 2015 try this: function fakyu(attacker, weapon, loss, x, y, z, tyre) if (weapon and getElementType(source) == "vehicle") then setElementHealth(source,getElementHealth(source) - 50) cancelEvent() end end addEventHandler("onClientVehicleDamage", root, fakyu) Link to comment
Mr.unpredictable. Posted March 14, 2015 Author Share Posted March 14, 2015 try this: function fakyu(attacker, weapon, loss, x, y, z, tyre) if (weapon and getElementType(source) == "vehicle") then setElementHealth(source,getElementHealth(source) - 50) cancelEvent() end end addEventHandler("onClientVehicleDamage", root, fakyu) thanks Link to comment
Mr.unpredictable. Posted March 14, 2015 Author Share Posted March 14, 2015 Edit - ah i fixed it 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