#RooTs Posted September 30, 2014 Share Posted September 30, 2014 (edited) hi friends, I found this function, wonder if it's possible to do it in Health and Armor getCarStateColor Example: getElementHealthStateColor how is would this function? local carState = "textures/carState.png" local csr, csg, csb = getCarStateColor() dxDrawImage(screenWidth - 30, screenHeight - 125, 24, 24, carState, 0, 0, 0, tocolor(csr, csg, csb , 255), true) Edited October 1, 2014 by Guest Link to comment
MTA Team botder Posted September 30, 2014 MTA Team Share Posted September 30, 2014 (edited) function getVehicleHealthColor(vehicle) if (not isElement(vehicle)) then return end if (getElementType(vehicle) ~= "vehicle") then return end local health = getElementHealth(vehicle) local f = math.max(0, math.min(1, health / 1000)) return math.min(255, (510 * (1-f))), math.min(255, 510 * f), 0 end Edited September 30, 2014 by Guest Link to comment
#Samy Posted September 30, 2014 Share Posted September 30, 2014 try this function getHealthColor() local health = getElementHealth(localPlayer) if (health) then local g = (255/1000) * health local r = 255 - g local b = 0 return r, g, b else return 0, 255, 0 end end --------------------------------------------- local image = "textures/carState.png" local csr, csg, csb = getHealthColor() dxDrawImage(screenWidth - 30, screenHeight - 125, 24, 24, image, 0, 0, 0, tocolor(csr, csg, csb , 255), true) Link to comment
#RooTs Posted October 1, 2014 Author Share Posted October 1, 2014 try this function getHealthColor() local health = getElementHealth(localPlayer) if (health) then local g = (255/1000) * health local r = 255 - g local b = 0 return r, g, b else return 0, 255, 0 end end --------------------------------------------- local image = "textures/carState.png" local csr, csg, csb = getHealthColor() dxDrawImage(screenWidth - 30, screenHeight - 125, 24, 24, image, 0, 0, 0, tocolor(csr, csg, csb , 255), true) , thanks Samy Link to comment
MTA Team botder Posted October 1, 2014 MTA Team Share Posted October 1, 2014 Could you explain me how his script helped you, because he is using player-health and not vehicle-health as you wanted. Link to comment
#Samy Posted October 1, 2014 Share Posted October 1, 2014 Could you explain me how his script helped you, because he is using player-health and not vehicle-health as you wanted. hi friends, I found this function, wonder if it's possible to do it in Health and Armor it wanted for Health and Armor Link to comment
#Samy Posted October 1, 2014 Share Posted October 1, 2014 look in which he used the function he is very good in HUDs viewtopic.php?f=108&t=81259&p=742054#p742054 Link to comment
#RooTs Posted October 1, 2014 Author Share Posted October 1, 2014 look in which he used the function he is very good in HUDs viewtopic.php?f=108&t=81259&p=742054#p742054 thanks Samy, you also is good Link to comment
xeon17 Posted October 1, 2014 Share Posted October 1, 2014 Necktrox , you're true he asked for vehicles but he edited the post today.. Last edited by LekRoots on 01 Oct 2014, 02:54, edited 1 time in total. Link to comment
xeon17 Posted October 1, 2014 Share Posted October 1, 2014 Your post makes no sense, maybe edit it with something else? Link to comment
RenanPG Posted October 1, 2014 Share Posted October 1, 2014 Your post makes no sense, maybe edit it with something else? Discussing for a simple thing like this ... 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