Помогите ошибка в луа скрипте

Максимкалфа

Потрачен
Автор темы
7
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Версия SA-MP
  1. 0.3.7 (R1)
  2. 0.3.7-R2
  3. 0.3.7-R3
  4. 0.3.7-R4
[11:59:05.726073] (system) Session started.
[11:59:05.737073] (debug) Module handle: 69730000

MoonLoader v.026.5-beta loaded.
Developers: FYP, hnnssy, EvgeN 1137

Copyright (c) 2016, BlastHack Team
https://www.blast.hk/moonloader/

[11:59:05.738066] (info) Working directory: H:\Games\gta endizzy ft. genzai lox\moonloader
[11:59:05.739067] (debug) FP Control: 0009001F
[11:59:05.739067] (debug) Game: GTA SA 1.0.0.0 US
[11:59:05.739067] (system) Installing pre-game hooks...
[11:59:05.844001] (system) Hooks installed.
[11:59:08.169564] (debug) Initializing opcode handler table
[11:59:08.200546] (debug) package.path = H:\Games\gta endizzy ft. genzai lox\moonloader\lib\?.lua;H:\Games\gta endizzy ft. genzai lox\moonloader\lib\?\init.lua;H:\Games\gta endizzy ft. genzai lox\moonloader\?.lua;H:\Games\gta endizzy ft. genzai lox\moonloader\?\init.lua;.\?.lua;H:\Games\gta endizzy ft. genzai lox\moonloader\lib\?.luac;H:\Games\gta endizzy ft. genzai lox\moonloader\lib\?\init.luac;H:\Games\gta endizzy ft. genzai lox\moonloader\?.luac;H:\Games\gta endizzy ft. genzai lox\moonloader\?\init.luac;.\?.luac
[11:59:08.200546] (debug) package.cpath = H:\Games\gta endizzy ft. genzai lox\moonloader\lib\?.dll;
[11:59:08.215536] (system) Loading script 'H:\Games\gta endizzy ft. genzai lox\moonloader\1. specadm 2.lua'...
[11:59:08.238522] (debug) New script: 099A115C
[11:59:08.365443] (error) 1. specadm 2.lua: ...s\gta endizzy ft. genzai lox\moonloader\1. specadm 2.lua:1: module 'lib.samp.events' not found:
no field package.preload['lib.samp.events']
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\lib\samp\events.lua'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\lib\samp\events\init.lua'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\samp\events.lua'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\samp\events\init.lua'
no file '.\lib\samp\events.lua'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\lib\samp\events.luac'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\lib\samp\events\init.luac'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\samp\events.luac'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\samp\events\init.luac'
no file '.\lib\samp\events.luac'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\lib\samp\events.dll'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\lib.dll'
stack traceback:
[C]: in function 'require'
...s\gta endizzy ft. genzai lox\moonloader\1. specadm 2.lua:1: in main chunk
[11:59:08.366442] (error) 1. specadm 2.lua: Script died due to an error. (099A115C)
[11:59:08.366442] (system) Loading script 'H:\Games\gta endizzy ft. genzai lox\moonloader\AutoReboot.lua'...
[11:59:08.367442] (debug) New script: 099A146C
[11:59:08.388429] (system) ML-AutoReboot: Loaded successfully.
[11:59:08.388429] (system) Loading script 'H:\Games\gta endizzy ft. genzai lox\moonloader\check-moonloader-updates.lua'...
[11:59:08.388429] (debug) New script: 099A0FD4
[11:59:08.404420] (system) Check MoonLoader Updates: Loaded successfully.
[11:59:08.404420] (system) Loading script 'H:\Games\gta endizzy ft. genzai lox\moonloader\new_chat.lua'...
[11:59:08.404420] (debug) New script: 099A12E4
[11:59:08.407418] (error) Chat by Score: H:\Games\gta endizzy ft. genzai lox\moonloader\new_chat.lua:6: module 'libstd.deps' not found:
no field package.preload['libstd.deps']
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\libstd\deps.lua'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\libstd\deps\init.lua'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\libstd\deps.lua'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\libstd\deps\init.lua'
no file '.\libstd\deps.lua'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\libstd\deps.luac'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\libstd\deps\init.luac'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\libstd\deps.luac'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\libstd\deps\init.luac'
no file '.\libstd\deps.luac'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\libstd\deps.dll'
no file 'H:\Games\gta endizzy ft. genzai lox\moonloader\lib\libstd.dll'
stack traceback:
[C]: in function 'require'
H:\Games\gta endizzy ft. genzai lox\moonloader\new_chat.lua:6: in main chunk
[11:59:08.407418] (error) Chat by Score: Script died due to an error. (099A12E4)
[11:59:08.408417] (system) Loading script 'H:\Games\gta endizzy ft. genzai lox\moonloader\SF Integration.lua'...
[11:59:08.408417] (debug) New script: 099A06A4
[11:59:08.413413] (system) SF Integration: Loaded successfully.
[11:59:08.413413] (system) Loading script 'H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua'...
[11:59:08.413413] (debug) New script: 099A082C
[11:59:08.414413] (system) tes.lua: Loaded successfully.
[11:59:08.415412] (system) tes.lua: Script terminated. (099A082C)
[11:59:14.720325] (system) Installing post-load hooks...
[11:59:14.735316] (system) Hooks installed.
[12:11:44.432883] (script) ML-AutoReboot: Loading "H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua"...
[12:11:44.461863] (system) Loading script 'H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua'...
[12:11:44.462862] (debug) New script: 1081EE1C
[12:11:44.464861] (system) Server: Loaded successfully.
[12:11:44.465860] (error) Server: H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua:11: attempt to call global 'isSamfuncsLoaded' (a nil value)
stack traceback:
H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua: in function <H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua:10>
[12:11:44.465860] (error) Server: Script died due to an error. (1081EE1C)
[12:13:48.053057] (script) ML-AutoReboot: Loading "H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua"...
[12:13:48.121015] (system) Loading script 'H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua'...
[12:13:48.121015] (debug) New script: 099A0E4C
[12:13:48.123014] (system) First script: Loaded successfully.
[12:13:48.124013] (error) First script: H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua:11: attempt to call global 'isSamfuncsLoaded' (a nil value)
stack traceback:
H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua: in function <H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua:10>
[12:13:48.124013] (error) First script: Script died due to an error. (099A0E4C)
[12:14:17.134830] (script) ML-AutoReboot: Loading "H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua"...
[12:14:17.135828] (system) Loading script 'H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua'...
[12:14:17.136828] (debug) New script: 0AE9E84C
[12:14:17.137691] (system) First script: Loaded successfully.
[12:14:17.138673] (system) First script: Script terminated. (0AE9E84C)
[12:15:50.571870] (script) ML-AutoReboot: Loading "H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua"...
[12:15:50.776744] (system) Loading script 'H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua'...
[12:15:50.777743] (debug) New script: 099A0E4C
[12:15:50.779741] (system) First script: Loaded successfully.
[12:15:50.779741] (system) First script: Script terminated. (099A0E4C)
[13:03:31.725025] (script) ML-AutoReboot: Loading "H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua"...
[13:03:31.729022] (system) Loading script 'H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua'...
[13:03:31.730022] (debug) New script: 107EA274
[13:03:31.730022] (error) tes.lua: H:\Games\gta endizzy ft. genzai lox\moonloader\tes.lua:11: 'then' expected near 'isSampfuncsLoaded'
[13:03:31.730022] (error) tes.lua: Script died due to an error. (107EA274)

