Вопросы по 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
 
Последнее редактирование:

Tol4ek

Активный
217
56
Lua:
script_name('VRManager')
script_author('Sanchez.')
script_description('Piar for VR Chat')

require 'lib.moonloader'

local encoding = require 'encoding'
local inicfg = require 'inicfg'
local imgui = require 'imgui'
local ia = require 'imgui_addons'
local sampev = require 'lib.samp.events'
local tag = "{FF0000}VR{FFFFFF}Manager: "
local selected = 1
encoding.default = 'CP1251'
u8 = encoding.UTF8

local mainIni = inicfg.load({
    config = {
    piar = false,
    textpiar = "",
    delay = 0,
    vrdisable = false,
    antimat = false,
    vrrus = false,
    sendprem = false,
    sendvip = false,
    sendpremtext = "",
    sendviptext = "",
    --command = "vm",
}
}, "VRManager")

local main_window_state = imgui.ImBool(false)
local sw, sh = getScreenResolution()

-- vars for config
local piar = imgui.ImBool(mainIni.config.piar)
local textpiar = imgui.ImBuffer(tostring(mainIni.config.textpiar), 300)
local delay = imgui.ImInt(mainIni.config.delay)
--local command = imgui.ImBuffer(tostring(mainIni.config.command), 50)
local vrdisable = imgui.ImBool(mainIni.config.vrdisable)
local antimat = imgui.ImBool(mainIni.config.antimat)
local vrrus = imgui.ImBool(mainIni.config.vrrus)
local sendprem = imgui.ImBool(mainIni.config.sendprem)
local sendvip = imgui.ImBool(mainIni.config.sendvip)
local sendpremtext = imgui.ImBuffer(tostring(mainIni.config.sendpremtext), 270)
local sendviptext = imgui.ImBuffer(tostring(mainIni.config.sendviptext), 270)
-- vars for config

function imgui.TextQuestion(text)
    imgui.SameLine()
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.PushTextWrapPos(450)
        imgui.TextUnformatted(text)
        imgui.PopTextWrapPos()
        imgui.EndTooltip()
    end
end

if not doesFileExist('moonloader/config/VRManager.ini') then inicfg.save(mainIni, 'VRManager.ini') end
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    sampAddChatMessage(tag .. "Автор: Sanchez. Открытие меню: /vm",-1)

    sampRegisterChatCommand("vm", function()
        main_window_state.v = not main_window_state.v

        imgui.Process = main_window_state.v
    end)

    imgui.Process = false

    while true do
        wait(0)
        if main_window_state.v == false then
            imgui.Process = false
        end
            if piar.v then
                wait(mainIni.config.delay)
                sampSendChat("/vr " .. u8:decode(mainIni.config.textpiar))
            end
    end

end

function imgui.OnDrawFrame()
    imgui.SetNextWindowSize(imgui.ImVec2(400, 250), imgui.Cond.FirstUseEver)
    imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

    imgui.Begin(u8"VRManager | V: 1.0 BETA | Автор: Sanchez", main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoMove)
    imgui.BeginChild("functii", imgui.ImVec2(-1, 23))
        if imgui.Button(u8"Флуды для /vr", imgui.ImVec2(180, -1)) then selected = 1 end
    imgui.SameLine()
        if imgui.Button(u8"Другие настройки", imgui.ImVec2(195, -1)) then selected = 2 end
    imgui.EndChild()
    imgui.BeginChild("main", imgui.ImVec2(-1, -1))
   -- imgui.PushItemWidth(130)
   -- imgui.InputText(u8"<< Активация меню (без / ) ", command)
   -- imgui.PopItemWidth()
    --imgui.Separator()
    if selected == 1 then
    ia.ToggleButton("##active", piar) imgui.SameLine() imgui.Text(u8"Включить/выключить авто-рекламу")
   -- imgui.Separator()
    imgui.PushItemWidth(200)
    imgui.InputText(u8"<< Ваша реклама", textpiar)
    imgui.PopItemWidth()
    imgui.PushItemWidth(100)
    imgui.InputInt('', delay)
    imgui.PopItemWidth()
    imgui.SameLine() imgui.Text(u8"(Задержка в миллисекундах)")
    if imgui.Button(u8"Сохранить настройки", imgui.ImVec2(170, 40)) then
        save1()
        sampAddChatMessage(tag .. 'Настройки сохранены! (Для: "Флуды /vr")',-1)
    end
    elseif selected == 2 then
        ia.ToggleButton("##offvr", vrdisable) imgui.SameLine() imgui.Text(u8"Отключить /vr чат") imgui.SameLine() imgui.TextQuestion(u8"При включении функции, вам не видны сообщения вип-чата (пока-что не работает)")
        save2()
        ia.ToggleButton("#antimat", antimat) imgui.SameLine() imgui.Text(u8"Анти-мат") imgui.SameLine() imgui.TextQuestion(u8"Когда вы пишете мат в вип-чат, то сообщение не отправляется (сделано для того, чтобы не материться и не получить мут)")
        save2()
        ia.ToggleButton("##rusvr", vrrus) imgui.SameLine() imgui.Text(u8"Вип-чат при русской раскладке") imgui.SameLine() imgui.TextQuestion(u8"Если вы напишите .мк, а не /vr, то все равно сообщение отправится в вип-чат")
        save2()
        imgui.Separator() ia.ToggleButton("#sendprem", sendprem) imgui.SameLine() imgui.Text(u8"Отправлять сообщение, когда купили PREMIUM") imgui.SameLine() imgui.TextQuestion(u8"Когда игрок купил премиум, то это высвечивается в чат, и при включении функции, в вип-чат будет отправляться сообщение, которое вы напишите ниже") save2()
        imgui.PushItemWidth(210)
        imgui.InputText(u8"", sendpremtext)
        imgui.PopItemWidth()
        save2()
        imgui.Text("")
        ia.ToggleButton("#sendvip", sendvip) imgui.SameLine() imgui.Text(u8"Отправлять сообщение, когда купили TITAN VIP") imgui.SameLine() imgui.TextQuestion(u8"Когда игрок купил титан вип, то это высвечивается в чат, и при включении функции, в вип-чат будет отправляться сообщение, которое вы напишите ниже") save2()
        imgui.PushItemWidth(210)
        imgui.InputText(u8"", sendviptext)
        imgui.PopItemWidth()
        save2()
    end
    imgui.EndChild()
    imgui.End()
end

