Вопросы по Lua скриптингу

Общая тема для вопросов по разработке скриптов на языке программирования Lua, в частности под MoonLoader.
  • Задавая вопрос, убедитесь, что его нет в списке частых вопросов и что на него ещё не отвечали (воспользуйтесь поиском).
  • Поищите ответ в теме посвященной разработке Lua скриптов в MoonLoader
  • Отвечая, убедитесь, что ваш ответ корректен.
  • Старайтесь как можно точнее выразить мысль, а если проблема связана с кодом, то обязательно прикрепите его к сообщению, используя блок [code=lua]здесь мог бы быть ваш код[/code].
  • Если вопрос связан с MoonLoader-ом первым делом желательно поискать решение на wiki.

Частые вопросы

Как научиться писать скрипты? С чего начать?
Информация - Гайд - Всё о Lua скриптинге для MoonLoader(https://blast.hk/threads/22707/)
Как вывести текст на русском? Вместо русского текста у меня какие-то каракули.
Изменить кодировку файла скрипта на Windows-1251. В Atom: комбинация клавиш Ctrl+Shift+U, в Notepad++: меню Кодировки -> Кодировки -> Кириллица -> Windows-1251.
Как получить транспорт, в котором сидит игрок?
Lua:
local veh = storeCarCharIsInNoSave(PLAYER_PED)
Как получить свой id или id другого игрока?
Lua:
local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED) -- получить свой ид
local _, id = sampGetPlayerIdByCharHandle(ped) -- получить ид другого игрока. ped - это хендл персонажа
Как проверить, что строка содержит какой-то текст?
Lua:
if string.find(str, 'текст', 1, true) then
-- строка str содержит "текст"
end
Как эмулировать нажатие игровой клавиши?
Lua:
local game_keys = require 'game.keys' -- где-нибудь в начале скрипта вне функции main

setGameKeyState(game_keys.player.FIREWEAPON, -1) -- будет сэмулировано нажатие клавиши атаки
Все иды клавиш находятся в файле moonloader/lib/game/keys.lua.
Подробнее о функции setGameKeyState здесь: lua - setgamekeystate | BlastHack — DEV_WIKI(https://www.blast.hk/wiki/lua:setgamekeystate)
Как получить id другого игрока, в которого целюсь я?
Lua:
local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE) -- получить хендл персонажа, в которого целится игрок
if valid and doesCharExist(ped) then -- если цель есть и персонаж существует
  local result, id = sampGetPlayerIdByCharHandle(ped) -- получить samp-ид игрока по хендлу персонажа
  if result then -- проверить, прошло ли получение ида успешно
    -- здесь любые действия с полученным идом игрока
  end
end
Как зарегистрировать команду чата SAMP?
Lua:
-- До бесконечного цикла/задержки
sampRegisterChatCommand("mycommand", function (param)
     -- param будет содержать весь текст введенный после команды, чтобы разделить его на аргументы используйте string.match()
    sampAddChatMessage("MyCMD", -1)
end)
Крашит игру при вызове sampSendChat. Как это исправить?
Это происходит из-за бага в SAMPFUNCS, когда производится попытка отправки пакета определенными функциями изнутри события исходящих RPC и пакетов. Исправления для этого бага нет, но есть способ не провоцировать его. Вызов sampSendChat изнутри обработчика исходящих RPC/пакетов нужно обернуть в скриптовый поток с нулевой задержкой:
Lua:
function onSendRpc(id)
  -- крашит:
  -- sampSendChat('Send RPC: ' .. id)

  -- норм:
  lua_thread.create(function()
    wait(0)
    sampSendChat('Send RPC: ' .. id)
  end)
end
 
Последнее редактирование:

sep

Известный
673
76
каму не овер в падлу сделайте чтобы по умолчанию было вкл

код:
script_name("nameTag")
script_description("alt + F3 to turn on/off")
script_version_number(3)
script_version("v.003")
script_authors("hnnssy")
local mem = require "memory"


--- Main
function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while true do
        wait(0)
        if isKeyDown(18) and isKeyJustPressed(114) then -- ALT+F3
            nameTagOn()
            --sampAddChatMessage("on", 0xFFFF00)
            printStringNow("Wallhack ~g~ON", 1000)
            repeat
            wait(0)
            if isKeyDown(119) then
                nameTagOff()
                wait(1000)
                nameTagOn()
            end
            until isKeyDown(18) and isKeyJustPressed(114)
            while isKeyDown(18) or isKeyDown(114) do
            wait(10)
            end
            nameTagOff()
            --sampAddChatMessage("off", 0xFFFF00)
            printStringNow("Wallhack ~r~OFF", 1000)
        end
    end