Вот ошибка моего луа





Вот код












script_name("First script") -- название скрипта
script_author("Makes Score") -- автор скрипта
script_description("Command") -- описание скрипта

require "lib.moonloader" -- подключение библиотеки

local tag = "[My First Script]:" -- локальная переменная
local label = 0

function main()
if not isSampLoaded() or nor isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end

if label == 1 then
-- условие 1
sampAddChatMessage(tag .. " text", 0xFFFF00)
else
-- условие 2
sampAddChatMessage(tag .. " text", 0xFFFF00)
end

--sampAddChatMessage(tag .. " text", 0xFFFF00)

-- Блок выполняеться один раз после старта сампа

while true do
wait(0)
-- Блок выполняеться бесконечно (пока самп активен)

end
end
 

Albertio

Attention! Thanks for your attention.
877
702
1) У тебя не установлена библиотек Events
2) В скрипте new_chat.lua шестая строчка 'libstd.deps' исправь на 'lib.std.deps '
3) В скрипте tes.lua одиннадцатая строчка isSamfuncsLoaded замени на isSampfuncsLoaded
4) В исходнике который ты прикрепил заменить строчку
if not isSampLoaded() or nor isSampfuncsLoaded() then return end
на
if not isSampLoaded() or not isSampfuncsLoaded() then return end
 
  • Нравится
Реакции: Максимкалфа

Максимкалфа

