Sendy Posted February 8, 2019 Share Posted February 8, 2019 (edited) function armor(loss) local Health = getElementHealth(source) local Armour = getPedArmor(source) setPedArmor(source, Armour - loss) if Armour < 0 then setElementHealth(source, Health - loss) end end addEvent("ArMoR", true) addEventHandler("ArMoR", getRootElement(), armor) Please can anyone tell me why if i have armor 100 and health 1 and ped damage to me i'am dead? if i have health 100 and armor 100 its working first loos armor then health.. Edited February 8, 2019 by Sendy Link to comment
SaNoR Posted February 8, 2019 Share Posted February 8, 2019 function armor(loss) local Health = getElementHealth(source) local Armour = getPedArmor(source) if Armour - tonumber(loss) >= 0 then setPedArmor(source, Armour - tonumber(loss)) else setPedArmor(source, 0) end if getPedArmor(source) == 0 then setElementHealth(source, Health + (Armour - tonumber(loss))) end end addEvent("ArMoR", true) addEventHandler("ArMoR", getRootElement(), armor) Link to comment
Sendy Posted February 8, 2019 Author Share Posted February 8, 2019 Thanks but not work i have 1 health and 100 armor and when ped attack to me i'am dead.. when i have 2 and more health and armor 100 and peds attack to me its working loss Link to comment
SaNoR Posted February 9, 2019 Share Posted February 9, 2019 17 hours ago, Sendy said: Thanks but not work i have 1 health and 100 armor and when ped attack to me i'am dead.. when i have 2 and more health and armor 100 and peds attack to me its working loss I test it in local server and everything works fine. Maybe you're problem in "ArMoR" event. 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