function theme()
    imgui.SwitchContext()
    local style = imgui.GetStyle()
    local colors = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4
    local ImVec2 = imgui.ImVec2

    style.WindowPadding = imgui.ImVec2(8, 8)
    style.WindowRounding = 6
    style.ChildWindowRounding = 5
    style.FramePadding = imgui.ImVec2(5, 3)
    style.FrameRounding = 3.0
    style.ItemSpacing = imgui.ImVec2(5, 4)
    style.ItemInnerSpacing = imgui.ImVec2(4, 4)
    style.IndentSpacing = 21
    style.ScrollbarSize = 10.0
    style.ScrollbarRounding = 13
    style.GrabMinSize = 8
    style.GrabRounding = 1
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
    style.ButtonTextAlign = imgui.ImVec2(0.5, 0.5)

    colors[clr.Text]                   = ImVec4(0.95, 0.96, 0.98, 1.00);
    colors[clr.TextDisabled]           = ImVec4(0.29, 0.29, 0.29, 1.00);
    colors[clr.WindowBg]               = ImVec4(0.14, 0.14, 0.14, 1.00);
    colors[clr.ChildWindowBg]          = ImVec4(0.12, 0.12, 0.12, 1.00);
    colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 0.94);
    colors[clr.Border]                 = ImVec4(0.14, 0.14, 0.14, 1.00);
    colors[clr.BorderShadow]           = ImVec4(1.00, 1.00, 1.00, 0.10);
    colors[clr.FrameBg]                = ImVec4(0.22, 0.22, 0.22, 1.00);
    colors[clr.FrameBgHovered]         = ImVec4(0.18, 0.18, 0.18, 1.00);
    colors[clr.FrameBgActive]          = ImVec4(0.09, 0.12, 0.14, 1.00);
    colors[clr.TitleBg]                = ImVec4(0.14, 0.14, 0.14, 0.81);
    colors[clr.TitleBgActive]          = ImVec4(0.14, 0.14, 0.14, 1.00);
    colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 0.51);
    colors[clr.MenuBarBg]              = ImVec4(0.20, 0.20, 0.20, 1.00);
    colors[clr.ScrollbarBg]            = ImVec4(0.02, 0.02, 0.02, 0.39);
    colors[clr.ScrollbarGrab]          = ImVec4(0.36, 0.36, 0.36, 1.00);
    colors[clr.ScrollbarGrabHovered]   = ImVec4(0.18, 0.22, 0.25, 1.00);
    colors[clr.ScrollbarGrabActive]    = ImVec4(0.24, 0.24, 0.24, 1.00);
    colors[clr.ComboBg]                = ImVec4(0.24, 0.24, 0.24, 1.00);
    colors[clr.CheckMark]              = ImVec4(1.00, 0.28, 0.28, 1.00);
    colors[clr.SliderGrab]             = ImVec4(1.00, 0.28, 0.28, 1.00);
    colors[clr.SliderGrabActive]       = ImVec4(1.00, 0.28, 0.28, 1.00);
    colors[clr.Button]                 = ImVec4(1.00, 0.28, 0.28, 1.00);
    colors[clr.ButtonHovered]          = ImVec4(1.00, 0.39, 0.39, 1.00);
    colors[clr.ButtonActive]           = ImVec4(1.00, 0.21, 0.21, 1.00);
    colors[clr.Header]                 = ImVec4(1.00, 0.28, 0.28, 1.00);
    colors[clr.HeaderHovered]          = ImVec4(1.00, 0.39, 0.39, 1.00);
    colors[clr.HeaderActive]           = ImVec4(1.00, 0.21, 0.21, 1.00);
    colors[clr.ResizeGrip]             = ImVec4(1.00, 0.28, 0.28, 1.00);
    colors[clr.ResizeGripHovered]      = ImVec4(1.00, 0.39, 0.39, 1.00);
    colors[clr.ResizeGripActive]       = ImVec4(1.00, 0.19, 0.19, 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(1.00, 0.21, 0.21, 1.00);
    colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 0.18, 0.18, 1.00);
    colors[clr.TextSelectedBg]         = ImVec4(1.00, 0.32, 0.32, 1.00);
    colors[clr.ModalWindowDarkening]   = ImVec4(0.26, 0.26, 0.26, 0.60);
end
theme()

function save1()
    mainIni.config.piar = piar.v
    mainIni.config.textpiar = textpiar.v
    mainIni.config.delay = delay.v
    --mainIni.config.command = command.v
    inicfg.save(mainIni, "VRManager.ini")
end

function save2()
    mainIni.config.vrdisable = vrdisable.v
    mainIni.config.antimat = antimat.v
    mainIni.config.vrrus = vrrus.v
    mainIni.config.sendprem = sendprem.v
    mainIni.config.sendvip = sendvip.v
    mainIni.config.sendpremtext = sendpremtext.v
    mainIni.config.sendviptext = sendviptext.v
    inicfg.save(mainIni, "VRManager.ini")
end

function sampev.onServerMessage(color, text)
    if vrdisable.v then
        if text:find('%[VIP%] {FFFFFF}.+%[%d+%]: .+') or text:find('%[PREMIUM%] {FFFFFF}.+%[%d+%]: .+') then
            return false
        end
    end
    if sendprem.v then
        if text:find("Игрок (.-) приобрел PREMIUM VIP") then
            sampSendChat("/vr " .. u8:decode(mainIni.config.sendpremtext))
        end
    end
    if sendvip.v then
        if text:find("Игрок (.-) приобрел TITAN VIP") then
            sampSendChat("/vr " .. u8:decode(mainIni.config.sendviptext))
        end
    end
end

function sampev.onSendCommand(text)
    if antimat.v then
        if text:find('/vr сука') or text:find ("/vr пидорас") or text:find ("/vr блять") or text:find ("/vr еблан") or text:find ("/vr хуйло") or text:find ("хуй") or text:find ("пизда") or text:find ("ебал") or text:find ("пиздец") then
            --arg = text:match('/vr (.+)')
            sampAddChatMessage(tag .. 'Сообщение не отправилось, так как включен анти-мат.',-1)
            return false
        end
    end
end

function sampev.onSendChat(text)
    if vrrus.v then
        if text:find (".мк") then
            arg = text:match('.мк (.+)')
            sampSendChat("/vr " ..arg)
        end
    end
end
Когда я ввожу к примеру в инпут текст где написано "Строка для титан вип", то когда я туда пишу текст, то в другом инпут тексте пишется такой текст, почему?
Скорее всего, они у тебя к одной переменной(буфферу) привязаны
 