Потрачен
Автор темы
7
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
1) У тебя не установлена библиотек Events
2) В скрипте new_chat.lua шестая строчка 'libstd.deps' исправь на 'lib.std.deps '
3) В скрипте tes.lua одиннадцатая строчка isSamfuncsLoaded замени на isSampfuncsLoaded
4) В исходнике который ты прикрепил заменить строчку
if not isSampLoaded() or nor isSampfuncsLoaded() then return end
на
if not isSampLoaded() or not isSampfuncsLoaded() then return end
спс
1) У тебя не установлена библиотек Events
2) В скрипте new_chat.lua шестая строчка 'libstd.deps' исправь на 'lib.std.deps '
3) В скрипте tes.lua одиннадцатая строчка isSamfuncsLoaded замени на isSampfuncsLoaded
4) В исходнике который ты прикрепил заменить строчку
if not isSampLoaded() or nor isSampfuncsLoaded() then return end
на
if not isSampLoaded() or not isSampfuncsLoaded() then return end
Подскажи еще пажалуйсто вот ошибка
H:\Games\gta endizzy ft. genzai lox\moonloader\new_chat.lua:6: in main chunk
[14:51:03.926834] (error) mimgui chat by snowman: Script died due to an error. (1043CBC4)
[14:51:03.926834] (system) Loading script 'H:\Games\gta endizzy ft. genzai lox\moonloader\reload_all.lua'...
[14:51:03.927834] (debug) New script: 1043CD4C







вот код






script_name('mimgui chat by score')
script_version('1.2')
script_version_number(1)
script_author('MakesScore')

require "lib.std.deps" {
"fyp:mimgui"
}

local sampev = require "lib.samp.events"
local imgui, ffi = require "mimgui", require "ffi"
local new, str = imgui.new, ffi.string
local memory, vk = require "memory", require "vkeys"
local encoding = require "encoding"
encoding.default = "CP1251"
local u8 = encoding.UTF8
local cyr = encoding.CP1251

local inicfg = require "inicfg"
local direction = "new_chat"
local set = inicfg.load({
wcolors = {
0.15,
0.15,
0.15,
0.97
},
pattern_names = {
"main",
"news",
"admins",
nil,
nil,
nil,
nil,
nil,
nil,
nil
},
pattern_colors = {
-1,
14221567,
-10270721,
nil,
nil,
nil,
nil,
nil,
nil,
nil
},
pattern_text = {
"all",
"Объявление: ",
"Администратор",
nil,
nil,
nil,
nil,
nil,
nil,
nil
},
ignore_text = {
"Объявление: ",
"Отредактировал",
"Администратор",
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
},
ignore_colors = {
14221567,
14221567,
-10270721,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
},
bools = {
show_colors = false,
show_timestamp = false,
show_samp_chat = true,
show_custom_chat = true,
show_copy = false,
}
}, direction)

local imgui_cfg = {
chat_Window = new.bool(true),
settings_Window = new.bool(false),
input_Window = new.bool(false),
input_text = new.char[160](),
show_colors = new.bool(false),
show_timestamp = new.bool(false),
show_samp_chat = new.bool(true),
show_copy = new.bool(false),
copy = new.bool(false),
ignore_text = {
new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](),
new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144]() },
ignore_colors = {
new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1),
new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1) },
pattern_names = {
new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144]() },
pattern_text = {
new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144](), new.char[144]() },
pattern_colors = {
new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1), new.int(-1) },
menu_picker = new.float[4](),
mainWBool = false,
mainWTimer = 0,
scrollBool = false,
}

function loadImguiCfg()
imgui_cfg.show_colors = new.bool(set.bools.show_colors)
imgui_cfg.show_timestamp = new.bool(set.bools.show_timestamp)
imgui_cfg.show_samp_chat = new.bool(set.bools.show_samp_chat)
imgui_cfg.chat_Window = new.bool(set.bools.show_custom_chat)
imgui_cfg.show_copy = new.bool(set.bools.show_copy)
for i = 1, #set.ignore_text do
imgui_cfg.ignore_text = new.char[144](u8(tostring(set.ignore_text)))
imgui_cfg.ignore_colors = new.int(set.ignore_colors)
end
for i = 1, #set.pattern_names do
imgui_cfg.pattern_names = new.char[144](u8(tostring(set.pattern_names)))
imgui_cfg.pattern_text = new.char[144](u8(tostring(set.pattern_text)))
imgui_cfg.pattern_colors = new.int(set.pattern_colors)
end
imgui_cfg.menu_picker = new.float[4](set.wcolors[1], set.wcolors[2], set.wcolors[3], set.wcolors[4])
end

local main_color = new.float[4](0.161, 0.157, 0.188, 1.0)

