- Сообщения
- 1,226
- Реакции
- 1,383
- Баллы
- 0
- Сервер
- Emerald
Приветствую, очень давно делал для себя скрипт, который показывает: уменьшение, добавление ХП, брони, денег.
Есть возможность перемещения данного сообщения в любое место с помощью команды /set
Для работы скрипта требуется библиотека inicfg
Source
Есть возможность перемещения данного сообщения в любое место с помощью команды /set
Для работы скрипта требуется библиотека inicfg
Source
C++:
script_author('Lance')
script_name('HUD-Logger')
local inicfg = require 'inicfg'
local ini = inicfg.load({
positions =
{
pos_x = 1800,
pos_y = 800
}
}, 'HUD_logger')
local turn = true -- Включить - true, выключить - false (скрипт)
local font = renderCreateFont("Arial", 22, 4)
local notifications = false -- Включить - true, выключить - false (уведомления скрипта)
local settings = false
local message = nil
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() or not sampIsLocalPlayerSpawned() do wait(0) end
sampRegisterChatCommand("set", cmd_set)
local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
local player_health = sampGetPlayerHealth(id)
local player_armour = sampGetPlayerArmor(id)
local player_money = getPlayerMoney(PLAYER_HANDLE)
while true do wait(0)
-- VARS
current_health = sampGetPlayerHealth(id)
current_armour = sampGetPlayerArmor(id)
current_money = getPlayerMoney(PLAYER_HANDLE)
-- DIALOG
local result, button, _, _ = sampHasDialogRespond(244)
if result then
if button == 1 then
ini.positions.pos_x = select(1, getCursorPos())
ini.positions.pos_y = select(2, getCursorPos())
if inicfg.save(ini, "HUD_logger") then
sampAddChatMessage("{FFCC14}[HUD]{FFFFFF} Вы изменили позицию событий. X: " .. select(1, getCursorPos()) .. ". Y: " .. select(2, getCursorPos()) .. ".", -1)
end
settings = false
end
end
if settings then
local posX, posY = getCursorPos()
renderFontDrawText(font, "{FF3333}-228 HP", posX, posY, -1)
end
if notifications then
if message ~= nil then
local x, y = getScreenResolution()
renderFontDrawText(font, message, ini.positions.pos_x / x * x, ini.positions.pos_y / y * y, -1)
lua_thread.create(function()
wait(3000)
notifications = false
end)
end
end
if current_health ~= player_health or current_armour ~= player_armour or current_money ~= player_money then
turn = true
if turn then
if current_health < player_health then
message = "{FF3333}-" .. player_health - current_health .. " HP"
notifications = true
elseif player_health < current_health then
message = "{FFCC14}+" .. current_health - player_health .. " HP"
notifications = true
elseif current_armour < player_armour then
message = "{FF7D19}-" .. player_armour - current_armour .. " AR"
notifications = true
elseif player_armour < current_armour then
message = "{D8D8D8}+" .. current_armour - player_armour .. " AR"
notifications = true
elseif current_money < player_money then
message = "{FF3333}-" .. player_money - current_money .. "$"
notifications = true
elseif player_money < current_money then
message = "{228228}+" .. current_money - player_money .. "$"
notifications = true
end
player_armour = current_armour
player_health = current_health
player_money = current_money
turn = false
end
end
end
end
function cmd_set()
settings = true
sampShowDialog(244, "{FFCC14}Настройка", "{FFFFFF}Переместите образец в нужное место, затем нажмите {FFCC14}ENTER", "OK", nil, 0)
end
Последнее редактирование: