Musamba Posted September 21, 2012 Share Posted September 21, 2012 If i use this code: math.floor(100*(getElementHealth(vehicle)/1000)) When my vehicle is burning remains at 25% when should be at 0%, but when i'm not damaged it's at 100% If i use this one: math.floor(1000*(getElementHealth(vehicle)/100)) It's the same thing of the first one but whit 1 more 0: 25% = 250% - 100% = 1000% Can someone help me? Link to comment
50p Posted September 21, 2012 Share Posted September 21, 2012 If I remember correctly, vehicles start burning when their health reaches 250 and it gets to 0 as it burns. Once their health reaches 0 they explode. So you want to use 750 health instead. Try this: local actualHealth = getElementHealth(vehicle)-250; actualHealth = actualHealth > 0 and actualHealth or 0; -- if it's burning it will be 0 math.floor(100*(actualHealth/750)) Link to comment
50p Posted September 21, 2012 Share Posted September 21, 2012 No problem. Good luck with your scripts. 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