- 7
- 0
- Версия MoonLoader
- .026-beta
Здравствуйте, сделал себе скрипт чтобы показывал броню на основе этого.
И я хочу убрать ноль когда нет брони, но так как я не особо разбираюсь в языке можете мне указать как это сделать? ну или сделать уже готовый вариант. Заранее спасибо
HealthPoint Head-Up Display
Просто показатель ХП в цифрах на Lua. Команда для смены позиции: /hpos Автор: forget Файл конфигурации (moonloader/config/hphud.ini) [main] pos_x=1264 -- x pos_y=130 -- y font_hpbar=Arial -- шрифт size_hpbar=10 -- размер color_hpbar=0xFFFFFFFF -- цвет исправил баг, спасибо за нахождение...
blast.hk
local inicfg = require 'inicfg'
FCR_NONE = 0
FCR_BOLD = 1
FCR_ITALICS = 2
FCR_BORDER = 4
FCR_SHADOW = 8
FCR_UNDERLINE = 16
FCR_STRIKEOUT = 32
local flags = {
_BOLD = true,
_ITALICS = false,
_BORDER = true,
_SHADOW = true,
_UNDERLINE = false,
_STRIKEOUT = false
}
local mod_changepos = false
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while not isSampAvailable() do wait(0) end
sampAddChatMessage(" [apbar] Creator forget. Command: /apos", -1)
local anotherIni = inicfg.load(nil, "apbar")
if anotherIni ~= nil then
pos_x = anotherIni.main.pos_x
pos_y = anotherIni.main.pos_y
size_apbar = anotherIni.main.size_apbar
font_apbar = anotherIni.main.font_apbar
color_apbar = anotherIni.main.color_apbar
else
local newData = {
main = {
pos_x = 100,
pos_y = 100,
size_apbar = 10,
font_apbar = "Arial",
color_apbar = 0xFFFFFFFF
}
}
inicfg.save(newData, "apbar")
pos_x = 100
pos_y = 100
size_apbar = 10
font_apbar = "Arial"
color_apbar = 0xFFFFFFFF
end
flags_apbar = 0
if flags._BOLD then flags_apbar = flags_apbar + FCR_BOLD end
if flags._ITALICS then flags_apbar = flags_apbar + FCR_ITALICS end
if flags._BORDER then flags_apbar = flags_apbar + FCR_BORDER end
if flags._SHADOW then flags_apbar = flags_apbar + FCR_SHADOW end
if flags._UNDERLINE then flags_apbar = flags_apbar + FCR_UNDERLINE end
if flags._STRIKEOUT then flags_apbar = flags_apbar + FCR_STRIKEOUT end
sampRegisterChatCommand("apos",
function(i)
mod_changepos = not mod_changepos
end)
r_font = renderCreateFont(font_apbar, size_apbar, flags_apbar)
while true do
wait(0)
_, id = sampGetPlayerIdByCharHandle(playerPed)
if not mod_changepos then
armor = sampGetPlayerArmor(id)
renderFontDrawText(r_font, string.format("%d", armor), pos_x, pos_y, color_apbar)
end
if mod_changepos then
showCursor(true, true)
pos_x, pos_y = getCursorPos()
pos_x = pos_x + 10
renderFontDrawText(r_font, '120', pos_x, pos_y, color_apbar)
if wasKeyPressed(0x01) then
mod_changepos = not mod_changepos
showCursor(false, false)
addOneOffSound(0.0, 0.0, 0.0, 1052)
local newData = {
main = {
pos_x = pos_x,
pos_y = pos_y,
size_apbar = size_apbar,
font_apbar = font_apbar,
color_apbar = color_apbar
}
}
inicfg.save(newData, "apbar")
end
end
end
end
FCR_NONE = 0
FCR_BOLD = 1
FCR_ITALICS = 2
FCR_BORDER = 4
FCR_SHADOW = 8
FCR_UNDERLINE = 16
FCR_STRIKEOUT = 32
local flags = {
_BOLD = true,
_ITALICS = false,
_BORDER = true,
_SHADOW = true,
_UNDERLINE = false,
_STRIKEOUT = false
}
local mod_changepos = false
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while not isSampAvailable() do wait(0) end
sampAddChatMessage(" [apbar] Creator forget. Command: /apos", -1)
local anotherIni = inicfg.load(nil, "apbar")
if anotherIni ~= nil then
pos_x = anotherIni.main.pos_x
pos_y = anotherIni.main.pos_y
size_apbar = anotherIni.main.size_apbar
font_apbar = anotherIni.main.font_apbar
color_apbar = anotherIni.main.color_apbar
else
local newData = {
main = {
pos_x = 100,
pos_y = 100,
size_apbar = 10,
font_apbar = "Arial",
color_apbar = 0xFFFFFFFF
}
}
inicfg.save(newData, "apbar")
pos_x = 100
pos_y = 100
size_apbar = 10
font_apbar = "Arial"
color_apbar = 0xFFFFFFFF
end
flags_apbar = 0
if flags._BOLD then flags_apbar = flags_apbar + FCR_BOLD end
if flags._ITALICS then flags_apbar = flags_apbar + FCR_ITALICS end
if flags._BORDER then flags_apbar = flags_apbar + FCR_BORDER end
if flags._SHADOW then flags_apbar = flags_apbar + FCR_SHADOW end
if flags._UNDERLINE then flags_apbar = flags_apbar + FCR_UNDERLINE end
if flags._STRIKEOUT then flags_apbar = flags_apbar + FCR_STRIKEOUT end
sampRegisterChatCommand("apos",
function(i)
mod_changepos = not mod_changepos
end)
r_font = renderCreateFont(font_apbar, size_apbar, flags_apbar)
while true do
wait(0)
_, id = sampGetPlayerIdByCharHandle(playerPed)
if not mod_changepos then
armor = sampGetPlayerArmor(id)
renderFontDrawText(r_font, string.format("%d", armor), pos_x, pos_y, color_apbar)
end
if mod_changepos then
showCursor(true, true)
pos_x, pos_y = getCursorPos()
pos_x = pos_x + 10
renderFontDrawText(r_font, '120', pos_x, pos_y, color_apbar)
if wasKeyPressed(0x01) then
mod_changepos = not mod_changepos
showCursor(false, false)
addOneOffSound(0.0, 0.0, 0.0, 1052)
local newData = {
main = {
pos_x = pos_x,
pos_y = pos_y,
size_apbar = size_apbar,
font_apbar = font_apbar,
color_apbar = color_apbar
}
}
inicfg.save(newData, "apbar")
end
end
end
end