Gomes Posted August 10, 2022 Posted August 10, 2022 Hello, I would like help to create a function, how can I cancel the damage to the player if his health reaches 20? pls help me
fxl Posted August 11, 2022 Posted August 11, 2022 function cdamage(attacker, weapon, bodypart, loss) if getElementHealth(source)-loss <= 20 then -- if player health reaches 20 or below after damage cancelEvent() -- cancels dmg setElementHealth(source, 20) -- bring u back to 20hp end end addEventHandler("onClientPlayerDamage", localPlayer, cdamage)
Gomes Posted August 13, 2022 Author Posted August 13, 2022 On 10/08/2022 at 22:01, fxl said: function cdamage(attacker, weapon, bodypart, loss) if getElementHealth(source)-loss <= 20 then -- if player health reaches 20 or below after damage cancelEvent() -- cancels dmg setElementHealth(source, 20) -- bring u back to 20hp end end addEventHandler("onClientPlayerDamage", localPlayer, cdamage) thx bro
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