W1ll04eison

Участник
328
19
У меня есть InputTextMultiline

Как сделать обращение к строчке?(по типу я нажимаю на какую то строчку и она вписывается в чат)
 

tsunamiqq

Участник
429
16
Как пофиксить это, мне нужна эта строчка
Lua:
:54: sol: no matching function call takes this number of arguments and the specified types
stack traceback:
    [C]: in function 'ImBool'
    ...\SBORKA LETO 2020 BY OSVALDO\moonloader\Large_Helper.lua:54: in main chunk
Lua:
script_name('Large Helper')
script_author('Lycorn')
script_description('Large Helper v 1.0.0')
script_version('1.0.0')

require 'lib.moonloader'
local imgui = require 'imgui'
local encoding = require 'encoding'
local inicfg = require 'inicfg'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local directIni = 'moonloader\\config\\large_helper.ini'
local mainIni = inicfg.load(nil, directIni)
local stateIni = inicfg.save(mainIni, directIni)
local status = inicfg.load(mainIni, directIni)

local mainIni = inicfg.load({
    functions = {
        kypill = false,
        casi = false,
        accent = false
    },
    config = {
        kypillviptext = false,
        casitext = false,
        accenttext = false,
        piar_vr = false,
        piar_fam = false,
        piar_ad = false,
        piar_al = false,
        piar_j = false,
        flood_vr = false,
        flood_fam = false,
        flood_ad = false,
        flood_al = false,
        flood_j = false,
        text_vr = false,
        text_fam = false,
        text_ad = false,
        text_al = false,
        text_j = false
    },
    slider = {
        slider_vr = tonumber(1),
        slider_fam = tonumber(3),
        slider_ad = tonumber(5),
        slider_al = tonumber(7),
        slider_j = tonumber(9),
    }
}, "large_helper")
inicfg.save(mainIni, "large_helper.ini")

    kypill = imgui.ImBool(mainIni.functions.kypill)
    casi = imgui.ImBool(mainIni.functions.casi)
    accent = imgui.ImBool(mainIni.functions.accent)
    vr = imgui.Imbool(mainIni.config.piar_vr)
    fam = imgui.Imbool(mainIni.config.piar_fam)
    ad = imgui.Imbool(mainIni.config.piar_ad)
    al = imgui.Imbool(mainIni.config.piar_al)
    j = imgui.Imbool(mainIni.config.piar_j)
    slider_vr = imgui.ImInt(mainIni.slider.slider_vr)
    slider_fam = imgui.ImInt(mainIni.slider.slider_fam)
    slider_ad = imgui.ImInt(mainIni.slider.slider_ad)
    slider_al = imgui.ImInt(mainIni.slider.slider_al)
    slider_j = imgui.ImInt(mainIni.slider.slider_j)


local autopass = imgui.ImBuffer(256)
local kypilvip = imgui.ImBuffer(256)
local chasi = imgui.ImBuffer(256)
local vremya = imgui.ImBuffer(256)
local data = imgui.ImBuffer(256)
local fps = imgui.ImBuffer(256)
local server = imgui.ImBuffer(256)
local ping = imgui.ImBuffer(256)
local nickname = imgui.ImBuffer(256)
local hp = imgui.ImBuffer(256)
local armour = imgui.ImBuffer(256)
local onlined = imgui.ImBuffer(256)
local onlinen = imgui.ImBuffer(256)
local id = imgui.ImBuffer(256)
local accenttext = imgui.ImBuffer(256)
local vron = imgui.ImBuffer(256)
local famon = imgui.ImBuffer(256)
local alon = imgui.ImBuffer(256)
local adon = imgui.ImBuffer(256)
local jon = imgui.ImBuffer(256)
local ad1 = imgui.ImBuffer(256)
local ad2 = imgui.ImBuffer(256)
local newbind = imgui.ImBuffer(256)
local textbinds1 = imgui.ImBuffer(65536)
local textbloknot = imgui.ImBuffer(65536)
local text_vr = imgui.ImBuffer(256)
local text_fam = imgui.ImBuffer(256)
local text_al = imgui.ImBuffer(256)
local text_ad = imgui.ImBuffer(256)
local text_j = imgui.ImBuffer(256)
local bindsz = imgui.ImInt(1500)
local vipnickname = imgui.ImBuffer(256)
local menuon = 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 checked12 = imgui.ImBool(false)
local checked13 = imgui.ImBool(false)
local checked14 = imgui.ImBool(false)
local checked15 = imgui.ImBool(false)
local checked16 = imgui.ImBool(false)
local checked17 = imgui.ImBool(false)
local checked18 = imgui.ImBool(false)
local checked19 = imgui.ImBool(false)
local checked20 = imgui.ImBool(false)
local checked21 = imgui.ImBool(false)
local checked22 = imgui.ImBool(false)
local checked23 = imgui.ImBool(false)
local checked24 = imgui.ImBool(false)


local main_window_state = imgui.ImBool(false)
local obn_window_state = imgui.ImBool(false)
local help_window_state = imgui.ImBool(false)
local checkbox = imgui.ImBool(false)

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampAddChatMessage(u8:decode'[Large Helper] Скрипт успешно запущен! Версия скрипта 1.0.0', 0x0095B6)
    sampAddChatMessage(u8:decode'[Large Helper] Автор скрипта - Lycorn', 0x0095B6)
    sampAddChatMessage(u8:decode'[Large Helper] Активация скрипта - /lahelper', 0x0095B6)
    sampAddChatMessage(u8:decode'[Large Helper] Список всех обновлений можно посмотреть, используя команду - /laobn', 0x0095B6)
    sampAddChatMessage(u8:decode'[Large Helper] Список всех команд и функций скрипта можно посмотреть, используя команду - /lahelp', 0x0095B6)
    sampRegisterChatCommand('lahelper', function() main_window_state.v = not main_window_state.v end)
    sampRegisterChatCommand('laobn', function() obn_window_state.v = not obn_window_state.v end)
    sampRegisterChatCommand('lahelp', function() help_window_state.v = not help_window_state.v end)
    sampRegisterChatCommand("fm", function() sampSendChat('/fammenu') end)
    sampRegisterChatCommand('mb', function() sampSendChat('/members') end)
    sampRegisterChatCommand('dn', function() sampSendChat('/donate') end)
    sampRegisterChatCommand('arm', function() sampSendChat('/armour') end)
    sampRegisterChatCommand('ms', function() sampSendChat('/mask') end)
    sampRegisterChatCommand('arms', function() sampSendChat('/armour') sampSendChat('/mask') end)
    while true do
        wait(0)
        if checkbox.v then
            printStringNow('test', 1000)
        end
        imgui.Process = main_window_state.v or obn_window_state.v or help_window_state.v
    end
