---=== Библиотеки ===---
local memory = require 'memory'
---=== Переменные ===---
local font = renderCreateFont('Arial', 8, f.BOLD + f.SHADOW)
---=== Main Code ===---
function main()
while not isSampAvailable() do wait(0) end
local x1, y1 = getScreenResolution()
while true do
wait(0)
local patrons = getAmmoInClip()
if memory.getint8(getCharPointer(PLAYER_PED) + 0x528, false) == 19 then
renderFontDrawTextAlign(font, patrons, x1 /2, y1 / 2, 2)
end
end
end
---=== Получаем кол-во патрон в обойме ===--- // https://www.blast.hk/threads/13380/post-127831
function getAmmoInClip()
local pointer = getCharPointer(playerPed)
local weapon = getCurrentCharWeapon(playerPed)
local slot = getWeapontypeSlot(weapon)
local cweapon = pointer + 0x5A0
local current_cweapon = cweapon + slot * 0x1C
return memory.getuint32(current_cweapon + 0x8)
end
---=== Центрирование текста ===--- // https://www.blast.hk/threads/118464/post-951539
function renderFontDrawTextAlign(font, text, x, y, color, align)
if not align or align == 1 then -- слева
renderFontDrawText(font, text, x, y, color)
end
if align == 2 then -- по центру
renderFontDrawText(font, text, x - renderGetFontDrawTextLength(font, text) / 2, y, color)
end
if align == 3 then -- справа
renderFontDrawText(font, text, x - renderGetFontDrawTextLength(font, text), y, color)
end
end