end

function nameTagOn()
    local pStSet = sampGetServerSettingsPtr()
    NTdist = mem.getfloat(pStSet + 39) -- дальность
    NTwalls = mem.getint8(pStSet + 47) -- видимость через стены
    NTshow = mem.getint8(pStSet + 56) -- видимость тегов
    mem.setfloat(pStSet + 39, 1488.0)
    mem.setint8(pStSet + 47, 0)
    mem.setint8(pStSet + 56, 1)
end

function nameTagOff()
    local pStSet = sampGetServerSettingsPtr()
    mem.setfloat(pStSet + 39, NTdist)
    mem.setint8(pStSet + 47, NTwalls)
    mem.setint8(pStSet + 56, NTshow)
end


--- Events
function onExitScript()
    if NTdist then
        nameTagOff()
    end
end
 

Next..

Известный
343
135
каму не овер в падлу сделайте чтобы по умолчанию было вкл

код:
script_name("nameTag")
script_description("alt + F3 to turn on/off")
script_version_number(3)
script_version("v.003")
script_authors("hnnssy")
local mem = require "memory"


--- Main
function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while true do
        wait(0)
        if isKeyDown(18) and isKeyJustPressed(114) then -- ALT+F3
            nameTagOn()
            --sampAddChatMessage("on", 0xFFFF00)
            printStringNow("Wallhack ~g~ON", 1000)
            repeat
            wait(0)
            if isKeyDown(119) then
                nameTagOff()
                wait(1000)
                nameTagOn()
            end
            until isKeyDown(18) and isKeyJustPressed(114)
            while isKeyDown(18) or isKeyDown(114) do
            wait(10)
            end
            nameTagOff()
            --sampAddChatMessage("off", 0xFFFF00)
            printStringNow("Wallhack ~r~OFF", 1000)
        end
    end
end

function nameTagOn()
    local pStSet = sampGetServerSettingsPtr()
    NTdist = mem.getfloat(pStSet + 39) -- дальность
    NTwalls = mem.getint8(pStSet + 47) -- видимость через стены
    NTshow = mem.getint8(pStSet + 56) -- видимость тегов
    mem.setfloat(pStSet + 39, 1488.0)
    mem.setint8(pStSet + 47, 0)
    mem.setint8(pStSet + 56, 1)
end

function nameTagOff()
    local pStSet = sampGetServerSettingsPtr()
    mem.setfloat(pStSet + 39, NTdist)
    mem.setint8(pStSet + 47, NTwalls)
    mem.setint8(pStSet + 56, NTshow)
end


--- Events
function onExitScript()
    if NTdist then
        nameTagOff()
    end
end
Код:
script_name("nameTag")
script_description("alt + F3 to turn on/off")
script_version_number(3)
script_version("v.003")
script_authors("hnnssy")
local mem = require "memory"


--- Main
function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    nameTagOn()
    while true do
        wait(0)
        if isKeyDown(18) and isKeyJustPressed(114) then -- ALT+F3
            nameTagOn()
            --sampAddChatMessage("on", 0xFFFF00)
            printStringNow("Wallhack ~g~ON", 1000)
            repeat
            wait(0)
            if isKeyDown(119) then
                nameTagOff()
                wait(1000)
                nameTagOn()
            end
            until isKeyDown(18) and isKeyJustPressed(114)
            while isKeyDown(18) or isKeyDown(114) do
            wait(10)
            end
            nameTagOff()
            --sampAddChatMessage("off", 0xFFFF00)
            printStringNow("Wallhack ~r~OFF", 1000)
        end
    end
end

function nameTagOn()
    local pStSet = sampGetServerSettingsPtr()
    NTdist = mem.getfloat(pStSet + 39) -- дальность
    NTwalls = mem.getint8(pStSet + 47) -- видимость через стены
    NTshow = mem.getint8(pStSet + 56) -- видимость тегов
    mem.setfloat(pStSet + 39, 1488.0)
    mem.setint8(pStSet + 47, 0)
    mem.setint8(pStSet + 56, 1)
end

function nameTagOff()
    local pStSet = sampGetServerSettingsPtr()
    mem.setfloat(pStSet + 39, NTdist)
    mem.setint8(pStSet + 47, NTwalls)
    mem.setint8(pStSet + 56, NTshow)
end


--- Events
function onExitScript()
    if NTdist then
        nameTagOff()
    end
end
 

BARRY BRADLEY

Известный
711
176
Возможно ли заблокировать движение камеры (как будто камхак) именно от сервера. Надо запретить изменение координат положения камеры
 

