JKiller55 Posted April 28, 2019 Posted April 28, 2019 hi i need help with this code: --Calc by Zipper: function calcRGBByHP ( player ) local hp = getElementHealth ( player ) if hp <= 0 then return 0, 0, 0 else hp = math.abs ( hp - 0.01 ) return ( 100 - hp ) * 2.55 / 2, ( hp * 2.55 ), 0 end end i want this for hp AND Armor but i dont get it BTW its for a anmetag script
Moderators IIYAMA Posted April 28, 2019 Moderators Posted April 28, 2019 @JKiller55 Take a step back from your calculation. If you want to go complex, sure why not? But first ... Start with something you can work with. local multiplier = hp / 100 -- 0 hp = 0x; 100 hp = 1x local red = 255 * (1 - multiplier) local green = 255 * multiplier 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
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