script_name("SAMPRECOLOR")
script_author("ARMOR")
script_version("0.2")
local imgui = require 'mimgui'
local memory = require 'memory'
local inicfg = require 'inicfg'
local encoding = require 'encoding'
encoding.default = "CP1251"
u8 = encoding.UTF8
local sw, sh = getScreenResolution()
local new = imgui.new
local mainFrame = new.bool(false)
local cfg = inicfg.load({
config = {
hpHigh = 4290322984,
armorHigh = 4291348680,
hostname = 4290690750,
id = 4288000208,
scrollbar = 4290322984,
stButtonText = 4291348680,
hvButtonText = 4294967295,
stButtonOutline = 4291348680,
clButtonOutline = 4288000208,
dialogHeader = 4292006610,
dialogText = 4289316068,
systemMsgs = 4289316068,
screenClass = 4287146594,
netstats = 4287138030,
dl3dtext = 4281699284,
},
colorimgui = {
hpHighR = 255,
hpHighG = 255,
hpHighB = 255,
armorHighR = 255,
armorHighG = 255,
armorHighB = 255,
hostnameR = 255,
hostnameG = 255,
hostnameB = 255,
idR = 255,
idG = 255,
idB = 255,
scrollbarR = 255,
scrollbarG = 255,
scrollbarB = 255,
stButtonTextR = 255,
stButtonTextG = 255,
stButtonTextB = 255,
hvButtonTextR = 255,
hvButtonTextG = 255,
hvButtonTextB = 255,
stButtonOutlineR = 255,
stButtonOutlineG = 255,
stButtonOutlineB = 255,
clButtonOutlineR = 255,
clButtonOutlineG = 255,
clButtonOutlineB = 255,
dialogHeaderR = 255,
dialogHeaderG = 255,
dialogHeaderB = 255,
dialogTextR = 255,
dialogTextG = 255,
dialogTextB = 255,
systemMsgsR = 255,
systemMsgsG = 255,
systemMsgsB = 255,
screenClassR = 255,
screenClassG = 255,
screenClassB = 255,
netstatsR = 255,
netstatsG = 255,
netstatsB = 255,
dl3dtextR = 255,
dl3dtextG = 255,
dl3dtextB = 255,
}
}, "RECOLORER.ini")
local samp = getModuleHandle("samp.dll")
local setmemory = {
{0x68B0C, cfg.config.hpHigh, 0},
{0x68B33, cfg.config.hpHigh, 1},
{0x68DD5, cfg.config.armorHigh, 0},
{0x68E00, cfg.config.armorHigh, 1},
{0x6ABA8, cfg.config.hostname, 0},
{0x6AB39, cfg.config.hostname, 0},
{0x6AC32, cfg.config.id, 0},
{0x6AC6D, cfg.config.id, 0},
{0x6ACB0, cfg.config.id, 0},
{0x6ACEF, cfg.config.id, 0},
{0x89277, cfg.config.scrollbar, 0},
{0x8929E, cfg.config.stButtonText, 0},
{0x89296, cfg.config.hvButtonText, 0},
{0x89272, cfg.config.stButtonOutline, 0},
{0x89287, cfg.config.clButtonOutline, 0},
{0x891B0, cfg.config.dialogHeader, 0},
{0x6B2D2, cfg.config.dialogText, 0},
{0x6481B, cfg.config.systemMsgs, 0},
{0x64811, cfg.config.screenClass, 0},
{0x5D6C7, cfg.config.netstats, 0},
{0x712E1, cfg.config.dl3dtext, 0}
}
for i = 1, #setmemory do
if setmemory[i][3] == 0 then
memory.setuint32(samp + setmemory[i][1], setmemory[i][2], true)
else
memory.setuint32(samp + setmemory[i][1], setmemory[i][2] - 0xFF303030, true)
end
end
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while not isSampAvailable() do wait(100) end
if not doesFileExist(getWorkingDirectory()..'\\config\\RECOLORER.ini') then inicfg.save(cfg, 'RECOLORER.ini') end
sampAddChatMessage("[RECOLORER]: {FFFFFF}Скрипт загружен! Активация: {1FDBDC}/recolor", 0xDC33CC)
sampRegisterChatCommand("recolor", function()
mainFrame[0] = not mainFrame[0]
end)
wait(-1)
end
function join_argb(a, b, g, r)
local argb = b -- b
argb = bit.bor(argb, bit.lshift(g, 8)) -- g
argb = bit.bor(argb, bit.lshift(r, 16)) -- r
argb = bit.bor(argb, bit.lshift(a, 24)) -- a
return argb
end
local colors = {
{ cfg.colorimgui.hpHighR, cfg.colorimgui.hpHighG, cfg.colorimgui.hpHighB},
{ cfg.colorimgui.armorHighR, cfg.colorimgui.armorHighG, cfg.colorimgui.armorHighB },
{ cfg.colorimgui.hostnameR, cfg.colorimgui.hostnameG, cfg.colorimgui.hostnameB },
{ cfg.colorimgui.idR, cfg.colorimgui.idG, cfg.colorimgui.idB },
{ cfg.colorimgui.scrollbarR, cfg.colorimgui.scrollbarG, cfg.colorimgui.scrollbarB },
{ cfg.colorimgui.stButtonTextR, cfg.colorimgui.stButtonTextG, cfg.colorimgui.stButtonTextB },
{ cfg.colorimgui.hvButtonTextR, cfg.colorimgui.hvButtonTextG, cfg.colorimgui.hvButtonTextB },
{ cfg.colorimgui.stButtonOutlineR, cfg.colorimgui.stButtonOutlineG, cfg.colorimgui.stButtonOutlineB },
{ cfg.colorimgui.clButtonOutlineR, cfg.colorimgui.clButtonOutlineG, cfg.colorimgui.clButtonOutlineB },
{ cfg.colorimgui.dialogHeaderR, cfg.colorimgui.dialogHeaderG, cfg.colorimgui.dialogHeaderB },
{ cfg.colorimgui.dialogTextR, cfg.colorimgui.dialogTextG, cfg.colorimgui.dialogTextB },
{ cfg.colorimgui.systemMsgsR, cfg.colorimgui.systemMsgsG, cfg.colorimgui.systemMsgsB },
{ cfg.colorimgui.screenClassR, cfg.colorimgui.screenClassG, cfg.colorimgui.screenClassB },
{ cfg.colorimgui.netstatsR, cfg.colorimgui.netstatsG, cfg.colorimgui.netstatsB },
{ cfg.colorimgui.dl3dtextR, cfg.colorimgui.dl3dtextG, cfg.colorimgui.dl3dtextB }
}
for i = 1, #colors do
_G['color'..i] = imgui.new.float[3](colors[i][1] / 255, colors[i][2] / 255, colors[i][3] / 255)
end
function bebratooltip(text)
imgui.SameLine()
imgui.TextDisabled('?')
if imgui.IsItemHovered() then
imgui.BeginTooltip()
imgui.Image(img)
imgui.EndTooltip()
end
end
local imgui_cdraw = {
["полоски HP"] = { color1, cfg.config.hpHigh, cfg.colorimgui.hpHighR, cfg.colorimgui.hpHighG, cfg.colorimgui.hpHighB },
["полоски брони"] = { color2, cfg.config.armorHigh, cfg.colorimgui.armorHighR, cfg.colorimgui.armorHighG, cfg.colorimgui.armorHighB },
["названия сервера"] = { color3, cfg.config.hostname, cfg.colorimgui.hostnameR, cfg.colorimgui.hostnameG, cfg.colorimgui.hostnameB },
["информации TAB"] = { color4, cfg.config.id, cfg.colorimgui.idR, cfg.colorimgui.idG, cfg.colorimgui.idB },
["скролл бара"] = { color5, cfg.config.scrollbar, cfg.colorimgui.scrollbarR, cfg.colorimgui.scrollbarG, cfg.colorimgui.scrollbarB },
["текста кнопки диалога"] = { color6, cfg.config.stButtonText, cfg.colorimgui.stButtonTextR, cfg.colorimgui.stButtonTextG, cfg.colorimgui.stButtonTextB },
["текста наведенной кнопки диалога"] = { color7, cfg.config.hvButtonText, cfg.colorimgui.hvButtonTextR, cfg.colorimgui.hvButtonTextG, cfg.colorimgui.hvButtonTextB },
["кнопки диалога"] = { color8, cfg.config.stButtonOutline, cfg.colorimgui.stButtonOutlineR, cfg.colorimgui.stButtonOutlineG, cfg.colorimgui.stButtonOutlineB },
["наведенной кнопки диалога"] = { color9, cfg.config.clButtonOutline, cfg.colorimgui.clButtonOutlineR, cfg.colorimgui.clButtonOutlineG, cfg.colorimgui.clButtonOutlineB },
["названия диалога"] = { color10, cfg.config.dialogHeader, cfg.colorimgui.dialogHeaderR, cfg.colorimgui.dialogHeaderG, cfg.colorimgui.dialogHeaderB },
["текста диалога"] = { color11, cfg.config.dialogText, cfg.colorimgui.dialogTextR, cfg.colorimgui.dialogTextG, cfg.colorimgui.dialogTextB },
["текста подключения"] = { color12, cfg.config.systemMsgs, cfg.colorimgui.systemMsgsR, cfg.colorimgui.systemMsgsG, cfg.colorimgui.systemMsgsB },
["текста скриншота"] = { color13, cfg.config.screenClass, cfg.colorimgui.screenClassR, cfg.colorimgui.screenClassG, cfg.colorimgui.screenClassB },
["текста F5"] = { color14, cfg.config.netstats, cfg.colorimgui.netstatsR, cfg.colorimgui.netstatsG, cfg.colorimgui.netstatsB },
["текста /dl"] = { color15, cfg.config.dl3dtext, cfg.colorimgui.dl3dtextR, cfg.colorimgui.dl3dtextG, cfg.colorimgui.dl3dtextB },
}
local newFrame = imgui.OnFrame(
function() return mainFrame[0] end,
function(self)
imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(300, 500), imgui.Cond.FirstUseEver)
imgui.Begin("##12372121", mainFrame, imgui.WindowFlags.NoResize)
for i = 1, #imgui_cdraw do
imgui.Text(u8(imgui_cdraw[i]))
imgui.SameLine(270)
if imgui.ColorEdit3("##"..i, imgui_cdraw[i][1], imgui.ColorEditFlags.NoInputs) then
local r, g, b = imgui_cdraw[i][1][0] * 255, imgui_cdraw[i][1][1] * 255, imgui_cdraw[i][1][2] * 255
imgui_cdraw[i][2] = ("0xFF%06X"):format(join_argb(0, imgui_cdraw[i][1][2] * 255, imgui_cdraw[i][1][1] * 255, imgui_cdraw[i][1][0] * 255))
imgui_cdraw[i][3] = r
imgui_cdraw[i][4] = g
imgui_cdraw[i][5] = b
inicfg.save(cfg, "RECOLORER.ini")
end
imgui.Separator()
end
if imgui.Button(u8"Сбросить настройки", imgui.ImVec2(285, 25)) then
cfg.config.hpHigh = 4290322984
cfg.config.armorHigh = 4291348680
cfg.config.hostname = 4290690750
cfg.config.id = 4288000208
cfg.config.scrollbar = 4290322984
cfg.config.stButtonText = 4291348680
cfg.config.hvButtonText = 4294967295
cfg.config.stButtonOutline = 4291348680
cfg.config.clButtonOutline = 4288000208
cfg.config.dialogHeader = 4292006610
cfg.config.dialogText = 4289316068
cfg.config.systemMsgs = 4289316068
cfg.config.screenClass = 4287146594
cfg.config.netstats = 4287138030
cfg.config.dl3dtext = 4281699284
inicfg.save(cfg, "RECOLORER.ini")
end
imgui.End()
end
)