script_author 'imring'
script_name 'hud'
memory = require 'memory'
function main()
font = renderCreateFont('Rubik one', 11, 4)
while true do wait(0)
x, y = getScreenResolution()
render_hud_x, render_hud_y = convertGameScreenCoordsToWindowScreenCoords(545.6, 32.2)
pos_x_hp, pos_y_hp = convertGameScreenCoordsToWindowScreenCoords(576.0, 66.7)
pos_x_arm, pos_y_arm = convertGameScreenCoordsToWindowScreenCoords(576.0, 44)
pos_x_wat, pos_y_wat = convertGameScreenCoordsToWindowScreenCoords(576.0, 56)
if isPlayerPlaying(playerPed) then
if memory.getint16(0xBA6769) == 1 then
local car, hpcar
local hp = getCharHealth(playerPed)
local arm = getCharArmour(playerPed)
local sprint = math.floor(getSprintLocalPlayer())
local water = math.floor(getWaterLocalPlayer())
if isCharInAnyCar(playerPed) then
car = storeCarCharIsInNoSave(playerPed)
hpcar = getCarHealth(car)
end
local width = car and math.floor((x/11.1)*(hpcar/1000)) or math.floor((x/11.1)*(sprint/100))
renderDrawBox(render_hud_x, render_hud_y, x/10.3, y/51.2, 0xFF000000)
renderDrawBox(render_hud_x+(x/273.2), render_hud_y+(y/192), x/11.1, y/109.7, car and 0xFF40407f or 0xff40407f)
renderDrawBox(render_hud_x+(x/273.2), render_hud_y+(y/192), width, y/109.7, car and 0xff8080ff or 0xFF8080ff)
renderFontDrawText(font, car and hpcar or sprint, pos_x_arm-(renderGetFontDrawTextLength(font, car and hpcar or sprint)/2), pos_y_arm-23, car and 0xFFffffff or 0xFFffffff)
renderFontDrawText(font, hp, pos_x_hp-(renderGetFontDrawTextLength(font, hp)/2), pos_y_hp, 0xFFFFffff)
if arm > 101 then
renderFontDrawText(font, arm, pos_x_arm-(renderGetFontDrawTextLength(font, arm)/2), pos_y_arm, -1)
end
if isCharInWater(playerPed) or car and isCarInWater(car) then
renderFontDrawText(font, water, pos_x_wat-(renderGetFontDrawTextLength(font, water)/2), pos_y_wat, 0xFFffffff)
end
end
end
end
end
function getSprintLocalPlayer()
local float = memory.getfloat(0xB7CDB4)
return float/31.47000244
end
function getWaterLocalPlayer()
local float = memory.getfloat(0xB7CDE0)
return float/39.97000244
end