local sw, sh = getScreenResolution()
local new, str = imgui.new, ffi.string
local russian_characters = {
[168] = 'Ё', [184] = 'ё', [192] = 'А', [193] = 'Б', [194] = 'В', [195] = 'Г', [196] = 'Д', [197] = 'Е', [198] = 'Ж', [199] = 'З', [200] = 'И', [201] = 'Й', [202] = 'К', [203] = 'Л', [204] = 'М', [205] = 'Н', [206] = 'О', [207] = 'П', [208] = 'Р', [209] = 'С', [210] = 'Т', [211] = 'У', [212] = 'Ф', [213] = 'Х', [214] = 'Ц', [215] = 'Ч', [216] = 'Ш', [217] = 'Щ', [218] = 'Ъ', [219] = 'Ы', [220] = 'Ь', [221] = 'Э', [222] = 'Ю', [223] = 'Я', [224] = 'а', [225] = 'б', [226] = 'в', [227] = 'г', [228] = 'д', [229] = 'е', [230] = 'ж', [231] = 'з', [232] = 'и', [233] = 'й', [234] = 'к', [235] = 'л', [236] = 'м', [237] = 'н', [238] = 'о', [239] = 'п', [240] = 'р', [241] = 'с', [242] = 'т', [243] = 'у', [244] = 'ф', [245] = 'х', [246] = 'ц', [247] = 'ч', [248] = 'ш', [249] = 'щ', [250] = 'ъ', [251] = 'ы', [252] = 'ь', [253] = 'э', [254] = 'ю', [255] = 'я',
}
imgui_window = {
bEnable = new.bool(),
searchField = new.char[128](),
property = imgui.WindowFlags.NoMove + imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoTitleBar + imgui.WindowFlags.NoResize,
style_dark = function()
imgui.SwitchContext()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
style.FrameRounding = 5.0
colors[clr.Text] = ImVec4(0.80, 0.80, 0.83, 1.00)
colors[clr.TextDisabled] = ImVec4(0.24, 0.23, 0.29, 1.00)
colors[clr.WindowBg] = ImVec4(0.06, 0.05, 0.07, 0.60)
colors[clr.ChildBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
colors[clr.PopupBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
colors[clr.Border] = ImVec4(0.06, 0.05, 0.07, 0.88)
colors[clr.BorderShadow] = ImVec4(0.92, 0.91, 0.88, 0.00)
colors[clr.FrameBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.FrameBgHovered] = ImVec4(0.24, 0.23, 0.29, 1.00)
colors[clr.FrameBgActive] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.ScrollbarBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.ScrollbarGrab] = ImVec4(0.80, 0.80, 0.83, 0.31)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
end,
size = imgui.ImVec2(400, 285)
}
imgui.OnInitialize(function()
imgui_window.style_dark()
imgui.GetIO().IniFilename = nil
end)
imgui.OnFrame(
function() return imgui_window.bEnable[0] end,
function(player)
imgui.SetNextWindowSize(imgui_window.size, imgui.Cond.FirstUseEver)
imgui.SetNextWindowPos(imgui.ImVec2(0.7*sw, 0.25*sh), imgui.Cond.FirstUseEver)
-- imgui.SetNextWindowPos(imgui.ImVec2(955, 185), imgui.Cond.FirstUseEver)
imgui.Begin("##"..thisScript().name, imgui_window.bEnable, imgui_window.property)
imgui.PushItemWidth(385)
imgui.InputText("##search", imgui_window.searchField, 128)
imgui.PopItemWidth()
for _, v in ipairs(edit_history) do
if string.find(string.rlower(v), string.rlower(u8:decode(str(imgui_window.searchField))), 1, true) then
imgui.Text(u8(v))
if imgui.IsItemClicked() then
if sampGetCurrentDialogId() == admenu.dialog and sampIsDialogActive() then
sampSetCurrentDialogEditboxText(v)
end
end
end
end
imgui.End()
end
).HideCursor = true
function string.rlower(s)
s = s:lower()
local strlen = s:len()
if strlen == 0 then return s end
s = s:lower()
local output = ''
for i = 1, strlen do
local ch = s:byte(i)
if ch >= 192 and ch <= 223 then -- upper russian characters
output = output .. russian_characters[ch + 32]
elseif ch == 168 then -- Ё
output = output .. russian_characters[184]
else
output = output .. string.char(ch)
end
end
return output
end