end

function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.SetNextWindowSize(imgui.ImVec2(1000, 500), imgui.Cond.FirstUseEver)
        imgui.Begin('Large helper | Многофункциональный помощник для игры в ГТА самп!', main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
        imgui.BeginChild('##121', imgui.ImVec2(200, 465), true)
        if imgui.Button('Основное меню', imgui.ImVec2(-1, 53), main_window_state) then menu = 0 end
        if imgui.Button('Настройки', imgui.ImVec2(-1, 53), main_window_state) then menu = 1 end
        if imgui.Button('Проверка на VIP статус (ARZ)', imgui.ImVec2(-1, 53), main_window_state) then menu = 2 end
        if imgui.Button('Флудер/Биндер', imgui.ImVec2(-1, 53), main_window_state) then menu = 3 end
        if imgui.Button('Блокнот', imgui.ImVec2(-1, 53), main_window_state) then menu = 4 end
        if imgui.Button('Настройка оверлея', imgui.ImVec2(-1, 53), main_window_state) then menu = 5 end
        if imgui.Button('Цвет Темы', imgui.ImVec2(-1, 53), main_window_state) then menu = 6 end
        if imgui.Button('О скрипте', imgui.ImVec2(-1, 53), main_window_state) then menu = 7 end
        imgui.EndChild()
        imgui.SameLine()
        if menu == 0 then
            imgui.BeginChild('##null', imgui.ImVec2(775, 465), true)
            imgui.SetCursorPosX(340)
            imgui.SText('Основное меню', main_window_state)
            imgui.Text('Последняя версия скрипта на данный момент 1.0.0', main_window_state)
            imgui.SetCursorPosY(377)
            imgui.Text('Автор скрипта - Lycorn', main_window_state)
            imgui.Text('VK - vk.com/lcn.maks', main_window_state)
            imgui.Text('Youtube - Ликорн', main_window_state)
            imgui.Text('Instagram - m_aks_1855', main_window_state)
            imgui.Text('Если есть вопросы на счет скрипта, обращайтесь в соц сети выше.', main_window_state)
            imgui.EndChild()
        elseif menu == 1 then
            imgui.BeginChild('##one', imgui.ImVec2(775, 465), true)
            imgui.SetCursorPosX(340)
            imgui.SText('Настройки', main_window_state)
            imgui.Text('Автологин(автоматический вход в аккаунт)', main_window_state)
            imgui.Checkbox('', checked8)
            imgui.SameLine()
            imgui.InputText('Введите свой пароль', autopass, main_window_state)
            imgui.Separator()
            imgui.Text('Текст при покупки ВИП статуса на Аризоне!', main_window_state)
            if imgui.Checkbox('', kypill) then
            if kypill.v == true then
                mainIni.functions.kypill = true
                if inicfg.save(mainIni, "large_helper.ini") then
                end
            end
            if kypill.v == false then
                mainIni.functions.kypill = false
                if inicfg.save(mainIni, "large_helper.ini") then
                end
            end
            imgui.SameLine()
            if imgui.InputText('Введите текст##1', kypilvip, main_window_state) then
                mainIni.config.kypillviptext = u8:decode(kypilvip.v)
                inicfg.save(mainIni, "large_helper.ini")
            end
            imgui.Separator()
            imgui.Text('Текст при прописывании /time', main_window_state)
            if imgui.Checkbox('', casi) then
            if casi.v == true then
                mainIni.functions.casi = true
                if inicfg.save(mainIni, "large_helper.ini") then
                end
            end
            if casi.v == false then
                mainIni.functions.casi = false
                if inicfg.save(mainIni, "large_helper.ini") then
                end
            end
            imgui.SameLine()
            if imgui.InputText('Введите текст##2', chasi, main_window_state) then
                mainIni.config.casitext = u8:decode(chasi.v)
                inicfg.save(mainIni, "large_helper.ini")
            end
            imgui.Separator()
            imgui.Text('Акцент при сообщениях(Пример: [Русский] "текст")', main_window_state)
            if imgui.Checkbox('', accent) then
            if accent.v == true then
                mainIni.functions.accent = true
                if inicfg.save(mainIni, "large_helper.ini") then
                end
            end
            if accent.v == false then
                mainIni.functions.accent = false
                if inicfg.save(mainIni, "large_helper.ini") then
                end
            end
            imgui.SameLine()
            if imgui.InputText('Введите текст без []', accenttext, main_window_state) then
                mainIni.config.accenttext = u8:decode(accenttext.v)
                inicfg.save(mainIni, "large_helper.ini")
            end
            imgui.Separator()
            imgui.Checkbox('', checked12)
            imgui.SameLine()
            imgui.Text('HP HUD / Показывает количество ХП на полоске Здоровья!', main_window_state)
            imgui.EndChild()
        elseif menu == 2 then
            imgui.BeginChild('##two', imgui.ImVec2(775, 465), true)
            imgui.SetCursorPosX(280)
            imgui.SText('Проверка на VIP статус (ARZ)', main_window_state)
            imgui.SText('Эта функция работает только на любом сервере Arizona RP. На остальных проектах не будет работать.', main_window_state)
            imgui.Text('Введите никнейм игрока у которого хотите проверить наличие VIP статуса.', main_window_state)
            imgui.Text('Да бы проверить, после того как ввели никнейм, нажмите на кнопку Проверить.', main_window_state)
            imgui.Text('После этого, сообщение прийдет в Чат.', main_window_state)
            imgui.InputText('', vipnickname); imgui.SameLine()
            imgui.Button('Проверить', main_window_state)
            imgui.EndChild()
        elseif menu == 3 then
            imgui.BeginChild('##three', imgui.ImVec2(775, 465), true)
            imgui.SetCursorPosX(340)
            imgui.SText('Флудер/Биндер', main_window_state)
            imgui.SText('Пиар подходит только для проекта Arizona RP', main_window_state)
            imgui.SText('Настройки пиара. Активация для пиара CMD: /lapiar', main_window_state)
            if imgui.Checkbox('', vr) then
                if vr.v then
                    mainIni.config.piar_vr = true
                else
                    mainIni.config.piar_vr = false
                end
            end
            imgui.SameLine()
            if imgui.InputText('Введите текст для вип чата', text_vr, main_window_state) then
                mainIni.config.flood_vr = u8:decode(text_vr.v)
                inicfg.save(mainIni, "large_helper.ini")
            end
            if imgui.SliderInt('Задержка в секундах', slider_vr, 1,30, main_window_state) then
                mainIni.slider.slider_vr = tonumber(slider_vr.v)
                inicfg.save(mainIni, "large_helper.ini")
            end
            imgui.Separator()
            if imgui.Checkbox('', fam) then
                if fam.v then
                    mainIni.config.piar_fam = true
                else
                    mainIni.config.piar_fam = false
                end
            end
            imgui.SameLine()
            if imgui.InputText('Введите текст для фам.чата', text_fam, main_window_state) then
                mainIni.config.flood_fam = u8:decode(text_fam.v)
                inicfg.save(mainIni, "large_helper.ini")
            end
            if imgui.SliderInt('Задержка в секундах##1', slider_fam, 1,30, main_window_state) then
                mainIni.slider.slider_fam = tonumber(slider_fam.v)
                inicfg.save(mainIni, "large_helper.ini")
            end
            imgui.Separator()
            if imgui.Checkbox('', al) then
                if al.v then
                    mainIni.config.piar_al = true
                else
                    mainIni.config.piar_al = false
                end
            end
            imgui.SameLine()
            if imgui.InputText('Введите текст для альянса', text_al, main_window_state) then
                mainIni.config.flood_al = u8:decode(text_al.v)
                inicfg.save(mainIni, "large_helper.ini")
            end
            if imgui.SliderInt('Задержка в секундах##2', slider_al, 1,30, main_window_state) then
                mainIni.slider.slider_al = tonumber(slider_al.v)
                inicfg.save(mainIni, "large_helper.ini")
            end
            imgui.Separator()
            if imgui.Checkbox('', ad) then
                if ad.v then
                    mainIni.config.piar_ad = true
                else
                    mainIni.config.piar_ad = false
                end
            end
            imgui.SameLine()
            if imgui.InputText('Введите текст для обьявлений', text_ad, main_window_state) then
                mainIni.config.flood_ad = u8:decode(text_ad.v)
                inicfg.save(mainIni, "large_helper.ini")
            end
            imgui.SliderInt('Задержка в секундах##3', slider_ad, 1,30, main_window_state)
               mainIni.slider.slider_ad = tonumber(slider_ad.v)
               inicfg.save(mainIni, "large_helper.ini")
            end
            imgui.Separator()
            if imgui.Checkbox('', j) then
                if j.v then
                    mainIni.config.piar_j = true
                else
                    mainIni.config.piar_j = false
                end
            end
            imgui.InputText('Введите текст для чата работы', text_j, main_window_state)
               mainIni.config.flood_j = u8:decode(text_j.v)
               inicfg.save(mainIni, "large_helper.ini")
            end
            imgui.SliderInt('Задержка в секундах##4', slider_j, 1,30, main_window_state)
               mainIni.slider.slider_j = tonumber(slider_j.v)
               inicfg.save(mainIni, "large_helper.ini")
            end
            imgui.Separator()
            imgui.SText('КМД по кнопкам[ARZ]', main_window_state)
            imgui.Checkbox('Открыть/Закрыть авто на L', checked2, main_window_state)
            imgui.Checkbox('Заправить машину на E', checked3, main_window_state)
            imgui.Checkbox('Отремонтировать машину на U', checked4, main_window_state)
            imgui.Checkbox('Достать/Вставить ключи в машину на K', checked5, main_window_state)
            imgui.Checkbox('Достать телефон на P', checked6, main_window_state)
            imgui.Checkbox('Посмотреть время на X', checked7, main_window_state); imgui.Separator()
            imgui.SText('Настройки биндера', main_window_state)
            imgui.Button('Создать бинд', main_window_state)
            imgui.EndChild()
        elseif menu == 4 then
            imgui.BeginChild('##four', imgui.ImVec2(775, 465), true)
            imgui.SetCursorPosX(340)
            imgui.SText('Блокнот', main_window_state)
            imgui.Text('Блокнот сделан, да бы вы ввели текст, который вам важен, который не хотите забыть.', main_window_state)
            imgui.Text('К примеру в какое-то время подьехать куда либо нужно)', main_window_state)
            imgui.InputTextMultiline("##Bloknot", textbloknot, imgui.ImVec2(-1, 250))
            imgui.Button('Сохранить', main_window_state)
            imgui.EndChild()
        elseif menu == 5 then
            imgui.BeginChild('##five', imgui.ImVec2(775, 465), true)
            imgui.SetCursorPosX(340)
            imgui.SText('Настройка оверлея', main_window_state)
            imgui.Checkbox('Включить/Выключить меню', checked13, main_window_state); imgui.Separator()
            imgui.Checkbox('Игровой сервер', checked14, main_window_state)
            imgui.Checkbox('Никнейм', checked15, main_window_state)
            imgui.Checkbox('Айди', checked16, main_window_state)
            imgui.Checkbox('Время', checked17, main_window_state)
            imgui.Checkbox('Дата', checked18, main_window_state)
            imgui.Checkbox('FPS', checked19, main_window_state)
            imgui.Checkbox('Пинг', checked20, main_window_state)
            imgui.Checkbox('Здоровье', checked21, main_window_state)
            imgui.Checkbox('Армор', checked22, main_window_state)
            imgui.Checkbox('Онлайн за день', checked23, main_window_state)
            imgui.Checkbox('Онлайн за неделю', checked24, main_window_state)
            imgui.EndChild()
        elseif menu == 6 then
            imgui.BeginChild('##six', imgui.ImVec2(775, 465), true)
            imgui.SetCursorPosX(340)
            imgui.SText('Цвет Темы')
            imgui.SText('Что бы выбрать тему нажмите на кружечек.')
            imgui.Text('Голубая тема')
            imgui.Text('Красная тема')
            imgui.Text('Черная тема')
            imgui.Text('Салатовая тема')
            imgui.Text('тема')
            imgui.Text('Синяя тема')
            imgui.EndChild()
        elseif menu == 7 then
            imgui.BeginChild('##seven', imgui.ImVec2(775, 465), true)
            imgui.SetCursorPosX(340)
            imgui.SText('О скрипте')
            imgui.Text('Large Helper это скрипт, который в разы упрощает вашу игру в ГТА Самп!', 0x00BFFF)
            imgui.Text('Скрипт подходит как и для крупных так и для не больших серверов.', 0xFF0000)
            imgui.Text('В скрипте можно изменить стиль меню. То есть можно изменить цвет кнопок, оверлея меню.', 0xFF0000)
            imgui.Text('В скрипте можно активировать боковое меню, с разными плюшками, к примеру при включении можно увидить количество вашего Здоровья.', 0xAFEEEE)
            imgui.Text('Список добавления всяких плюшек в скрипт можно посмотреть, использую команду /laobn')
            imgui.SText('Так же, можно посмотреть список команд скрипта, использую команду /lahelp')
            imgui.Text('Автор не берет ответственности за ваш аккаунт.')
            imgui.Text('Скачивая скрипт, проверяйте на стиллер, да бы не было притензий за утерю аккаунта и так далее.')
            imgui.Text('В скрипте присутствует много функций, настройки для игры, флудер, и много других.')
            imgui.SText('В скрипте нету и не будет ни каких запрещенных софтов, функций.')
            imgui.Text('P.S - Создатель скрипта играет на Arizona RP Surprise.')
            imgui.Text('Никнейм - Tsunami_Nakamura.')
            imgui.Text('Первые 10 человек, которые увидят меня и напишут слово Large Helper, получат бонус, возможно денежный, возможно какой то аксесуар, дом, машина, предмет.')
            imgui.Text('Так же нужно быть подписаный на основной канал создателя скрипта, который можно найти в Основном Меню.')
            imgui.Text('Спасибо за внимание! Приятного использование скрипта.')
            imgui.EndChild()
            end
        imgui.End()
    end

    if obn_window_state.v then
        imgui.SetNextWindowSize(imgui.ImVec2(1000, 500), imgui.Cond.FirstUseEver)
        imgui.Begin('Обновления', obn_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
        imgui.SText('Список всех обновлений скрипта можно увидить ниже.', main_window_state)
        imgui.Text('Обновления будет присутствувать в следущей версии скрипта.', main_window_state)
        imgui.End()
    end
    
    if help_window_state.v then
        imgui.SetNextWindowSize(imgui.ImVec2(1000, 500), imgui.Cond.FirstUseEver)
        imgui.Begin('Помощник', help_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
        imgui.SText('Здесь будет список всех команд, функций скрипта!', main_window_state)
        imgui.Text('Открытие основного меню скрипта - /lahelper', main_window_state)
        imgui.Text('Открытие меню с обновлениями - /laobn', main_window_state)
        imgui.Text('Открытие меню с командами и функциями скрипта - /lahelp', main_window_state)
        imgui.Text('Включить пиар /piar (Текст указывать в /lahelper - Биндер)', main_window_state)
        imgui.Text('Сокращение команды /members - /mb', main_window_state)
        imgui.Text('Сокращение команды /donate - /dn', main_window_state)
        imgui.Text('[ARZ]Сокращение команды /fammenu - /fm', main_window_state)
        imgui.Text('[ARZ]Сокращение команды /armour - /arm', main_window_state)
        imgui.Text('[ARZ]Сокращение команды /mask - /ms', main_window_state)
        imgui.Text('[ARZ]Сокращение команды /mask и /armour (кмд /arms оденет маску и бронижелет) - /arms', main_window_state)
        imgui.End()
    end
end

if kypill.v then
    if text:find("приобрел PREMIUM VIP.") or text:find("приобрел Titan VIP.") and not text:find("говорит") and not text:find('- |') then
        sampSendChat("/vr "..mainIni.config.kypillviptext)
    end
end

function imgui.SText(text)
    imgui.Text(text)
    imgui.Separator()
end

function imgui.Link(link)
    if status_hovered then
        local p = imgui.GetCursorScreenPos()
        imgui.TextColored(imgui.ImVec4(0, 0.5, 1, 1), link)
        imgui.GetWindowDrawList():AddLine(imgui.ImVec2(p.x, p.y + imgui.CalcTextSize(link).y), imgui.ImVec2(p.x + imgui.CalcTextSize(link).x, p.y + imgui.CalcTextSize(link).y), imgui.GetColorU32(imgui.ImVec4(0, 0.5, 1, 1)))
    else
        imgui.TextColored(imgui.ImVec4(0, 0.3, 0.8, 1), link)
    end
    if imgui.IsItemClicked() then
        os.execute('explorer '..link)
    elseif imgui.IsItemHovered() then
        status_hovered = true
    else
        status_hovered = false
    end
end

function sp.onSendChat(message)
    if accent.v then
            if message == ')' or message == '(' or message == '))' or message == '((' or message == 'xD' or message == ':D' or message == ':d' or message == 'q' or message == 'XD' then return(message) end
    return{'['..u8:decode(accenttext.v)..']:'..message}
    end
end

function ran()
    kypilvip.v = (u8(tostring(mainIni.config.kypillviptext)))
    chasi.v = (u8(tostring(mainIni.config.casitext)))
    accenttext.v = (u8(tostring(mainIni.config.accenttext)))
    text_vr.v = (u8(tostring(mainIni.config.flood_vr)))
    text_fam.v = (u8(tostring(mainIni.config.flood_fam)))
    text_ad.v = (u8(tostring(mainIni.config.flood_ad)))
    text_al.v = (u8(tostring(mainIni.config.flood_al)))
    text_j.v = (u8(tostring(mainIni.config.flood_j)))
end

function time()
    lua_thread.create(function()
        sampSendChat("/time")
        sampSendChat("/me"..mainIni.config.casitext)
        wait(1500)
        sampSendChat("/do На часах "..os.date('%H:%M:%S'))
        end)
    end

function bluetheme()
    imgui.SwitchContext()
    local colors = imgui.GetStyle().Colors;
    local icol = imgui.Col
    local ImVec4 = imgui.ImVec4

    imgui.GetStyle().WindowPadding = imgui.ImVec2(8, 8)
    imgui.GetStyle().WindowRounding = 16.0
    imgui.GetStyle().FramePadding = imgui.ImVec2(5, 3)
    imgui.GetStyle().ItemSpacing = imgui.ImVec2(4, 4)
    imgui.GetStyle().ItemInnerSpacing = imgui.ImVec2(5, 5)
    imgui.GetStyle().IndentSpacing = 9.0
    imgui.GetStyle().ScrollbarSize = 17.0
    imgui.GetStyle().ScrollbarRounding = 16.0
    imgui.GetStyle().GrabMinSize = 7.0
    imgui.GetStyle().GrabRounding = 6.0
    imgui.GetStyle().ChildWindowRounding = 6.0
    imgui.GetStyle().FrameRounding = 6.0

    colors[icol.Text] = ImVec4(0.90, 0.90, 0.90, 1.00);
    colors[icol.TextDisabled] = ImVec4(0.60, 0.60, 0.60, 1.00);
    colors[icol.WindowBg] = ImVec4(0.11, 0.11, 0.11, 1.00);
    colors[icol.ChildWindowBg] = ImVec4(0.13, 0.13, 0.13, 1.00);
    colors[icol.PopupBg] = ImVec4(0.11, 0.11, 0.11, 1.00);
    colors[icol.Border] = ImVec4(0.26, 0.46, 0.82, 1.00);
    colors[icol.BorderShadow] = ImVec4(0.26, 0.46, 0.82, 1.00);
    colors[icol.FrameBg] = ImVec4(0.26, 0.46, 0.82, 0.59);
    colors[icol.FrameBgHovered] = ImVec4(0.26, 0.46, 0.82, 0.88);
    colors[icol.FrameBgActive] = ImVec4(0.28, 0.53, 1.00, 1.00);
    colors[icol.TitleBg] = ImVec4(0.26, 0.46, 0.82, 1.00);
    colors[icol.TitleBgActive] = ImVec4(0.26, 0.46, 0.82, 1.00);
    colors[icol.TitleBgCollapsed] = ImVec4(0.26, 0.46, 0.82, 1.00);
    colors[icol.MenuBarBg] = ImVec4(0.26, 0.46, 0.82, 0.75);
    colors[icol.ScrollbarBg] = ImVec4(0.11, 0.11, 0.11, 1.00);
    colors[icol.ScrollbarGrab] = ImVec4(0.26, 0.46, 0.82, 0.68);
    colors[icol.ScrollbarGrabHovered] = ImVec4(0.26, 0.46, 0.82, 1.00);
    colors[icol.ScrollbarGrabActive] = ImVec4(0.26, 0.46, 0.82, 1.00);
    colors[icol.ComboBg] = ImVec4(0.26, 0.46, 0.82, 0.79);
    colors[icol.CheckMark] = ImVec4(1.000, 0.000, 0.000, 1.000)
    colors[icol.SliderGrab] = ImVec4(0.263, 0.459, 0.824, 1.000)
    colors[icol.SliderGrabActive] = ImVec4(0.66, 0.66, 0.66, 1.00);
    colors[icol.Button] = ImVec4(0.26, 0.46, 0.82, 1.00);
    colors[icol.ButtonHovered] = ImVec4(0.26, 0.46, 0.82, 0.59);
    colors[icol.ButtonActive] = ImVec4(0.26, 0.46, 0.82, 1.00);
    colors[icol.Header] = ImVec4(0.26, 0.46, 0.82, 1.00);
    colors[icol.HeaderHovered] = ImVec4(0.26, 0.46, 0.82, 0.74);
    colors[icol.HeaderActive] = ImVec4(0.26, 0.46, 0.82, 1.00);
    colors[icol.Separator] = ImVec4(0.37, 0.37, 0.37, 1.00);
    colors[icol.SeparatorHovered] = ImVec4(0.60, 0.60, 0.70, 1.00);
    colors[icol.SeparatorActive] = ImVec4(0.70, 0.70, 0.90, 1.00);
    colors[icol.ResizeGrip] = ImVec4(1.00, 1.00, 1.00, 0.30);
    colors[icol.ResizeGripHovered] = ImVec4(1.00, 1.00, 1.00, 0.60);
    colors[icol.ResizeGripActive] = ImVec4(1.00, 1.00, 1.00, 0.90);
    colors[icol.CloseButton] = ImVec4(0.00, 0.00, 0.00, 1.00);
    colors[icol.CloseButtonHovered] = ImVec4(0.00, 0.00, 0.00, 0.60);
    colors[icol.CloseButtonActive] = ImVec4(0.35, 0.35, 0.35, 1.00);
    colors[icol.PlotLines] = ImVec4(1.00, 1.00, 1.00, 1.00);
    colors[icol.PlotLinesHovered] = ImVec4(0.90, 0.70, 0.00, 1.00);
    colors[icol.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00);
    colors[icol.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00);
    colors[icol.TextSelectedBg] = ImVec4(0.00, 0.00, 1.00, 0.35);
    colors[icol.ModalWindowDarkening] = ImVec4(0.20, 0.20, 0.20, 0.35);
end
bluetheme()
 

YarmaK

Известный
684
242
Привет, как сделать что-бы если в радиусе 20м от меня не будет игроков то скрипт не работал, типа если я еду на капт мне админ видал 1 хп скрипт не захилился


Lua:
act = false

function main()
    repeat
        wait(0)
    until isSampAvailable()
    sampAddChatMessage('Всем прывет,с вами виктор дудка', -1)
    sampRegisterChatCommand("aheal",function() act = not act printStringNow(act and "~b~[AHEAL]: ~g~ON" or "~b~[AHEAL]: ~r~OFF", 1000) end)
    while true do
        wait(0)
        health = getCharHealth(PLAYER_PED)
        if act and health < 90 and #getAllChars() == 1 then
            sampSendChat("/healme")
            wait(15000)
        end
    end
end
 

kizn

О КУ)))
Всефорумный модератор
2,404
2,060
Привет, как сделать что-бы если в радиусе 20м от меня не будет игроков то скрипт не работал, типа если я еду на капт мне админ видал 1 хп скрипт не захилился


