King12 Posted August 24, 2014 Share Posted August 24, 2014 Hello, I'm working on a basic script to improve my scripting skills. I wanted to get the peds health but I couldn't. Here is my code : ped1 = createPed(120, -2407.6513671875, -592.85119628906, 132.6484375) function pedHealth () local peds = getElementHealth ( ped1() ) if peds == 90 then setElementHealth ( ped1, 100 ) outputChatBox ( "The ped have been healed to 100", 255, 0, 0, true) end end addEventHandler("onClientPedDamage", ped1, pedHealth) Link to comment
Et-win Posted August 24, 2014 Share Posted August 24, 2014 local peds = getElementHealth (ped1) Link to comment
King12 Posted August 24, 2014 Author Share Posted August 24, 2014 local peds = getElementHealth (ped1) Thanks but it doesn't check the peds health, why? Link to comment
Bonsai Posted August 24, 2014 Share Posted August 24, 2014 Use "if peds <= 90", since it might never be at exactly 90. Link to comment
ALw7sH Posted August 24, 2014 Share Posted August 24, 2014 local peds = math.floor(getElementHealth (ped1)) 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