chapo

🫡 В армии с 17.10.2023. В ЛС НЕ ОТВЕЧАЮ
Друг
8,776
11,227
Возможно ли заблокировать движение камеры (как будто камхак) именно от сервера. Надо запретить изменение координат положения камеры
Lua:
local sampev = require 'lib.samp.events'
function sampev.onSetCameraPosition(position)
    return false
end

function sampev.onSetCameraLookAt(lookAtPosition, cutType)
    return false
end
 
  • Нравится
Реакции: BARRY BRADLEY

sep

Известный
673
76
Код:
script_name("nameTag")
script_description("alt + F3 to turn on/off")
script_version_number(3)
script_version("v.003")
script_authors("hnnssy")
local mem = require "memory"


--- Main
function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    nameTagOn()
    while true do
        wait(0)
        if isKeyDown(18) and isKeyJustPressed(114) then -- ALT+F3
            nameTagOn()
            --sampAddChatMessage("on", 0xFFFF00)
            printStringNow("Wallhack ~g~ON", 1000)
            repeat
            wait(0)
            if isKeyDown(119) then
                nameTagOff()
                wait(1000)
                nameTagOn()
            end
            until isKeyDown(18) and isKeyJustPressed(114)
            while isKeyDown(18) or isKeyDown(114) do
            wait(10)
            end
            nameTagOff()
            --sampAddChatMessage("off", 0xFFFF00)
            printStringNow("Wallhack ~r~OFF", 1000)
        end
    end
end

function nameTagOn()
    local pStSet = sampGetServerSettingsPtr()
    NTdist = mem.getfloat(pStSet + 39) -- дальность
    NTwalls = mem.getint8(pStSet + 47) -- видимость через стены
    NTshow = mem.getint8(pStSet + 56) -- видимость тегов
    mem.setfloat(pStSet + 39, 1488.0)
    mem.setint8(pStSet + 47, 0)
    mem.setint8(pStSet + 56, 1)
end

function nameTagOff()
    local pStSet = sampGetServerSettingsPtr()
    mem.setfloat(pStSet + 39, NTdist)
    mem.setint8(pStSet + 47, NTwalls)
    mem.setint8(pStSet + 56, NTshow)
end


--- Events
function onExitScript()
    if NTdist then
        nameTagOff()
    end
end
невыклюяается
 

auf.exe

Участник
40
12
Вот код:
require 'lib.moonloader'

local rk = require 'rkeys'
local imgui = require 'imgui'
local sampev = require 'lib.samp.events'
local vk = require 'vkeys'
local imadd = require 'imgui_addons'
local inicfg = require 'inicfg'
local noctf = import 'imgui_notf.lua'
local directini = 'moonloader\\settings.ini'
imgui.HotKey = require('imgui_addons').HotKey


local mainini = inicfg.load(nil, directini)

if mainini.HotKey == nil then
    mainini.HotKey = {
        bind1 = "[18, 82]",
        bind2 = "[18, 83]"
    }
end

local tLastKeys = { }

local ActiveClockKeys = {
    v = decodeJson(mainini.HotKey.bind1)
}
local ActiveClockKeys2 = {
    v = decodeJson(mainini.HotKey.bind2)
}

local main_window = imgui.ImBool(false)
local textbuffer = imgui.ImBuffer(256)
local textbuffer2 = imgui.ImBuffer(256)

local sw, sr = getScreenResolution()

function main()
    while not isSampAvailable() do wait(0) end
    sampAddChatMessage('qq Binder tuta', -1)
    sampRegisterChatCommand('Lox', imgui1)

    bindClock = rk.registerHotKey(ActiveClockKeys, true, bind)
    bindClock1 = rk.registerHotKey(ActiveClockKeys2, true, bind2)

    while true do
        wait(0)
        if isKeyJustPressed(VK_M) then
            main_window.v = not main_window.v
            imgui.Process = main_window.v
        end
    end
end

function bind()
    sampSendChat(textbuffer.v)
    noctf.addNotifon("Задача выполнена!", 5, 3)
end
function bind2()
    sampSendChat(textbuffer2.v)
    noctf.addNotifon("Задача выполнена!", 5, 3)
end