Lua:
act = false

function main()
    repeat
        wait(0)
    until isSampAvailable()
    sampAddChatMessage('Всем прывет,с вами виктор дудка', -1)
    sampRegisterChatCommand("aheal",function() act = not act printStringNow(act and "~b~[AHEAL]: ~g~ON" or "~b~[AHEAL]: ~r~OFF", 1000) end)
    while true do
        wait(0)
        health = getCharHealth(PLAYER_PED)
        if act and health < 90 and #getAllChars() == 1 then
            sampSendChat("/healme")
            wait(15000)
        end
    end
end
Ты че дебил я же тебе это и скинул
 
  • Ха-ха
Реакции: Alize и mzxer

MaksQ

Известный
967
817
Привет, как сделать что-бы если в радиусе 20м от меня не будет игроков то скрипт не работал, типа если я еду на капт мне админ видал 1 хп скрипт не захилился


Lua:
act = false

function main()
    repeat
        wait(0)
    until isSampAvailable()
    sampAddChatMessage('Всем прывет,с вами виктор дудка', -1)
    sampRegisterChatCommand("aheal",function() act = not act printStringNow(act and "~b~[AHEAL]: ~g~ON" or "~b~[AHEAL]: ~r~OFF", 1000) end)
    while true do wait(0)
        health = getCharHealth(PLAYER_PED)
        if act and health < 90 and #getAllChars() == 1 then
            sampSendChat("/healme")
            wait(15000)
        end
    end
