require'lib.moonloader'
local colr = 0xfc05cf
local tag = "{34deeb}[Your Stats]: "
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.dafault = 'CP1251'
u8 = encoding.UTF8
local themes = import "resource/imgui_themes.lua"
local fa = require 'faIcons'
local fa_glyph_ranges = imgui.ImGlyphRanges({ fa.min_range, fa.max_range })
local main_window_state = imgui.ImBool(false)
local text_buffer = imgui.ImBuffer(256)
function imgui.BeforeDrawFrame()
if fa_font == nil then
local font_config = imgui.ImFontConfig()
font_config.MergeMode = true
fa_font = imgui.GetIO().Fonts:AddFontFromFileTTF('moonloader/resource/fonts/fontawesome-webfont.ttf', 14.0, font_config, fa_glyph_ranges)
end
end
function imgui.TextColoredRGB(text, render_text)
local max_float = imgui.GetWindowWidth()
local style = imgui.GetStyle()
local colors = style.Colors
local ImVec4 = imgui.ImVec4
local explode_argb = function(argb)
local a = bit.band(bit.rshift(argb, 24), 0xFF)
local r = bit.band(bit.rshift(argb, 16), 0xFF)
local g = bit.band(bit.rshift(argb, 8), 0xFF)
local b = bit.band(argb, 0xFF)
return a, r, g, b
end
local getcolor = function(color)
if color:sub(1, 6):upper() == 'SSSSSS' then
local r, g, b = colors[1].x, colors[1].y, colors[1].z
local a = tonumber(color:sub(7, 8), 16) or colors[1].w * 255
return ImVec4(r, g, b, a / 255)
end
local color = type(color) == 'string' and tonumber(color, 16) or color
if type(color) ~= 'number' then return end
local r, g, b, a = explode_argb(color)
return imgui.ImColor(r, g, b, a):GetVec4()
end
local render_text = function(text_)
for w in text_:gmatch('[^\r\n]+') do
local text, colors_, m = {}, {}, 1
w = w:gsub('{(......)}', '{%1FF}')
while w:find('{........}') do
local n, k = w:find('{........}')
local color = getcolor(w:sub(n + 1, k - 1))
if color then
text[#text], text[#text + 1] = w:sub(m, n - 1), w:sub(k + 1, #w)
colors_[#colors_ + 1] = color
m = n
end
w = w:sub(1, n - 1) .. w:sub(k + 1, #w)
end
local length = imgui.CalcTextSize(w)
if render_text == 2 then
imgui.NewLine()
imgui.SameLine(max_float / 2 - ( length.x / 2 ))
elseif render_text == 3 then
imgui.NewLine()
imgui.SameLine(max_float - length.x - 5 )
end
if text[0] then
for i = 0, #text do
imgui.TextColored(colors_[i] or colors[1], text[i])
imgui.SameLine(nil, 0)
end
imgui.NewLine()
else imgui.Text(w) end
end
end
render_text(text)
end
imgui.SwitchContext()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
style.Alpha = 1.0
style.ChildWindowRounding = 3
style.WindowRounding = 3
style.GrabRounding = 1
style.GrabMinSize = 20
style.FrameRounding = 3
colors[clr.Text] = ImVec4(0.00, 1.00, 1.00, 1.00)
colors[clr.TextDisabled] = ImVec4(0.00, 0.40, 0.41, 1.00)
colors[clr.WindowBg] = ImVec4(0.00, 0.00, 0.00, 1.00)
colors[clr.ChildWindowBg] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.Border] = ImVec4(0.00, 1.00, 1.00, 0.65)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.FrameBg] = ImVec4(0.44, 0.80, 0.80, 0.18)
colors[clr.FrameBgHovered] = ImVec4(0.44, 0.80, 0.80, 0.27)
colors[clr.FrameBgActive] = ImVec4(0.44, 0.81, 0.86, 0.66)
colors[clr.TitleBg] = ImVec4(0.14, 0.18, 0.21, 0.73)
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.54)
colors[clr.TitleBgActive] = ImVec4(0.00, 1.00, 1.00, 0.27)
colors[clr.MenuBarBg] = ImVec4(0.00, 0.00, 0.00, 0.20)
colors[clr.ScrollbarBg] = ImVec4(0.22, 0.29, 0.30, 0.71)
colors[clr.ScrollbarGrab] = ImVec4(0.00, 1.00, 1.00, 0.44)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.00, 1.00, 1.00, 0.74)
colors[clr.ScrollbarGrabActive] = ImVec4(0.00, 1.00, 1.00, 1.00)
colors[clr.ComboBg] = ImVec4(0.16, 0.24, 0.22, 0.60)
colors[clr.CheckMark] = ImVec4(0.00, 1.00, 1.00, 0.68)
colors[clr.SliderGrab] = ImVec4(0.00, 1.00, 1.00, 0.36)
colors[clr.SliderGrabActive] = ImVec4(0.00, 1.00, 1.00, 0.76)
colors[clr.Button] = ImVec4(0.00, 0.65, 0.65, 0.46)
colors[clr.ButtonHovered] = ImVec4(0.01, 1.00, 1.00, 0.43)
colors[clr.ButtonActive] = ImVec4(0.00, 1.00, 1.00, 0.62)
colors[clr.Header] = ImVec4(0.00, 1.00, 1.00, 0.33)
colors[clr.HeaderHovered] = ImVec4(0.00, 1.00, 1.00, 0.42)
colors[clr.HeaderActive] = ImVec4(0.00, 1.00, 1.00, 0.54)
colors[clr.ResizeGrip] = ImVec4(0.00, 1.00, 1.00, 0.54)
colors[clr.ResizeGripHovered] = ImVec4(0.00, 1.00, 1.00, 0.74)
colors[clr.ResizeGripActive] = ImVec4(0.00, 1.00, 1.00, 1.00)
colors[clr.CloseButton] = ImVec4(0.00, 0.78, 0.78, 0.35)
colors[clr.CloseButtonHovered] = ImVec4(0.00, 0.78, 0.78, 0.47)
colors[clr.CloseButtonActive] = ImVec4(0.00, 0.78, 0.78, 1.00)
colors[clr.PlotLines] = ImVec4(0.00, 1.00, 1.00, 1.00)
colors[clr.PlotLinesHovered] = ImVec4(0.00, 1.00, 1.00, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.00, 1.00, 1.00, 1.00)
colors[clr.PlotHistogramHovered] = ImVec4(0.00, 1.00, 1.00, 1.00)
colors[clr.TextSelectedBg] = ImVec4(0.00, 1.00, 1.00, 0.22)
colors[clr.ModalWindowDarkening] = ImVec4(0.04, 0.10, 0.09, 0.51)
local checked1 = imgui.ImBool(false)
local checked2 = imgui.ImBool(false)
local checked3 = imgui.ImBool(false)
local checked4 = imgui.ImBool(false)
local checked5 = imgui.ImBool(false)
local checked6 = imgui.ImBool(false)
local checked7 = imgui.ImBool(false)
local checked8 = imgui.ImBool(false)
local checked9 = imgui.ImBool(false)
local checked10 = imgui.ImBool(false)
local checked11 = imgui.ImBool(false)
local checked_radio = imgui.ImInt(1)
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampAddChatMessage("{FFFD00}SCRIPT AVAIBLE", -1)
sampRegisterChatCommand("stat", cmd_imgui)
sampRegisterChatCommand("/stat", cmd_ch)
imgui.Process = false
while true do
wait(0)
_, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
nick = sampGetPlayerNickname(id)
money = getPlayerMoney(int, id)
ping = sampGetPlayerPing(id)
score = sampGetPlayerScore(id)
armor = sampGetPlayerArmor(id)
health = sampGetPlayerHealth(id)
animid = sampGetPlayerAnimationId(int, id)
count = sampGetPlayerCount(bool, false)
interior = getActiveInterior()
counts = sampGetPlayerCount(true)
if main_window_state.v == false then
imgui.Process = false
end
end
end
function cmd_imgui(arg)
main_window_state.v = not main_window_state.v
imgui.Process = main_window_state.v
end
function cmd_ch(arg)
x, y, z = getCharCoordinates(PLAYER_PED)
if checked1.v then
sampAddChatMessage(tag .. "{2ed947}ID: {FFFFFF}" .. id, -1)
end
if checked2.v then
sampAddChatMessage(tag .. "{2ed947}Nick: {FFFFFF}" .. nick, -1)
end
if checked3.v then
sampAddChatMessage(tag .. "{2ed947}Ping: {FFFFFF}" .. ping, -1)
end
if checked4.v then
sampAddChatMessage(tag .. "{2ed947}Money: {FFFFFF}" .. money, -1)
end
if checked5.v then
sampAddChatMessage(tag .. "{2ed947}LVL: {FFFFFF}" .. score, -1)
end
if checked6.v then
sampAddChatMessage(tag .. "{2ed947}Health: {FFFFFF}" .. health, -1)
end
if checked7.v then
sampAddChatMessage(tag .. "{2ed947}Armour: {FFFFFF}" .. armor, -1)
end
if checked8.v then
sampAddChatMessage(tag .. "{2ed947}Players: {FFFFFF}" .. count, -1)
end
if checked9.v then
sampAddChatMessage(tag .. "{2ed947}Streaming: {FFFFFF}" .. counts, -1)
end
if checked10.v then
sampAddChatMessage(tag .. "{2ed947}Interior: {FFFFFF}" .. interior, -1)
end
if checked11.v then
sampAddChatMessage(tag .. "{2ed947}Coordinates {FFFFFF}X: ".. math.floor(x) .. " | Y: {FFFFFF}" .. math.floor(y) .. " | Z: {FFFFFF}" .. math.floor(z), -1)
end
end
function imgui.OnDrawFrame()
local sw, sh = getScreenResolution()
imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(650, 470), imgui.Cond.FirstUseEver)
imgui.Begin(fa.ICON_TOGGLE_ON .. " Script Avaible - By Pablo", main_window_state)
imgui.BeginChild("WINDOW_1", imgui.ImVec2(300, 200), true)
imgui.TextColoredRGB(fa.ICON_INFO_CIRCLE .. " You ID: {FFFFFF}" .. id)
imgui.TextColoredRGB(fa.ICON_ADDRESS_BOOK .. " You nick {FFFFFF}" .. nick)
imgui.TextColoredRGB(fa.ICON_MONEY .. " You money: {FFFFFF}$" .. money)
imgui.TextColoredRGB(fa.ICON_WIFI .. " You ping: {FFFFFF}" .. ping .. " ms")
imgui.TextColoredRGB(fa.ICON_LEVEL_UP .. " You lvl: {FFFFFF}" .. score)
imgui.TextColoredRGB(fa.ICON_SHIELD .. " You armour: {FFFFFF}" .. armor)
imgui.TextColoredRGB(fa.ICON_HEARTBEAT .. " You health: {FFFFFF}" .. health)
imgui.TextColoredRGB(fa.ICON_USERS .. " Server Players: {FFFFFF}" .. count)
imgui.TextColoredRGB(fa.ICON_USER_PLUS .. " Players in zone streaming: {FFFFFF}" .. counts)
x, y, z = getCharCoordinates(PLAYER_PED)
imgui.TextColoredRGB(fa.ICON_MAP_MARKER .. " Coordinates {FFFFFF}X: " .. math.floor(x) .. " | Y: {FFFFFF}" .. math.floor(y) .. " | Z: {FFFFFF}" .. math.floor(z))
imgui.EndChild()
imgui.SetCursorPos(imgui.ImVec2(320, 29.5))
imgui.BeginChild("Window_2", imgui.ImVec2(300, 200), true)
if imgui.Button(fa.ICON_ADDRESS_BOOK_O .. " CHECK STATS IN GLOBAL CHAT ;)") then
sampAddChatMessage(tag .."{2ed947}You id: {FFFFFF}" .. id, -1)
sampAddChatMessage(tag .."{2ed947}You nick: {FFFFFF}" .. nick, -1)
sampAddChatMessage(tag .. "{2ed947}You money: {FFFFFF}$" .. money, -1)
sampAddChatMessage(tag .. "{2ed947}You ping: {FFFFFF}" .. ping .. " {FFFFFF}ms", -1)
sampAddChatMessage(tag .. "{2ed947}You LVL: {FFFFFF}" .. score, -1)
sampAddChatMessage(tag .. "{2ed947}You armour: {FFFFFF}" .. armor, -1)
sampAddChatMessage(tag .. "{2ed947}You health: {FFFFFF}" .. health, -1)
sampAddChatMessage(tag .. "{2ed947}Server Players: {FFFFFF}" .. count, -1)
sampAddChatMessage(tag .. "{2ed947}Player in zone streaming {FFFFFF}" .. counts, -1)
sampAddChatMessage(tag .. "{2ed947}Interior: {FFFFFF} пїЅ " .. interior, -1)
sampAddChatMessage(tag .. "{2ed947}Coordinates {FFFFFF}X: ".. math.floor(x) .. " | Y: {FFFFFF}" .. math.floor(y) .. " | Z: {FFFFFF}" .. math.floor(z), -1)
end
imgui.Columns(2, "TABLE_1", true)
imgui.Separator()
if imgui.Button(fa.ICON_INFO_CIRCLE .. " ID") then
sampAddChatMessage(tag .. "{2ed947}You ID: {FFFFFF}" .. id, -1)
end
imgui.NextColumn()
if imgui.Button(fa.ICON_ADDRESS_BOOK .. " NICK") then
sampAddChatMessage(tag .. "{2ed947}You Nick: {FFFFFF}" .. nick, -1)
end
imgui.Separator()
imgui.NextColumn()
if imgui.Button(fa.ICON_WIFI .. " PING") then
sampAddChatMessage(tag .. "{2ed947}You Ping: {FFFFFF}" .. ping .. " ms", -1)
end
imgui.NextColumn()
if imgui.Button(fa.ICON_MONEY .. " MONEY") then
sampAddChatMessage(tag .. "{2ed947}You money: {FFFFFF} $" .. money, -1)
end
imgui.Separator()
imgui.NextColumn()
if imgui.Button(fa.ICON_LEVEL_UP .. " LVL") then
sampAddChatMessage(tag .. "{2ed947}You LVL: {FFFFFF}" .. score, -1)
end
imgui.NextColumn()
if imgui.Button(fa.ICON_HEARTBEAT .. " HEALTH") then
sampAddChatMessage(tag .. "{2ed947}You Health: {FFFFFF}" .. health, -1)
end
imgui.Separator()
imgui.NextColumn()
if imgui.Button(fa.ICON_SHIELD .. " ARMOUR") then
sampAddChatMessage(tag .. "{2ed947}You Armour: {FFFFFF}" .. armor, -1)
end
imgui.NextColumn()
if imgui.Button(fa.ICON_USERS .. " PLAYERS") then
sampAddChatMessage(tag .. "{2ed947}Server Players: {FFFFFF}" .. count, -1)
end
imgui.Separator()
imgui.NextColumn()
if imgui.Button(fa.ICON_USER_PLUS .. " STREAMING") then
sampAddChatMessage(tag .. "{2ed947}Player in zone streaming: {FFFFFF}" .. counts, -1)
end
imgui.SetCursorPos(imgui.ImVec2(6.5, 176))
if imgui.Button(fa.ICON_PLUS_SQUARE .. " INTERIOR") then
sampAddChatMessage(tag .. "{2ed947}Interior: {FFFFFF} пїЅ " .. interior, -1)
end
imgui.NextColumn()
if imgui.Button(fa.ICON_MAP_MARKER .. " Coordinates") then
sampAddChatMessage(tag .. "{2ed947}Coordinates X: {FFFFFF}".. math.floor(x) .. " | Y: {FFFFFF}" .. math.floor(y) .. " | Z: {FFFFFF}" .. math.floor(z), -1)
end
imgui.Separator()
imgui.Columns(1)
imgui.EndChild()
imgui.Text("")
imgui.SetCursorPos(imgui.ImVec2(110, 235))
imgui.BeginChild("Window_3", imgui.ImVec2(430, 135), true)
imgui.SetCursorPos(imgui.ImVec2(10, 10))
imgui.Checkbox("Show ID ", checked1)
imgui.SetCursorPos(imgui.ImVec2(120, 10))
imgui.Checkbox("Show_Nick ", checked2)
imgui.SetCursorPos(imgui.ImVec2(230, 10))
imgui.Checkbox("Show_Ping ", checked3)
imgui.SetCursorPos(imgui.ImVec2(10, 35))
imgui.Checkbox("Show_Money ", checked4)
imgui.SetCursorPos(imgui.ImVec2(120, 35))
imgui.Checkbox("Show_LVL ", checked5)
imgui.SetCursorPos(imgui.ImVec2(230, 35))
imgui.Checkbox("Show Health ", checked6)
imgui.SetCursorPos(imgui.ImVec2(10, 60))
imgui.Checkbox("Show Armour ", checked7)
imgui.SetCursorPos(imgui.ImVec2(120, 60))
imgui.Checkbox("Show Players ", checked8)
imgui.SetCursorPos(imgui.ImVec2(230, 60))
imgui.Checkbox("Show Streaming ", checked9)
imgui.SetCursorPos(imgui.ImVec2(10, 85))
imgui.Checkbox("Show_Interior ", checked10)
imgui.SetCursorPos(imgui.ImVec2(120, 85))
imgui.Checkbox("Show_Coordinates", checked11)
imgui.EndChild()
if imgui.Button("1") then
themes.SwitchColorTheme(1)
end
imgui.SameLine()
if imgui.Button("2") then
themes.SwitchColorTheme(2)
end
if imgui.Button("3") then
themes.SwitchColorTheme(3)
end
imgui.SameLine()
if imgui.Button("4") then
themes.SwitchColorTheme(4)
end
if imgui.Button("5") then
themes.SwitchColorTheme(5)
end
imgui.SameLine()
if imgui.Button("6") then
themes.SwitchColorTheme(6)
end
if imgui.Button("7") then
themes.SwitchColorTheme(7)
end
imgui.SameLine()
if imgui.Button("8") then
themes.SwitchColorTheme(8)
end
imgui.End()
end