local chats = {
[1] = { },
[2] = { },
[3] = { },
[4] = { },
[5] = { },
[6] = { },
[7] = { },
[8] = { },
[9] = { },
[10] = { },
}


for i = 1, #set.pattern_names do
for k = 1, 200 do
table.insert(chats, u8(" "))
end
end


function main()
if not isSampLoaded() then return end
while not isSampAvailable() do wait(100) end

sampRegisterChatCommand("schat", function()
imgui_cfg.settings_Window[0] = not imgui_cfg.settings_Window[0]
end)
loadImguiCfg()
memory.setuint8(sampGetBase() + 0x71480, set.bools.show_samp_chat and 0x74 or 0xEB, true)
while true do
wait(0)
if sampIsChatInputActive() and not set.bools.show_samp_chat then sampSetChatInputEnabled(false) end
if (isKeyJustPressed(vk.VK_F6) or isKeyJustPressed(vk.VK_T)) and not set.bools.show_samp_chat and not imgui_cfg.input_Window[0] then
imgui_cfg.input_Window[0] = not imgui_cfg.input_Window[0]
end
end
wait(-1)
end


function addMessage(text, color, table_name)
if set.bools.show_colors then text = string.format("| clr: %i. | %s", color, text) end
if set.bools.show_timestamp then text = string.format("[%s] %s", os.date("%X"), text) end
local color = bit.tohex(color)
if color == nil then color = 0xFFFFFF end
for i = #table_name, 1, -1 do
if i > 1 then table_name = table_name[i-1]
else table_name = "{"..color.."}"..text break
end
end
if table_name == chats[1] and imgui_cfg.scrollBool == false then imgui_cfg.scrollBool = true end
end

function sampev.onChatMessage(playerid, text)
local msg = string.format("%s: {FFFFFF}%s", sampGetPlayerNickname(playerid), text)
local color = argb_to_rgba(sampGetPlayerColor(playerid))
local ignore = false
for i = 1, #set.pattern_names do
if i == 1 then
for k = 1, #set.ignore_text do
if set.ignore_text[k] == nil or (msg:find(set.ignore_text[k]) and (set.ignore_colors[k] == color or set.ignore_colors[k] == -1)) then
ignore = true
break end
end
if not ignore then
addMessage(msg, color, chats)
end
else
if msg:find(set.pattern_text) and (set.pattern_colors == color or set.pattern_colors == -1) then
addMessage(msg, color, chats)
end
end
end
end

function sampev.onServerMessage(color, msg)
local ignore = false
for i = 1, #set.pattern_names do
if i == 1 then
for k = 1, #set.ignore_text do
if set.ignore_text[k] == nil or (msg:find(set.ignore_text[k]) and (set.ignore_colors[k] == color or set.ignore_colors[k] == -1)) then
ignore = true
break end
end
if not ignore then
addMessage(msg, color, chats)
end
else
if msg:find(set.pattern_text) and (set.pattern_colors == color or set.pattern_colors == -1) then
addMessage(msg, color, chats)
end
end
end
end

function apply_custom_style()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4


style.WindowRounding = 1.5
style.WindowTitleAlign = imgui.ImVec2(0.5, 0.45)
style.FrameRounding = 1.0
style.ItemSpacing = imgui.ImVec2(4.0, 4.0)
style.GrabMinSize = 8.0
style.GrabRounding = 1.0
style.WindowBorderSize = 0.0
style.WindowPadding = imgui.ImVec2(4.0, 4.0)
style.FramePadding = imgui.ImVec2(2.5, 3.5)
style.WindowMinSize = imgui.ImVec2(150, 30)
style.TabRounding = 0.0
style.TabBorderSize = 0.0

colors[clr.Text] = ImVec4(1.00, 1.00, 1.00, 1.00)

colors[clr.TextDisabled] = ImVec4(0.7, 0.7, 0.7, 1.0)

colors[clr.WindowBg] = ImVec4(imgui_cfg.menu_picker[0], imgui_cfg.menu_picker[1], imgui_cfg.menu_picker[2], imgui_cfg.menu_picker[3]) -- 097

colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.0)
colors[clr.Border] = ImVec4(main_color[0], main_color[1], main_color[2], 0.0)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)

colors[clr.FrameBg] = ImVec4(main_color[0], main_color[1], main_color[2], 1.0)
colors[clr.FrameBgHovered] = ImVec4(main_color[0], main_color[1], main_color[2], 1.0)
colors[clr.FrameBgActive] = ImVec4(main_color[0], main_color[1], main_color[2], 1.0)