end
Lua:
local act = false

function main()
    while not isSampAvailable() do wait(100) end

    sampRegisterChatCommand('aheal', function() act = not act printStringNow(act and "~b~[AHEAL]: ~g~ON" or "~b~[AHEAL]: ~r~OFF", 1000) end)
    while true do wait(0)
        local health = getCharHealth(PLAYER_PED)
        local x, y, z = getCharCoordinates(1)
        local _, ped = findAllRandomCharsInSphere(x, y, z, 20, true, true)
        if _ then
            local _, pid = sampGetPlayerIdByCharHandle(ped)
            if _ and act and health < 90 then
                sampSendChat('/healme')
                wait(15000)
            end
        end
    end
end
 

PanSeek

t.me/dailypanseek
Всефорумный модератор
899
1,746
Как удалять пикапы в зоне стрима?
Lua:
for k, v in pairs(getAllPickups()) do
    if getPickupModel(v) then
        removePickup(v)
    end
end
Ругается на getAllPickups(), он возвращает почему-то nil.
UPD: Точнее крашит с такой причиной, которую указал выше.
 

mzxer

Активный
81
119
Как удалять пикапы в зоне стрима?
Lua:
for k, v in pairs(getAllPickups()) do
    if getPickupModel(v) then
        removePickup(v)
    end
