--[[ Necessities:
carsdata.lua: https://disk.yandex.com/d/AeremrlMzGOy5Q,
moonloader v.026.5-beta: https://www.blast.hk/threads/13305/,
moon imgui: https://www.blast.hk/threads/19292/
]]
require "lib.moonloader"
local encode = require "encoding"
encode.default = "CP1251"
local u8 = encode.UTF8
--local carsDB = require "carsdata"
local sampev = require "lib.samp.events"
local mem = require "memory"
local imgui = require "imgui"
-- ~by qvarkk
script_name("infocorner")
script_author("qvarkk")
script_description("Shows your statistic on the bottom right corner of your screen")
local tag = "{BADA55}[INFOCORNER]: "
local baseColor = 0xFFFFFF
local windowState = imgui.ImBool(true)
function main()
repeat wait(0) until isSampAvailable()
sampAddChatMessage(tag .. "{00FF00}Успешно {FFFFFF}загружен. Команда - {00FF00}/icorner", baseColor)
sampRegisterChatCommand("icorner", function()
sampAddChatMessage(tag .. "{FFFFFF}Состояние изменено.", baseColor)
windowState.v = not windowState.v
end)
imgui.Process = true
imgui.ShowCursor = false
while true do
wait(0)
imgui.Process = windowState.v
end
end
function imgui.OnDrawFrame()
local swidth, sheight = getScreenResolution()
imgui.SetMouseCursor(-1) -- for some reason cursor was visible even with false ShowCursor
imgui.SetNextWindowSize(imgui.ImVec2(225, 140), imgui.Cond.FirstUseEver)
imgui.SetNextWindowPos(imgui.ImVec2(swidth - 250, sheight - 165), imgui.Cond.FirstUseEver)
if imgui.Begin("INFOCORNER | by qvarkk") then
local id = select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))
imgui.Text(
('Ping: %s | FPS: %s | Time: %s\n[%s] %s | Level: %s\nHP: %s | AR: %s\nPOS (XYZ): %s\n'):format(
sampGetPlayerPing(id),
math.floor(mem.getfloat(0xB7CB50, 4, false)),
os.date('%H:%M:%S'),
id,
sampGetPlayerNickname(id),
sampGetPlayerScore(id),
getCharHealth(PLAYER_PED),
getCharArmour(PLAYER_PED),
table.concat({getCharCoordinates(PLAYER_PED)}, ', ')
)
)
if isCharInAnyCar(PLAYER_PED) then
local veh = storeCarCharIsInNoSave(PLAYER_PED)
local idResult, id = sampGetVehicleIdByCarHandle(veh)
imgui.Text(('Car: %s | ID: %s | HP: %s'):format(getNameOfVehicleModel(getCarModel(veh)), idResult and carId or 'not-server', getCarHealth(veh)))
end
imgui.End()
end
end