colors[clr.TitleBg] = ImVec4(main_color[0], main_color[1], main_color[2], 1.0)
colors[clr.TitleBgActive] = ImVec4(main_color[0], main_color[1], main_color[2], 1.0)
colors[clr.TitleBgCollapsed] = ImVec4(main_color[0], main_color[1], main_color[2], 0.79)

colors[clr.MenuBarBg] = ImVec4(0.14, 0.14, 0.14, 1.00)

colors[clr.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0)
colors[clr.ScrollbarGrab] = ImVec4(main_color[0], main_color[1], main_color[2], 0)

colors[clr.ScrollbarGrabHovered] = ImVec4(0.41, 0.41, 0.41, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.51, 0.51, 0.51, 1.00)

colors[clr.CheckMark] = ImVec4(main_color[0] + 0.13, main_color[1] + 0.13, main_color[2] + 0.13, 1.00)

colors[clr.SliderGrab] = ImVec4(main_color[0] + 0.13, main_color[1] + 0.13, main_color[2] + 0.13, 0.50)
colors[clr.SliderGrabActive] = ImVec4(main_color[0] + 0.13, main_color[1] + 0.13, main_color[2] + 0.13, 1.00)

colors[clr.Button] = ImVec4(main_color[0], main_color[1], main_color[2], 0.4)
colors[clr.ButtonHovered] = ImVec4(main_color[0], main_color[1], main_color[2], 1.0)
colors[clr.ButtonActive] = ImVec4(main_color[0], main_color[1], main_color[2], 0.7)

colors[clr.Header] = ImVec4(main_color[0], main_color[1], main_color[2], 0.6)
colors[clr.HeaderHovered] = ImVec4(main_color[0], main_color[1], main_color[2], 0.43)
colors[clr.HeaderActive] = ImVec4(main_color[0], main_color[1], main_color[2], 0.8)

colors[clr.Tab] = ImVec4(main_color[0], main_color[1], main_color[2], 0.0)
colors[clr.TabActive] = ImVec4(main_color[0], main_color[1], main_color[2], 0)
colors[clr.TabHovered] = ImVec4(main_color[0], main_color[1], main_color[2], 0.0)
colors[clr.TabUnfocusedActive] = ImVec4(main_color[0], main_color[1], main_color[2], 0)

colors[clr.Separator] = colors[clr.Border]
colors[clr.SeparatorHovered] = ImVec4(0.26, 0.59, 0.98, 0.0)
colors[clr.SeparatorActive] = ImVec4(0.26, 0.59, 0.98, 0.0)

colors[clr.ResizeGrip] = ImVec4(main_color[0], main_color[1], main_color[2], 0)
colors[clr.ResizeGripHovered] = ImVec4(main_color[0], main_color[1], main_color[2], 1.0)
colors[clr.ResizeGripActive] = ImVec4(main_color[0], main_color[1], main_color[2], 1.0)

colors[clr.PlotLines] = ImVec4(0.61, 0.61, 0.61, 1.00)
colors[clr.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00)
colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)

colors[clr.TextSelectedBg] = ImVec4(0.26, 0.59, 0.98, 0.35)
end