function imgui.OnDrawFrame()

    imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sr / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
    imgui.SetNextWindowSize(imgui.ImVec2(300, 250), imgui.Cond.FirstUseEver)

    if not main_window.v then
        imgui.Process = false
    end
    imgui.Begin("Binder by auf.exe", main_window)

   

    if imgui.HotKey('##2', ActiveClockKeys, tLastKeys, 100) then
        rk.changeHotKey(bindClock2, ActiveClockKeys.v)
        mainini.HotKey.bind1 = encodeJson(ActiveClockKeys.v)
        mainini.HotKey.bind2 = encodeJson(ActiveClockKeys.v)
        inicfg.save(mainini, directini)
    end
    imgui.SameLine()
    imgui.InputText('Some Text', textbuffer)
    imgui.Separator()
    if imgui.HotKey('##2', ActiveClockKeys2, tLastKeys, 100) then
        rk.changeHotKey(bindClock2, ActiveClockKeys.v)
        mainini.HotKey.bind1 = encodeJson(ActiveClockKeys.v)
        mainini.HotKey.bind2 = encodeJson(ActiveClockKeys2.v)
        inicfg.save(mainini, directini)
    end
    imgui.SameLine()
    imgui.InputText('Bind 2', textbuffer2)
   
    mainini.HotKey.bind1 = encodeJson(ActiveClockKeys.v)
    mainini.HotKey.bind2 = encodeJson(ActiveClockKeys2.v)
    inicfg.save(mainini, directini)
    imgui.End()
end
Блять скрипт работает хоткеи меняются но НЕ выполняется задача.Пашет дальше не криашит, но хоткеи не выполняются
Да блять кто поможет или никто не ебет?
 

Versaces

Активный
301
30
Нужно чтобы метка ставилась не на месте серверного пикапа, а на 10 метров дальше, но чтобы направление в какую сторону дальше было относительно моего местонахождения, т.е. если я слева от пикапа, то метка будет ставиться правее от пикапа на 20 метров, и так же если я правее то будет ставиться на 20 метров левее
Тык-скрипт
 

tsunamiqq

Участник
429
16
Как сделать такую кнопку
1637007534561.png
 

_Nelit_

Потрачен
109
39
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Скиньте пожалуйста статус загрузки, что говорит о том, что во время загрузки произошла ошибка или загрузка была каким то образом отменена. Я про эти штуки STATUS_ENDDOWNLOADDATA
 

chapo

🫡 В армии с 17.10.2023. В ЛС НЕ ОТВЕЧАЮ
Друг
8,776
11,227
Скиньте пожалуйста статус загрузки, что говорит о том, что во время загрузки произошла ошибка или загрузка была каким то образом отменена. Я про эти штуки STATUS_ENDDOWNLOADDATA
все статусы хранятся в массиве в файле moonloader\lib\moonloader.lua
 
  • Нравится
Реакции: _Nelit_

tsunamiqq

Участник
429
16
Как сделать "Оверлей" что бы по нажатию на чекбоксы (они в 4 акте) вылезало менюшка справа снизу и что бы все было видно типо Никнейм, и т.д, в чекбоксах все написано
Lua:
script_name('FamilyHelper v.1.0')
script_author('Lycorn')
script_description('FamilyHelper')
script_version('1.0')
require "lib.moonloader"
local imgui = require 'imgui'
local key = require 'vkeys'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
cp1251 = encoding.CP1251
local inicfg = require 'inicfg'
local directIni = 'moonloader\\config\\famhelper by lycorn.ini'
local mainIni = inicfg.load(nil, directIni)
local act = 0

local fa = require 'faIcons'
local fa_glyph_ranges = imgui.ImGlyphRanges({ fa.min_range, fa.max_range })

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

--local stateIni = inicfg.save(mainIni, directIni)
local status = inicfg.load(mainIni, directIni)
local mainIni = inicfg.load({
    config = {
        vr=false,
        fam=false,
        j=false,
        ad=false,
        vr_text='',
        fam_text='',
        j_text='',
        ad_text='',
        vr_delay=60000,
        fam_delay=60000,
        j_delay=60000,
    },
    statistic = {
        stat_off_on=false,
        id=false,
        fama=false,
        organization=false,
        rang_org=false,
        work=false,
        hp=false,
        bronya=false,
        time=false,
        onlined=false,
        afkd=false,
        onlinen=false,
        afkn=false,
    }
}, "famhelper by lycorn")
inicfg.save(mainIni, 'famhelper by lycorn.ini')

local selected_item = imgui.ImInt(0)
local vr_delay = imgui.ImInt(mainIni.config.vr_delay / 60000)
local fam_delay = imgui.ImInt(mainIni.config.fam_delay / 60000)
local j_delay = imgui.ImInt(mainIni.config.j_delay / 60000)
local ad_delay = imgui.ImInt(mainIni.config.ad_delay / 60000)
local text_vr = imgui.ImBuffer(256)
local text_fam = imgui.ImBuffer(256)
local text_j = imgui.ImBuffer(256)
local text_ad = imgui.ImBuffer(256)
local vr = imgui.ImBool(mainIni.config.vr)
local fam = imgui.ImBool(mainIni.config.fam)
local j = imgui.ImBool(mainIni.config.j)
local ad = imgui.ImBool(mainIni.config.ad)
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 checked12 = imgui.ImBool(false)
local checked13 = imgui.ImBool(false)
local main_window_state = imgui.ImBool(false)
local checkbox = imgui.ImBool(false)

