Mr.Hugin Posted May 26, 2022 Share Posted May 26, 2022 (edited) 2 hours ago, TheBossCl said: Image What are you working on? You have two types of this, but what do you want to do? I did not understand what you mean onPedDamage onPlayerDamage Edited May 26, 2022 by Mr.Hugin Link to comment
TheBossCl Posted May 26, 2022 Author Share Posted May 26, 2022 (edited) onPedDamage dealing damage to the ped triggers a function where if the ped is below 10 health, the ped's health returns to 100 and armor is added to 100. but my code doesn't work that's why i ask 1 hour ago, Mr.Hugin said: What are you working on? You have two types of this, but what do you want to do? I did not understand what you mean onPedDamage onPlayerDamage read above Edited May 26, 2022 by TheBossCl Link to comment
Scripting Moderators xLive Posted May 26, 2022 Scripting Moderators Share Posted May 26, 2022 Moving this into the Scripting section. Please use this section in the future. onPedDamage is not registered by default. You need to use addEvent first to register it. 1 Link to comment
Mr.Hugin Posted May 26, 2022 Share Posted May 26, 2022 13 hours ago, TheBossCl said: onPedDamage dealing damage to the ped triggers a function where if the ped is below 10 health, the ped's health returns to 100 and armor is added to 100. but my code doesn't work that's why i ask read above This can be done by adding an event and onPedDamage Do you want damage from the side of the weapon or the vehicle? 1 Link to comment
mafioz Posted May 26, 2022 Share Posted May 26, 2022 function damageController(loss) local heal = getElementHealth(source) - loss if heal <= 10 then setElementHealth(source,100) setPedArmor(source,100) end end addEventHandler("onPedDamage", root, damageController) Perhaps you need this 1 Link to comment
TheBossCl Posted May 28, 2022 Author Share Posted May 28, 2022 (edited) On 5/26/2022 at 4:48 AM, xLive said: Moving this into the Scripting section. Please use this section in the future. onPedDamage is not registered by default. You need to use addEvent first to register it. Thank you very much, works On 5/26/2022 at 4:29 PM, shishani said: function damageController(loss) local heal = getElementHealth(source) - loss if heal <= 10 then setElementHealth(source,100) setPedArmor(source,100) end end addEventHandler("onPedDamage", root, damageController) Perhaps you need this yeah it works Edited May 28, 2022 by TheBossCl 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