Blinker. Posted November 20, 2014 Posted November 20, 2014 Hello , I've made a script to show health and nos in the bottom of the screen instead of the normal race Health bar , the problem is i'm using a percentage , whenever the health reach 25 % the car becomes on fire.. i need the health to be on 0% to become on fire. i'm using math.round((getElementHealth(getPedOccupiedVehicle(localPlayer))/10),0) Thanks !
Moderators IIYAMA Posted November 20, 2014 Moderators Posted November 20, 2014 local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then local health = getElementHealth(vehicle)-250 if health < 0 then health = 0 end ------------------------------------------ ------------------------------------------ end Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Blinker. Posted November 20, 2014 Author Posted November 20, 2014 Hello IIYAMA, If I use that , I will get 75% on full health. I need it to be 100% on full health and 0% on fire. I saw that in many servers like MIKI dd.
Dealman Posted November 20, 2014 Posted November 20, 2014 Just check if the health is equal to, or lower than 25%(250). If it is, make the health display 0. I believe it slowly goes from 250 to 0 whilst on fire...? If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
Blinker. Posted November 20, 2014 Author Posted November 20, 2014 I've tried that already , but it will look so shit , the player looks at his health when it's 26% and the next hit it will be 0 %. I want it to be normal example: 26% then 23% ..till 0 and it will be on fire.
Dealman Posted November 20, 2014 Posted November 20, 2014 So make a timer, whenever he's taken to 250 or below - set it to 250 and then start a timer. Find out how long it's on fire before explodes and use that. Dunno how well it'll work, but might be worth a shot If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
Blinker. Posted November 21, 2014 Author Posted November 21, 2014 Aa no , you misunderstood me, I didn't mean that the car becomes on fire on 25% and then goes down till 0 I meant I want it normal like 90 to 87 not going from 25 to 0 ,so whenever the car reaches 0 % of health it becomes on fire. Normaly the car becomes on fire at 25%... Thanks.
Saml1er Posted November 21, 2014 Posted November 21, 2014 local health = (getElementHealth(vehicle)-250)/750*100 This will return health between 0 and 100.
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