function imgui.OnDrawFrame()
    local iScreenWidth, iScreenHeight = getScreenResolution()
    local btn_size = imgui.ImVec2(-1, 0)
    if main_window_state.v then
        imgui.SetNextWindowSize(imgui.ImVec2(1000, 500), imgui.Cond.FirstUseEver)
        imgui.Begin('Family Helper v 1.0', main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
        imgui.BeginChild('##tabs', imgui.ImVec2(200, 460), true)
        if imgui.Button(fa.ICON_BARS .. ' Настройки', imgui.ImVec2(185,50), main_window_state) then act = 0 end
        if imgui.Button(fa.ICON_BELL_O .. ' АвтоПиар', imgui.ImVec2(185,50), main_window_state) then act = 1 end
        if imgui.Button(fa.ICON_USER ..' Управление Участниками', imgui.ImVec2(185,50), main_window_state) then act = 2 end
        if imgui.Button(fa.ICON_USER_CIRCLE .. ' Меню Лидера-Заместителя', imgui.ImVec2(185,50), main_window_state) then act = 3 end
        if imgui.Button(fa.ICON_SERVER .. ' Настройка Статистики', imgui.ImVec2(185,50), main_window_state) then act = 4 end
        imgui.EndChild()
        imgui.SameLine()
        if act == 0 then
            imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
            if imgui.Combo('Стиль темы', selected_item, {'Красный', 'Синий', 'Монохрон', 'Свётло-Темный'}, 4, main_window_state) then
                if selected_item.v == 0 then
                  RedTheme()
                end
                  if selected_item.v == 1 then
                      BlueTheme()
                  end
                  if selected_item.v == 2 then
                      MonTheme()
                  end
                  if selected_item.v == 3 then
                      SvTmTheme()
                  end
              end
            imgui.Separator()
            imgui.EndChild()
        elseif act == 1 then
            imgui.BeginChild('##twice', imgui.ImVec2(860, 460), true)
            imgui.SetCursorPosX(290)
            if imgui.Checkbox('/vr', vr) then
                mainIni.config.vr = vr.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/fam', fam) then
                mainIni.config.fam = fam.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/ad', ad) then
                mainIni.config.ad = ad.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/j', j) then
                mainIni.config.j = j.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.Separator()
            if vr.v then
                if imgui.InputText('Введите текст для /vr', text_vr, main_window_state) then
                    mainIni.config.vr_text = text_vr.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##1', vr_delay, 1,60, main_window_state) then
                    mainIni.config.vr_delay = text_vr.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if fam.v then
                if imgui.InputText('Введите текст для /fam', text_fam, main_window_state) then
                    mainIni.config.fam_text = text_fam.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##2', fam_delay, 1,60, main_window_state) then
                    mainIni.config.fam_delay = text_fam.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if j.v then
                if imgui.InputText('Введите текст для /j', text_j, main_window_state) then
                    mainIni.config.j_text = text_j.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##3', j_delay, 1,60, main_window_state) then
                    mainIni.config.j_delay = text_j.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if ad.v then
                if imgui.InputText('Введите текст для /ad', text_ad, main_window_state) then
                    mainIni.config.ad_text = text_ad.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##4', ad_delay, 1,60, main_window_state) then
                    mainIni.config.ad_delay = text_ad.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            imgui.SetCursorPosX(290)
            imgui.Text('Активация пиара /fpiar')
            imgui.EndChild()
        elseif act == 2 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        elseif act == 3 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        elseif act == 4 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.SetCursorPosX(290)
                if imgui.Checkbox('Вкл/Выкл статистику', checked1) then
                        mainIni.statistic.stat_off_on = checked1.v
                        inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                imgui.Separator()
                if imgui.Checkbox('Ваш ID', checked2) then
                    mainIni.statistic.id = checked2.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о семье', checked3) then
                    mainIni.statistic.fama = checked3.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о организации', checked4) then
                    mainIni.statistic.organization = checked4.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о ранге', checked5) then
                    mainIni.statistic.rang_org = checked5.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о работе', checked6) then
                    mainIni.statistic.work = checked6.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о здоровье', checked7) then
                    mainIni.statistic.hp = checked7.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о броне', checked8) then
                    mainIni.statistic.bronya = checked8.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о времени', checked9) then
                    mainIni.statistic.time = checked9.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Онлайн за день', checked10) then
                    mainIni.statistic.onlined = checked10.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('АФК за день', checked11) then
                    mainIni.statistic.afkd = checked11.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Онлайн за неделю', checked12) then
                    mainIni.statistic.onlinen = checked12.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('АФК за неделю', checked13) then
                    mainIni.statistic.afkn = checked13.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                imgui.EndChild()
        end
    end
    imgui.End()
end

function piar()
    autopiar = not autopiar
    if autopiar then
        sampAddChatMessage(u8:decode'[FamHelper] AutoPiar включен!', 0x00BFFF)
    end
    lua_thread.create(function()
        if vr.v then
            if autopiar then
                sampSendChat('/vr '..mainIni.config.vr_text)
                wait(mainIni.config.vr_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if ad.v then
            if autopiar then
                sampSendChat('/ad '..mainIni.config.ad_text)
                wait(mainIni.config.ad_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if fam.v then
            if autopiar then
                sampSendChat('/fam '..mainIni.config.fam_text)
                wait(mainIni.config.fam_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if j.v then
            if autopiar then
                sampSendChat('/j '..mainIni.config.j_text)
                wait(mainIni.config.j_delay)
                return true
            end
        end
    end)
    if not autopiar then
        sampAddChatMessage(u8:decode'[FamHelper] AutoPiar выключен!', 0x00BFFF)
    end
end

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(2000) end
    sampAddChatMessage(u8:decode'[FamHelper] Автор скрипта - lycorn', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] Версия скрипта - 1.0', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] Активация хелпера /famh', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] По всем вопросам пишите в ВК - @lycorn.maks', 0x00BFFF)
    sampRegisterChatCommand('famh', function() main_window_state.v = not main_window_state.v end)
    sampRegisterChatCommand('fpiar', piar)
    while true do
        wait(0)
        imgui.Process = main_window_state.v
        if checkbox.v then
            printStringNow('test', 1000)
        end
    end
end

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

    colors[clr.Text]                 = ImVec4(1.00, 1.00, 1.00, 0.78)
    colors[clr.TextDisabled]         = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.WindowBg]             = ImVec4(0.11, 0.15, 0.17, 1.00)
    colors[clr.ChildWindowBg]        = ImVec4(0.15, 0.18, 0.22, 1.00)
    colors[clr.PopupBg]              = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.Border]               = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.BorderShadow]         = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg]              = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.FrameBgHovered]       = ImVec4(0.12, 0.20, 0.28, 1.00)
    colors[clr.FrameBgActive]        = ImVec4(0.09, 0.12, 0.14, 1.00)
    colors[clr.TitleBg]              = ImVec4(0.53, 0.20, 0.16, 0.65)
    colors[clr.TitleBgActive]        = ImVec4(0.56, 0.14, 0.14, 1.00)
    colors[clr.TitleBgCollapsed]     = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.MenuBarBg]            = ImVec4(0.15, 0.18, 0.22, 1.00)
    colors[clr.ScrollbarBg]          = ImVec4(0.02, 0.02, 0.02, 0.39)
    colors[clr.ScrollbarGrab]        = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.ScrollbarGrabHovered] = ImVec4(0.18, 0.22, 0.25, 1.00)
    colors[clr.ScrollbarGrabActive]  = ImVec4(0.09, 0.21, 0.31, 1.00)
    colors[clr.ComboBg]              = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.CheckMark]            = ImVec4(1.00, 0.28, 0.28, 1.00)
    colors[clr.SliderGrab]           = ImVec4(0.64, 0.14, 0.14, 1.00)
    colors[clr.SliderGrabActive]     = ImVec4(1.00, 0.37, 0.37, 1.00)
    colors[clr.Button]               = ImVec4(0.59, 0.13, 0.13, 1.00)
    colors[clr.ButtonHovered]        = ImVec4(0.69, 0.15, 0.15, 1.00)
    colors[clr.ButtonActive]         = ImVec4(0.67, 0.13, 0.07, 1.00)
    colors[clr.Header]               = ImVec4(0.20, 0.25, 0.29, 0.55)
    colors[clr.HeaderHovered]        = ImVec4(0.98, 0.38, 0.26, 0.80)
    colors[clr.HeaderActive]         = ImVec4(0.98, 0.26, 0.26, 1.00)
    colors[clr.Separator]            = ImVec4(0.50, 0.50, 0.50, 1.00)
    colors[clr.SeparatorHovered]     = ImVec4(0.60, 0.60, 0.70, 1.00)
    colors[clr.SeparatorActive]      = ImVec4(0.70, 0.70, 0.90, 1.00)
    colors[clr.ResizeGrip]           = ImVec4(0.26, 0.59, 0.98, 0.25)
    colors[clr.ResizeGripHovered]    = ImVec4(0.26, 0.59, 0.98, 0.67)
    colors[clr.ResizeGripActive]     = ImVec4(0.06, 0.05, 0.07, 1.00)
    colors[clr.CloseButton]          = ImVec4(0.40, 0.39, 0.38, 0.16)
    colors[clr.CloseButtonHovered]   = ImVec4(0.40, 0.39, 0.38, 0.39)
    colors[clr.CloseButtonActive]    = ImVec4(0.40, 0.39, 0.38, 1.00)
    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.25, 1.00, 0.00, 0.43)
    colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