end
Ругается на getAllPickups(), он возвращает почему-то nil.
UPD: Точнее крашит с такой причиной, которую указал выше.
у тебя скорее всего 26 мун, ибо getAllPickups() поддерживается с 27 версии
 
  • Нравится
Реакции: PanSeek

Dmitriy Makarov

25.05.2021
Проверенный
2,478
1,113
Не знаете, почему Alpha (RGBA) всегда прозрачный, когда скрипт перезапускается? Хотя написано, что 255 (непрозрачный). Нужно изменить любой цвет в RGBA, чтобы оно пришло в норму.

Lua:
local col = 16777215
local editcol = imgui.ImFloat4(imgui.ImColor(explode_argb(col)):GetFloat4())

if imgui.ColorEdit4(u8"Цвет линий", settings.RenderColor) then
    rgba = imgui.ImColor(editcol.v[1], editcol.v[2], editcol.v[3], editcol.v[4])
    tr, tg, tb, ta = rgba:GetRGBA()
    tr, tg, tb, ta = tr * 255, tg * 255, tb * 255, ta * 255
    aargb = join_argb(ta, tr, tg, tb)
    col = join_argb(editcol.v[1] * 255, editcol.v[2] * 255, editcol.v[3] * 255, editcolr.v[4] * 255)