-- imgui.OnInitialize() вызывается всего раз, перед первым показом рендера
local outline_font, main_font
imgui.OnInitialize(function()
apply_custom_style() -- применим кастомный стиль
local defGlyph = imgui.GetIO().Fonts.ConfigData.Data[0].GlyphRanges
imgui.GetIO().Fonts:Clear() -- очистим шрифты
local font_config = imgui.ImFontConfig() -- у каждого шрифта есть свой конфиг
font_config.SizePixels = 12;
font_config.GlyphOffset.x = 0.5
font_config.GlyphOffset.y = 1
-- основной шрифт
local def = imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\arialbd.ttf', font_config.SizePixels, font_config, defGlyph)
main_font = imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\arialbd.ttf', 18, font_config, defGlyph)
--
local outline_config = imgui.ImFontConfig()
outline_config.GlyphOffset.x = 1.0
outline_config.GlyphOffset.y = 2
outline_font = imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\arialbd.ttf', 18.02, outline_config, defGlyph)

local config = imgui.ImFontConfig()
config.MergeMode = true
config.PixelSnapH = true
config.FontDataOwnedByAtlas = false
config.GlyphOffset.y = 1 -- смещение на 1 пиксеот вниз
imgui.GetIO().ConfigWindowsMoveFromTitleBarOnly = true
end)
local mWindowSize, mPos, mSize
imgui.OnFrame(function () return imgui_cfg.chat_Window[0] end,
function()
if not isSampLoaded() or not isSampAvailable() then return end
imgui.SetNextWindowPos(imgui.ImVec2(43, 6), imgui.Cond.FirstUseEver)
imgui.SetNextWindowSize(imgui.ImVec2(795, 187), imgui.Cond.FirstUseEver)
local hover_alpha = HoverAction(1)
imgui.PushStyleColor(imgui.Col.Tab, imgui.ImVec4(main_color[0], main_color[1], main_color[2], hover_alpha / 4))
imgui.PushStyleColor(imgui.Col.TabActive, imgui.ImVec4(main_color[0], main_color[1], main_color[2], hover_alpha))
imgui.PushStyleColor(imgui.Col.TabHovered, imgui.ImVec4(main_color[0], main_color[1], main_color[2], hover_alpha / 2))
imgui.PushStyleColor(imgui.Col.TabUnfocusedActive, imgui.ImVec4(main_color[0], main_color[1], main_color[2], hover_alpha))
imgui.PushStyleColor(imgui.Col.TitleBg, imgui.ImVec4(main_color[0], main_color[1], main_color[2], hover_alpha))
imgui.PushStyleColor(imgui.Col.TitleBgActive, imgui.ImVec4(main_color[0], main_color[1], main_color[2], hover_alpha))
imgui.PushStyleColor(imgui.Col.WindowBg, imgui.ImVec4(main_color[0], main_color[1], main_color[2], 0))
imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(1, 1, 1, hover_alpha))
imgui.PushStyleColor(imgui.Col.ChildBg, imgui.ImVec4(0.00, 0.00, 0.03, hover_alpha))
imgui.Begin(u8("chat"), imgui_cfg.chat_Window)
mWindowSize = imgui.GetWindowSize()
mPos = imgui.GetWindowPos()
imgui.BeginTabBar("chat_tab_bar")
for i = 1, #set.pattern_names do
if imgui.BeginTabItem(u8(set.pattern_names)) then
imgui.BeginChild("chat_child##"..i)
if set.bools.show_copy then space_num = 25
else space_num = 5 end
imgui.Indent(5)
for k = #chats, 1, -1 do
if set.bools.show_copy then
if imgui.Checkbox(u8("##copy_"..set.pattern_names..""..k), imgui_cfg.copy) then
imgui_cfg.copy = new.bool(false)
imgui.SetClipboardText(u8(chats[k]))
end
imgui.SameLine(space_num - 1)
end
imgui.PushFont(outline_font)
imgui.TextColoredRGB(chats[k], true)
imgui.SameLine(space_num)
imgui.TextColoredRGB(chats[k], true)
imgui.SameLine(space_num + 1)
imgui.TextColoredRGB(chats[k], true)
imgui.PopFont()
imgui.PushFont(main_font)
imgui.SameLine(space_num - 1)
imgui.TextColoredRGB(chats[k], true)
imgui.SameLine(space_num + 1)
imgui.TextColoredRGB(chats[k], true)
imgui.SameLine(space_num)
imgui.TextColoredRGB(chats[k], false)
imgui.PopFont()
end
if not sampIsCursorActive() and not imgui_cfg.input_Window[0] then
imgui.SetScrollY(HoverAction(2, imgui.GetScrollMaxY(), imgui.GetScrollY()))
end
if imgui.IsWindowHovered(imgui.HoveredFlags.AnyWindow) and (sampIsCursorActive() or imgui_cfg.input_Window[0]) then
imgui_cfg.mainWBool = true
else
imgui_cfg.mainWBool = false
end
imgui.EndChild()
imgui.EndTabItem()
end
end
imgui.EndTabBar()
imgui.End()
end).HideCursor = true

imgui.OnFrame(function () return imgui_cfg.input_Window[0] end,
function()
if not isSampLoaded() or not isSampAvailable() then return end
imgui.PushStyleColor(imgui.Col.WindowBg, imgui.ImVec4(0.00, 0.00, 0.03, 0))
imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(1, 1, 1, 1))
imgui.SetNextWindowPos(imgui.ImVec2(mPos.x, mPos.y + mWindowSize.y))
imgui.SetNextWindowSize(imgui.ImVec2(mWindowSize.x, 30))
imgui.Begin('chatik_input', imgui_cfg.input_Window, imgui.WindowFlags.NoTitleBar + imgui.WindowFlags.NoSavedSettings)
imgui.PushItemWidth(mWindowSize.x);
imgui.SetKeyboardFocusHere()
if imgui_cfg.input_Window[0] and (isKeyJustPressed(vk.VK_F6) or isKeyJustPressed(vk.VK_ESCAPE)) then
imgui_cfg.input_Window[0] = not imgui_cfg.input_Window[0]
end
if imgui.InputText("##chat_input1", imgui_cfg.input_text, 160, imgui.InputTextFlags.EnterReturnsTrue + imgui.InputTextFlags.AlwaysInsertMode) then
local input_text = u8:decode(str(imgui_cfg.input_text))
if input_text ~= nil then sampProcessChatInput(input_text) end
imgui_cfg.input_text = new.char[160]()
imgui_cfg.input_Window[0] = false
end
imgui.PopItemWidth();
imgui.End()
end)

