- Версия MoonLoader
- .026-beta
Как сделать, что-бы при отдалении, хп бар пропорционально уменьшался?
И как можно сделать, что бы бар не работал дальше выбранной дистанции?
И как можно сделать, что бы бар не работал дальше выбранной дистанции?
Lua:
for i = 0, sampGetMaxPlayerId() do
if sampIsPlayerConnected(i) then
local result, handlePed = sampGetCharHandleBySampPlayerId(i)
if result and doesCharExist(handlePed) and isCharOnScreen(handlePed) then
local pos = {getCharCoordinates(PLAYER_PED)}
local whpos = {getCharCoordinates(handlePed)}
local x1, y1 = convert3DCoordsToScreen(pos[1], pos[2], pos[3])
local x2, y2 = convert3DCoordsToScreen(whpos[1], whpos[2], whpos[3])
renderDrawBoxWithBorder(x2- 40, y2 - 60, 5, 120, 0x00FFFFFF, 1, -1)
health = sampGetPlayerHealth(i)
local x = 100 - health
renderDrawBoxWithBorder(x2- 40, y2 - 60 + x, 5, (119.9 - x) , col32, 1, -1) --green
if health <= 20 then renderDrawBoxWithBorder(x2- 40, y2 - 60 + x, 5, 119.9 - x , ImColor(imgui.ImVec4(0.0, 0.0, 1.0, 1.0)):GetU32(), 1, -1) end --red
if health >= 20 and health <= 60 then renderDrawBoxWithBorder(x2- 40, y2 - 60 + x, 5, 119.9 - x , ImColor(imgui.ImVec4(0.0, 1.0, 1.0, 1.0)):GetU32(), 1, -1) end
--renderFontDrawText(my_font, "name", x2 - 65 / 2, y2 - 80, -1)
end
end
end