local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local moonloader = require('moonloader')
local tag = '[My First Script]:'
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"
local main_window_state = imgui.ImBool(false)
arrSelectable = {false, false}
local text_buffer = imgui.ImBuffer(256)
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100)
end
wait(3000)
sampAddChatMessage("Arizona State Helper v.1.0", 0xADFF2F)
sampRegisterChatCommand("gh", function() main_window_state.v = not main_window_state.v end)
_, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
nick = sampGetPlayerNickname(id)
imgui.Process = false
while true do
wait(0)
if main_window_state.v == false then
imgui.Process = false
end
if isKeyJustPressed(VK_F3) then
sampAddChatMessage(" {FFFFFF}F3. " ..main_color_text .. " : {FFFFFF}" .. nick .. ", " .. main_color_text .. " ID: {FFFFFF}" .. id, main_color)
end
if isKeyDown(VK_L) and isKeyJustPressed(VK_L) then
sampSendChat('/lock')
end
if isKeyDown(VK_K) and isKeyJustPressed(VK_K) then
sampSendChat('/key')
end
imgui.Process = main_window_state.v
if not main_window_state.v then
imgui.Process = false
end
end
end
function imgui.OnDrawFrame()
if main_window_state.v then
imgui.SetNextWindowPos(imgui.ImVec2(imgui.GetIO().DisplaySize.x / 2, imgui.GetIO().DisplaySize.y / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(267, 235), imgui.Cond.FirstUseEver)
imgui.Begin('State Tools Helper', main_window_state, imgui.WindowFlags.NoResize)
imgui.TextColoredRGB(u8"{F4A460}Добро пожаловать в State Helper")
imgui.BeginChild("ChildWindow22", imgui.ImVec2(300, 150), true)
imgui.Text("111")
imgui.EndChild()
imgui.End()
end
end
function imgui.TextColoredRGB(text)
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
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