imgui.OnFrame(function () return imgui_cfg.settings_Window[0] end,
function()
if not isSampLoaded() or not isSampAvailable() then return end
if imgui_cfg.settings_Window[0] then
set.wcolors[4] = 0.90
loadImguiCfg()
apply_custom_style()
else
set.wcolors[4] = 0.01
loadImguiCfg()
apply_custom_style()
end
local res_x, res_y = getScreenResolution()
imgui.SetNextWindowPos(imgui.ImVec2(res_x / 2 - res_x / 6, res_y / 2 - res_y / 6), imgui.Cond.FirstUseEver)
imgui.SetNextWindowSize(imgui.ImVec2(res_x / 3, res_y / 3), imgui.Cond.FirstUseEver)
imgui.Begin(u8(thisScript().name), imgui_cfg.settings_Window, imgui.WindowFlags.NoCollapse)
local wsize = imgui.GetWindowSize()
local selected_tab = 1
imgui.BeginTabBar("TAB##1")
if imgui.BeginTabItem(u8"main settings") then selected_tab = 1 imgui.EndTabItem() end
if imgui.BeginTabItem(u8"invidividual tabs") then selected_tab = 2 imgui.EndTabItem() end
imgui.EndTabBar()
if selected_tab == 1 then
if imgui.ColorEdit4(u8("color"), imgui_cfg.menu_picker, imgui.ColorEditFlags.AlphaBar) then
set.wcolors = { imgui_cfg.menu_picker[0], imgui_cfg.menu_picker[1], imgui_cfg.menu_picker[2], imgui_cfg.menu_picker[3] }
SaveSettings()
end
if imgui.Checkbox(u8"show samp chat", imgui_cfg.show_samp_chat) then
set.bools.show_samp_chat = not set.bools.show_samp_chat
memory.setuint8(sampGetBase() + 0x71480, set.bools.show_samp_chat and 0x74 or 0xEB, true)
SaveSettings()
end
imgui.SameLine()
if imgui.Checkbox(u8"show custom chat", imgui_cfg.chat_Window) then
set.bools.show_custom_chat = not set.bools.show_custom_chat
SaveSettings()
end
if imgui.Checkbox(u8"show colors", imgui_cfg.show_colors) then
set.bools.show_colors = not set.bools.show_colors
SaveSettings()
end
imgui.SameLine()
if imgui.Checkbox(u8"show timestamp", imgui_cfg.show_timestamp) then
set.bools.show_timestamp = not set.bools.show_timestamp
SaveSettings()
end
imgui.SameLine()
if imgui.Checkbox(u8"show copy buttons", imgui_cfg.show_copy) then
set.bools.show_copy = not set.bools.show_copy
SaveSettings()
end
imgui.Text("here u can add filter for main chat. use regular expressions and colors of messages.")
imgui.Text("if color == -1 then all find results will be shown on main chat.")
local bars_count = 0
for i = 1, #set.ignore_text do
if set.ignore_text ~= nil and set.ignore_colors ~= nil then bars_count = bars_count + 1 end
imgui.PushItemWidth(wsize.x * 0.475)
if imgui.InputText(u8("##ignore_text"..i), imgui_cfg.ignore_text, 144) then
set.ignore_text = u8:decode(str(imgui_cfg.ignore_text))
SaveSettings()
end
imgui.PopItemWidth()
imgui.SameLine(wsize.x * 0.51)
imgui.PushItemWidth(wsize.x * 0.475)
if imgui.InputInt(u8("##ignore_int"..i), imgui_cfg.ignore_colors, 1) then
set.ignore_colors = imgui_cfg.ignore_colors[0]
SaveSettings()
end
imgui.PopItemWidth()
end
imgui.Spacing()
if bars_count < 20 then
if imgui.Button(u8"add one more filter", imgui.ImVec2(wsize.x * 0.475, 25)) then
set.ignore_text[bars_count + 1], set.ignore_colors[bars_count + 1] = "regular expression"..bars_count + 1, -1
SaveSettings()
end
end
imgui.SameLine(wsize.x * 0.51)
if bars_count > 0 then
if imgui.Button(u8"delete last filter", imgui.ImVec2(wsize.x * 0.475, 25)) then
set.ignore_text[bars_count], set.ignore_colors[bars_count] = nil, nil
SaveSettings()
end
end
end
if selected_tab == 2 then
imgui.Text("here u can add individual tab for chat with your regular expressions.")
imgui.Text("if color == -1 then all find results will be shown on tab.")
local bars_count = 0
for i = 1, #set.pattern_names do
if set.pattern_names ~= nil and set.pattern_text ~= nil and set.pattern_colors ~= nil then bars_count = bars_count + 1 end
imgui.PushItemWidth(wsize.x * 0.31)
if imgui.InputText(u8("##pattern_name"..i), imgui_cfg.pattern_names, 64) then
set.pattern_names = u8:decode(str(imgui_cfg.pattern_names))
SaveSettings()
end
imgui.PopItemWidth()
imgui.SameLine(wsize.x * 0.327)
imgui.PushItemWidth(wsize.x * 0.31)
if imgui.InputText(u8("##pattern_text"..i), imgui_cfg.pattern_text, 64) then
set.pattern_text = u8:decode(str(imgui_cfg.pattern_text))
SaveSettings()
end
imgui.PopItemWidth()
imgui.SameLine(wsize.x * 0.64)
imgui.PushItemWidth(wsize.x * 0.34)
if imgui.InputInt(u8("##pattern_color"..i), imgui_cfg.pattern_colors, 1) then
set.pattern_colors = imgui_cfg.pattern_colors[0]
SaveSettings()
end
imgui.PopItemWidth()
end
imgui.Spacing()
if bars_count < 9 then
if imgui.Button(u8"add one more tab", imgui.ImVec2(wsize.x * 0.475, 25)) then
set.pattern_names[bars_count + 1], set.pattern_text[bars_count + 1], set.pattern_colors[bars_count + 1] = "tabname"..bars_count+1, "regular expression", -1
for k = 1, 200 do
table.insert(chats[bars_count + 1], u8(" "))
end
SaveSettings()
end
end
imgui.SameLine(wsize.x * 0.51)
if bars_count > 1 then
if imgui.Button(u8"delete last tab", imgui.ImVec2(wsize.x * 0.475, 25)) then
set.pattern_names[bars_count], set.pattern_text[bars_count], set.pattern_colors[bars_count] = nil, nil, nil
table.remove(chats[bars_count])
SaveSettings()
end
end
end
imgui.End()
end)