end

-- Тут всё сохраняется. Чтобы было понятнее, убрал mainIni и т.д
-- Функции explode, join в скрипте тоже присутствуются.
-- При перезагрузке скрипта в инпуте A(Alpha) написано "255", хотя по факту текст прозрачный (т.е 0)
-- Нужно изменить любой цвет в инпутах RGBA, чтобы пришло в норму всё и текст отобразился как нужно
1624460874610.png
 

Fott

Простреленный
3,436
2,280
а нахуя два раза одну и ту же регулярку дрочить
Что значит дрочить регулярку? Разницы никакой нету.
Не знаете, почему Alpha (RGBA) всегда прозрачный, когда скрипт перезапускается? Хотя написано, что 255 (непрозрачный). Нужно изменить любой цвет в RGBA, чтобы оно пришло в норму.

Lua:
local col = 16777215
local editcol = imgui.ImFloat4(imgui.ImColor(explode_argb(col)):GetFloat4())

if imgui.ColorEdit4(u8"Цвет линий", settings.RenderColor) then
    rgba = imgui.ImColor(editcol.v[1], editcol.v[2], editcol.v[3], editcol.v[4])
    tr, tg, tb, ta = rgba:GetRGBA()
    tr, tg, tb, ta = tr * 255, tg * 255, tb * 255, ta * 255
    aargb = join_argb(ta, tr, tg, tb)
    col = join_argb(editcol.v[1] * 255, editcol.v[2] * 255, editcol.v[3] * 255, editcolr.v[4] * 255)
end

-- Тут всё сохраняется. Чтобы было понятнее, убрал mainIni и т.д
-- Функции explode, join в скрипте тоже присутствуются.
-- При перезагрузке скрипта в инпуте A(Alpha) написано "255", хотя по факту текст прозрачный (т.е 0)
-- Нужно изменить любой цвет в инпутах RGBA, чтобы пришло в норму всё и текст отобразился как нужно
Посмотреть вложение 102278
в мимгуи abgr. Я сталкивался с похожими проблемами, посмотри у меня в like to kill как реализовано, там тоже мимгуи
 
  • Нравится
Реакции: Dmitriy Makarov

DeagleC+

Известный
48
3
Lua:
require "lib.moonloader"
local sampev = require "lib.samp.events"

function main()
    while true do
        wait(0)
        if isKeyJustPressed(0x23) then -- Продать
            sampSendChat('/sellprods')
        end
    end
end

function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
        if title:find('Договор поставки') then
            sampSendDialogResponse(3370, 0, 0, '')
        end
        if text:find('Управляющий: Мы не закупаем товар.') then
            return false
        end
end
Кикает с сервера при выполении sampSendDialogResponse, а если перед ней поставить wait(150), к примеру, то не работает. Что делать?

1624472327374.png
 

Andrinall

Известный
681
532

Dmitriy Makarov

25.05.2021
Проверенный
2,478
1,113
Кикает с сервера при выполении sampSendDialogResponse, а если перед ней поставить wait(150), к примеру, то не работает. Что делать?

Посмотреть вложение 102292
Lua:
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
    if title:find('Договор поставки') then
        lua_thread.create(function() wait(10)
            sampSendDialogResponse(3370, 0, 0, nil) -- Или так: 3370, 1, 0, nil
        end)
    elseif text:find('Управляющий: Мы не закупаем товар%.') then
        return false
    end
end
 
  • Нравится
Реакции: DeagleC+