Я сделал скрипт через чат гпт, чтобы показывался таймер аптечки как на фото, но есть проблема худ появляется, а текст нет. Кто шарит помогите пофиксить, я вообще не умею кодить
вот код скрипта
вот код скрипта
Код:
script_name("HealTimer")
script_author("ChatGPT")
require 'moonloader'
local active = false
local timer = 0
local showUse = false
function main()
repeat wait(0) until isSampAvailable()
sampRegisterChatCommand("healhud", function()
if active then return end
-- отправляет настоящую команду сервера
sampSendChat("/healme")
active = true
timer = 15
lua_thread.create(function()
while timer > 0 do
wait(1000)
timer = timer - 1
end
active = false
showUse = true
wait(1000)
showUse = false
end)
end)
while true do
wait(0)
if active then
-- фон как на скрине
drawRect(0.865, 0.255, 0.135, 0.035, 0x70000000)
-- текст
printStyled(
string.format("~w~HEAL: ~g~%d SEC", timer),
0.825,
0.245
)
end
if showUse then
drawRect(0.865, 0.255, 0.090, 0.035, 0x70000000)
printStyled(
"~g~USE",
0.855,
0.245
)
end
end
end
function drawRect(x, y, width, height, color)
local sw, sh = getScreenResolution()
x = x * sw
y = y * sh
width = width * sw
height = height * sh
renderDrawBox(
x,
y,
width,
height,
color
)
end
function printStyled(text, x, y)
local sw, sh = getScreenResolution()
x = x * sw
y = y * sh
setTextFont(2)
setTextScale(0.35, 1.2)
setTextColour(255,255,255,255)
setTextEdge(1,0,0,0,255)
displayText(text, x, y)
end