end

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

    colors[clr.FrameBg]                = ImVec4(0.16, 0.29, 0.48, 0.54)
    colors[clr.FrameBgHovered]         = ImVec4(0.26, 0.59, 0.98, 0.40)
    colors[clr.FrameBgActive]          = ImVec4(0.26, 0.59, 0.98, 0.67)
    colors[clr.TitleBg]                = ImVec4(0.04, 0.04, 0.04, 1.00)
    colors[clr.TitleBgActive]          = ImVec4(0.16, 0.29, 0.48, 1.00)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.CheckMark]              = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.SliderGrab]             = ImVec4(0.24, 0.52, 0.88, 1.00)
    colors[clr.SliderGrabActive]       = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.Button]                 = ImVec4(0.26, 0.59, 0.98, 0.40)
    colors[clr.ButtonHovered]          = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.ButtonActive]           = ImVec4(0.06, 0.53, 0.98, 1.00)
    colors[clr.Header]                 = ImVec4(0.26, 0.59, 0.98, 0.31)
    colors[clr.HeaderHovered]          = ImVec4(0.26, 0.59, 0.98, 0.80)
    colors[clr.HeaderActive]           = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.Separator]              = colors[clr.Border]
    colors[clr.SeparatorHovered]       = ImVec4(0.26, 0.59, 0.98, 0.78)
    colors[clr.SeparatorActive]        = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.ResizeGrip]             = ImVec4(0.26, 0.59, 0.98, 0.25)
    colors[clr.ResizeGripHovered]      = ImVec4(0.26, 0.59, 0.98, 0.67)
    colors[clr.ResizeGripActive]       = ImVec4(0.26, 0.59, 0.98, 0.95)
    colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.59, 0.98, 0.35)
    colors[clr.Text]                   = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.TextDisabled]           = ImVec4(0.50, 0.50, 0.50, 1.00)
    colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 0.94)
    colors[clr.ChildWindowBg]          = ImVec4(1.00, 1.00, 1.00, 0.00)
    colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.ComboBg]                = colors[clr.PopupBg]
    colors[clr.Border]                 = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.BorderShadow]           = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.MenuBarBg]              = ImVec4(0.14, 0.14, 0.14, 1.00)
    colors[clr.ScrollbarBg]            = ImVec4(0.02, 0.02, 0.02, 0.53)
    colors[clr.ScrollbarGrab]          = ImVec4(0.31, 0.31, 0.31, 1.00)
    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.CloseButton]            = ImVec4(0.41, 0.41, 0.41, 0.50)
    colors[clr.CloseButtonHovered]     = ImVec4(0.98, 0.39, 0.36, 1.00)
    colors[clr.CloseButtonActive]      = ImVec4(0.98, 0.39, 0.36, 1.00)
    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.ModalWindowDarkening]   = ImVec4(0.80, 0.80, 0.80, 0.35)
