Начинающий
-
Автор темы
- #1
Кто сможет зафиксить под АПИ неверпуза? Буду очень благодарен!!! (взято с форума ЛВ)
Код:
local gris = render.create_image( file.read( os.getenv("APPDATA") .. "//Legendware//Scripts//img//misc//gris.png" ) )
menu.add_check_box( "Health UI" )
-- hp线条绘制
local function draw_line(p1, p2, o1, o2)
render.draw_line(p1, p2, o1, o2, color.new(180, 190, 200, 200 ))
render.draw_line(p1, p2+1, o1, o2+1, color.new(180, 190, 200, 200 ))
render.draw_line(p1, p2+2, o1, o2+2, color.new(180, 190, 200, 200))
render.draw_line(p1, p2+2.4,o1, o2+2.4, color.new(180, 190, 200, 200))
render.draw_line(p1, p2, o1, o2, color.new(180, 190, 200, 200 ))
end
-- hp线条绘制
function hp_line_draw()
render.draw_image(0, 0, 722, 126, gris)
local local_player = entitylist.get_local_player()
if (local_player ~= nil) then
local hp = local_player:get_prop_int("CBasePlayer", "m_iHealth")
local hp_true = local_player:get_prop_int("CBasePlayer", "m_iHealth")
if not engine.is_connected() then
return end
local t = globals.get_frametime() * (10 + math.abs(local_player:get_prop_int("CBasePlayer", "m_iHealth") - hp) * 1.3);
if hp > local_player:get_prop_int("CBasePlayer", "m_iHealth") then
hp = math.max(hp - t, local_player:get_prop_int("CBasePlayer", "m_iHealth"))
elseif hp < local_player:get_prop_int("CBasePlayer", "m_iHealth") then
hp = math.min(hp + t, local_player:get_prop_int("CBasePlayer", "m_iHealth"))
end
if (hp > 0) then
end
if hp == 100 then
render.draw_circle_filled(712, 58, 5, 4, color.new(180, 190, 200,255))
end
if hp > 90 then
local o_x = (712 - 666) * (1 - ((hp - 90) / 10))
local o_y = (58 - 47) * (1 - ((hp - 90) / 10))
render.draw_circle_filled(666, 47, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(394, 52, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(358, 41, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(232, 48, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(160, 64, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(131, 51, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(116, 65, 5, 4, color.new(180, 190, 200,255))
draw_line(666, 47, 712 - o_x, 58 - o_y)
draw_line(394, 52, 666, 47)
draw_line(358, 41, 394, 52)
draw_line(232, 48, 358, 41)
draw_line(160, 64, 232, 48)
draw_line(131, 51, 160, 64)
draw_line(116, 65, 131, 51)
elseif (hp > 50) then
local o_x = (666 - 394) * (1 - (hp - 50) / 40)
local o_y = (47 - 52) * (1 - (hp - 50) / 40)
render.draw_circle_filled(394, 52, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(358, 41, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(232, 48, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(160, 64, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(131, 51, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(116, 65, 5, 4, color.new(180, 190, 200,255))
draw_line(394, 52, 666 - o_x, 47 - o_y)
draw_line(358, 41, 394, 52)
draw_line(232, 48, 358, 41)
draw_line(160, 64, 232, 48)
draw_line(131, 51, 160, 64)
draw_line(116, 65, 131, 51)
elseif (hp > 40) then
local o_x = (394 - 358) * ((hp - 50) / -10)
local o_y = (52 - 41) * ((hp - 50) / -10)
render.draw_circle_filled(358, 41, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(232, 48, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(160, 64, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(131, 51, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(116, 65, 5, 4, color.new(180, 190, 200,255))
draw_line(358, 41, 394 - o_x, 52 - o_y)
draw_line(232, 48, 358, 41)
draw_line(160, 64, 232, 48)
draw_line(131, 51, 160, 64)
draw_line(116, 65, 131, 51)
elseif (hp > 20) then
local o_x = (358 - 232) * ((hp - 40) / -20)
local o_y = (41 - 48) * ((hp - 40) / -20)
render.draw_circle_filled(232, 48, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(160, 64, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(131, 51, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(116, 65, 5, 4, color.new(180, 190, 200,255))
draw_line(232, 48, 358 - o_x, 41 - o_y)
draw_line(160, 64, 232, 48)
draw_line(131, 51, 160, 64)
draw_line(116, 65, 131, 51)
elseif (hp > 10) then
local o_x = (232 - 160) * ((hp - 20) / -10)
local o_y = (48 - 64) * ((hp - 20) / -10)
render.draw_circle_filled(160, 64, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(131, 51, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(116, 65, 5, 4, color.new(180, 190, 200,255))
draw_line(160, 64, 232 - o_x, 48 - o_y)
draw_line(131, 51, 160, 64)
draw_line(116, 65, 131, 51)
elseif (hp > 5) then
local o_x = (160 - 131) * ((hp - 10) / -5)
local o_y = (64 - 51) * ((hp - 10) / -5)
render.draw_circle_filled(131, 51, 5, 4, color.new(180, 190, 200,255))
render.draw_circle_filled(116, 65, 5, 4, color.new(180, 190, 200,255))
draw_line(131, 51, 160 - o_x, 64 - o_y)
draw_line(116, 65, 131, 51)
else
if (hp > 0) then
local o_x = (131 - 116) * ((hp - 5) / -5)
local o_y = (51 - 65) * ((hp - 5) / -5)
render.draw_circle_filled(116, 65, 5, 4, color.new(180, 190, 200,255))
draw_line(116, 65, 131 - o_x, 51 - o_y)
end
end
end
end
client.add_callback( "on_paint", function()
if (menu.get_bool( "Health UI" ))then
hp_line_draw()
end
end )