function HoverAction(variation, max_y, now_y)
if variation == 1 then
if imgui_cfg.mainWBool then imgui_cfg.mainWTimer = imgui_cfg.mainWTimer + 0.015
else imgui_cfg.mainWTimer = imgui_cfg.mainWTimer - 0.02
end
if imgui_cfg.mainWTimer > 0.85 then imgui_cfg.mainWTimer = 0.85
elseif imgui_cfg.mainWTimer < 0 then imgui_cfg.mainWTimer = 0 end
return imgui_cfg.mainWTimer
elseif variation == 2 then
if imgui_cfg.scrollBool then
imgui_cfg.scrollBool = false
if max_y < now_y + 200 then
local scrollTimer = max_y - max_y / 200
return scrollTimer
end
else
local scrollTimer = now_y + max_y / (now_y * 0.1)
if max_y / now_y < 1.0075 then scrollTimer = now_y + 0.9 end
if scrollTimer > max_y - 0.8 then scrollTimer = max_y end
return scrollTimer
end
end
end

function SaveSettings()
inicfg.save(set, direction)
loadImguiCfg()
end

function explode_argb(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

function join_argb(a, r, g, b)
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

function argb_to_rgba(argb)
local a, r, g, b = explode_argb(argb)
return join_argb(r, g, b, a)
end

function imgui.TextColoredRGB(text, outline) -- https://blast.hk/threads/13380/page-2#post-184571 | imring
local style = imgui.GetStyle()
local colors = style.Colors
local ImVec4 = imgui.ImVec4

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 = 1.0
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)
if outline == true then r, g, b, a = 0, 0, 0, 0 end
return ImVec4(r/255, g/255, b/255, 1.0)
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_ or colors[1], u8(text))
imgui.SameLine(nil, 0)
end
imgui.NewLine()
else imgui.Text(u8(w)) end
end
end
render_text(text)
end