end

function MonTheme()
    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)
end

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

    style.WindowPadding = imgui.ImVec2(9, 5)
    style.WindowRounding = 10
    style.ChildWindowRounding = 10
    style.FramePadding = imgui.ImVec2(5, 3)
    style.FrameRounding = 6.0
    style.ItemSpacing = imgui.ImVec2(9.0, 3.0)
    style.ItemInnerSpacing = imgui.ImVec2(9.0, 3.0)
    style.IndentSpacing = 21
    style.ScrollbarSize = 6.0
    style.ScrollbarRounding = 13
    style.GrabMinSize = 17.0
    style.GrabRounding = 16.0
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
    style.ButtonTextAlign = imgui.ImVec2(0.5, 0.5)

    colors[clr.Text]                   = ImVec4(0.90, 0.90, 0.90, 1.00)
    colors[clr.TextDisabled]           = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.WindowBg]               = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.ChildWindowBg]          = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.PopupBg]                = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.Border]                 = ImVec4(0.82, 0.77, 0.78, 1.00)
    colors[clr.BorderShadow]           = ImVec4(0.35, 0.35, 0.35, 0.66)
    colors[clr.FrameBg]                = ImVec4(1.00, 1.00, 1.00, 0.28)
    colors[clr.FrameBgHovered]         = ImVec4(0.68, 0.68, 0.68, 0.67)
    colors[clr.FrameBgActive]          = ImVec4(0.79, 0.73, 0.73, 0.62)
    colors[clr.TitleBg]                = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.TitleBgActive]          = ImVec4(0.46, 0.46, 0.46, 1.00)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.MenuBarBg]              = ImVec4(0.00, 0.00, 0.00, 0.80)
    colors[clr.ScrollbarBg]            = ImVec4(0.00, 0.00, 0.00, 0.60)
    colors[clr.ScrollbarGrab]          = ImVec4(1.00, 1.00, 1.00, 0.87)
    colors[clr.ScrollbarGrabHovered]   = ImVec4(1.00, 1.00, 1.00, 0.79)
    colors[clr.ScrollbarGrabActive]    = ImVec4(0.80, 0.50, 0.50, 0.40)
    colors[clr.ComboBg]                = ImVec4(0.24, 0.24, 0.24, 0.99)
    colors[clr.CheckMark]              = ImVec4(0.99, 0.99, 0.99, 0.52)
    colors[clr.SliderGrab]             = ImVec4(1.00, 1.00, 1.00, 0.42)
    colors[clr.SliderGrabActive]       = ImVec4(0.76, 0.76, 0.76, 1.00)
    colors[clr.Button]                 = ImVec4(0.51, 0.51, 0.51, 0.60)
    colors[clr.ButtonHovered]          = ImVec4(0.68, 0.68, 0.68, 1.00)
    colors[clr.ButtonActive]           = ImVec4(0.67, 0.67, 0.67, 1.00)
    colors[clr.Header]                 = ImVec4(0.72, 0.72, 0.72, 0.54)
    colors[clr.HeaderHovered]          = ImVec4(0.92, 0.92, 0.95, 0.77)
    colors[clr.HeaderActive]           = ImVec4(0.82, 0.82, 0.82, 0.80)
    colors[clr.Separator]              = ImVec4(0.73, 0.73, 0.73, 1.00)
    colors[clr.SeparatorHovered]       = ImVec4(0.81, 0.81, 0.81, 1.00)
    colors[clr.SeparatorActive]        = ImVec4(0.74, 0.74, 0.74, 1.00)
    colors[clr.ResizeGrip]             = ImVec4(0.80, 0.80, 0.80, 0.30)
    colors[clr.ResizeGripHovered]      = ImVec4(0.95, 0.95, 0.95, 0.60)
    colors[clr.ResizeGripActive]       = ImVec4(1.00, 1.00, 1.00, 0.90)
    colors[clr.CloseButton]            = ImVec4(0.45, 0.45, 0.45, 0.50)
    colors[clr.CloseButtonHovered]     = ImVec4(0.70, 0.70, 0.90, 0.60)
    colors[clr.CloseButtonActive]      = ImVec4(0.70, 0.70, 0.70, 1.00)
    colors[clr.PlotLines]              = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.PlotLinesHovered]       = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.PlotHistogram]          = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.TextSelectedBg]         = ImVec4(1.00, 1.00, 1.00, 0.35)
    colors[clr.ModalWindowDarkening]   = ImVec4(0.88, 0.88, 0.88, 0.35)
end
 

Pashyka

Участник
220
17
Как получить следующий столбик с диалога, текст:
[22:57:06.540936] (script) Media Helper: {FFFFFF}Отправитель {50F471}Время{FFFFFF}
{FFFFFF}Skandal_Griffin 446c
{FFFFFF}Mickey_Benson 220c
{FFFFFF}Scarxhald_Scarred 2375c
{FFFFFF}Nata_Sharova 3240c
{FFFFFF}Jok_Winchester 592c
{FFFFFF}Haver_Pale 2778c
{FCDB45}[VIP]{FFFFFF} Jason_Morisson 97c
{FFFFFF}Denis_Benger 2133c
{FCDB45}[VIP]{FFFFFF} Piero_Gravina 272c
{FFFFFF}Katana_Yzymaki 706c


Это код, который получает только имена, мне нужно получить еще и время, в функциях этого что-то не нашел, может как-то по-другому это?
1637013789366.png