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

Lucifer Melton

Активный
164
57
Посмотреть вложение 50584
помогите вытащить ник и номер телефона человека, ник без его ид
Lua:
if message:find(".*Отправил %w+_%w+%[%d+%] %(тел%. %d+%)") then
    local nick, number = message:match(".*Отправил (%w+_%w+)%[%d+%] %(тел%. (%d+)%)")
    sampAddChatMessage("nick: "..nick..", number: "..number, -1)
end
 

Dmitriy Makarov

25.05.2021
Проверенный
2,511
1,139
Ребят, как исправить такую ошибку, VK_LEFT является NUMPAD_LEFT, нажимает цифру 4 в место того чтобы нажать стрелочку налево, шо делать?
Там нету такой клавишы как NUMPAD_LEFT
Screenshot_1.png

Попробуй по цифрам тогда забиндить, что-ли..
 

HarlyCloud

Потрачен
235
68
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Проверка на таргет + на нажатие клавиши.

Lua:
function main()
  while true do
    wait(0)
    result, ped = getCharPlayerIsTargeting(Player player)
    if isKeyJustPressed(key) and result then
        main_window_state.v = not main_window_state.v
    end
    imgui.Process = main_window_state.v
  end
end
Посмотреть вложение 50592


Как сделать такое же окно в imgui?
Как сделать так что когда нажимаешь на кнопку в имгуи проигрывалась функция какая то.
 
Последнее редактирование:

HarlyCloud

Потрачен
235
68
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Lua:
if imgui.Button("name") then
func()
end
Вот так?
Lua:
    if imgui.Button(u8("Выгнать"), imgui.ImVec2(95, 25)) then
    func expel(arg)
    sampSendChat("/do Человек лежит на полу.")
     wait(2000)
     sampSendChat("/me заломал руки и ведёт к двери")
     wait(2000)
     sampSendChat("/me открыл дверь и вывел человека")
     wait(2000)
     sampSendChat("/me закрыл дверь")
     wait(2000)
     sampSendChat("/expel " .. arg)
        end
 

|| NN - NoName ||

Известный
1,045
640
Вот так?
Lua:
    if imgui.Button(u8("Выгнать"), imgui.ImVec2(95, 25)) then
    func expel(arg)
    sampSendChat("/do Человек лежит на полу.")
     wait(2000)
     sampSendChat("/me заломал руки и ведёт к двери")
     wait(2000)
     sampSendChat("/me открыл дверь и вывел человека")
     wait(2000)
     sampSendChat("/me закрыл дверь")
     wait(2000)
     sampSendChat("/expel " .. arg)
        end
Правильно будет так:

Это добавляешь в свой код:

Lua:
if imgui.Button(u8("Выгнать"), imgui.ImVec2(95, 25))
      lua_thread.create(fuck)
end

А это отдельная функция, просто скопируй и вставь в отдельное место:

Lua:
function fuck()
  sampSendChat("/do Человек лежит на полу.")
  wait(2000)
  sampSendChat("/me заломал руки и ведёт к двери")
  wait(2000)
  sampSendChat("/me открыл дверь и вывел человека")
  wait(2000)
  sampSendChat("/me закрыл дверь")
  wait(2000)
  sampSendChat("/expel " .. arg)
end

Дальше сам додумаешься.
 

HarlyCloud

Потрачен
235
68
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Правильно будет так:

Это добавляешь в свой код:

Lua:
if imgui.Button(u8("Выгнать"), imgui.ImVec2(95, 25))
      lua_thread.create(fuck)
end

А это отдельная функция, просто скопируй и вставь в отдельное место:

Lua:
function fuck()
  sampSendChat("/do Человек лежит на полу.")
  wait(2000)
  sampSendChat("/me заломал руки и ведёт к двери")
  wait(2000)
  sampSendChat("/me открыл дверь и вывел человека")
  wait(2000)
  sampSendChat("/me закрыл дверь")
  wait(2000)
  sampSendChat("/expel " .. arg)
end

Дальше сам додумаешься.
Нихуя не понял, типо как мне сделать по нажатию писалось это?))))))))
 

[SA ARZ]

Известный
392
8
код:
function main()
    if not isSampLoaded() and not isSampfuncsLoaded() then return end -- проверяем загружен ли SAMP и сам SampFuncs, если нет, то сбрасываем соединение
    repeat wait(0) until isSampAvailable()
    repeat wait(100) until sampIsLocalPlayerSpawned()

    files_add()
    sampRegisterChatCommand('mh', function()
        if not SelectPlayers.v and not HistorySMS.v and not newFind.v and not newFind.v and not settingsMenu.v and not SelectPlayersMedicalOsmtr.v and not showBinnder.v and not gnewsLeaderMenu.v and not ComputerDialogMain.v then
            selected = 1
            MainNewMenu.v = not MainNewMenu.v
        end
    end)
    sampRegisterChatCommand('gate', function() GatePanelFunc:run() end)
    sampRegisterChatCommand('r', RadioRun)
    sampRegisterChatCommand('p', canncelPPhone)
    sampRegisterChatCommand('h', canncelHPhone)
    sampRegisterChatCommand('histsms', function()
        if not SelectPlayers.v and not newFind.v and not callSobesMenu.v and not settingsMenu.v and not SelectPlayersMedicalOsmtr.v and not showBinnder.v and not gnewsLeaderMenu.v and not ComputerDialogMain.v then
            HistorySMS.v = not HistorySMS.v
        end
    end)
    sampRegisterChatCommand('rep', reportText)
    sampRegisterChatCommand('drive', DriveFunc)
    sampRegisterChatCommand('повышение', getinforang)
    sampRegisterChatCommand('f', RadioFun)
    sampRegisterChatCommand('sobes', SobesMenu)
    sampRegisterChatCommand('friends', cmd_friends)
    sampRegisterChatCommand('kpk', cmd_kpk)
    sampRegisterChatCommand('checkfind', cmd_checkfind)
    sampRegisterChatCommand('find', function()
        logTextFind = {}
        allcols = 0
        afkcols = 0
        jailcols = 0
        mutecols = 0
        sampSendChat("/find")
    end)
    sampRegisterChatCommand('debtorlist', debtorlist)
    sampRegisterChatCommand('debtorsell', cmd_debtorsell)
    sampRegisterChatCommand('to', toSystem)
    sampRegisterChatCommand('leak', leakrp)
    sampRegisterChatCommand('ap', MedSkipRP)
    sampRegisterChatCommand('free', FreeJail)
    sampRegisterChatCommand('givelic', GiveLicSystem)
    sampRegisterChatCommand('putmed', cmd_putmed)
    sampRegisterChatCommand('цп', lecdialog)
    sampRegisterChatCommand('pickmed', cmd_pickmed)
    sampRegisterChatCommand('out', outSystem)
    sampRegisterChatCommand('historymed', gethistmed)
    sampRegisterChatCommand('operacion', operacionrp)
    sampRegisterChatCommand('changesex', changesex)
    sampRegisterChatCommand('medcard', MedCardList)
    sampRegisterChatCommand('medskip', MedSkipRP)
    sampRegisterChatCommand('medhelp', medhelpList)
    sampRegisterChatCommand('onehelp', onehelp)
    sampRegisterChatCommand('клятва', Klyatva)
    sampRegisterChatCommand('light', cmd_light)
    sampRegisterChatCommand('tvlift', cmd_tvlift)
    sampRegisterChatCommand('audience', cmd_audience)
    sampRegisterChatCommand('all', cmd_all)
    sampRegisterChatCommand('tvtext', cmd_tvtext)
    sampRegisterChatCommand('tvskip', cmd_tvskipRolePlay)
    sampRegisterChatCommand('radiojoin', cmd_radiojoinRolePlay)
    sampRegisterChatCommand('givemic', cmd_givemicRolePlay)
    sampRegisterChatCommand('makeskin', cmd_makeskinRP)
    sampRegisterChatCommand('sale', cmd_PaperRP)
    sampRegisterChatCommand('efir', cmd_efirRolePlay)
    sampRegisterChatCommand('stand', cmd_standRolePlay)
    sampRegisterChatCommand('camera', cmd_cameraRolePlay)
    sampRegisterChatCommand('bring', cmd_bringRolePlay)
    sampRegisterChatCommand('fixedit', function()
        sampSendDialogResponse(224, 1, 0, tageditor.." | "..u8:decode(MessagesAds.v))
    end)
    sampRegisterChatCommand('liv', cmd_livby)
    sampRegisterChatCommand('unvby', cmd_uninvby)
    sampRegisterChatCommand('ok', cmd_ok)
    sampRegisterChatCommand('fd', RadioFunDoclade)
    sampRegisterChatCommand('rd', RadioRunDoclade)
    sampRegisterChatCommand('rn', RadioRunNonRP)
    sampRegisterChatCommand('eject', ejectRP)
    sampRegisterChatCommand('heal', medhealList)
    sampRegisterChatCommand('gps', gpsfunc)
    sampRegisterChatCommand('график', grafikdialog)
    sampRegisterChatCommand('addbl', cmd_addbl)
    sampRegisterChatCommand('delbl', cmd_delbl)
    sampRegisterChatCommand('drone', drone)
    sampRegisterChatCommand('autodoclade', funcAutoDoclade)
    sampRegisterChatCommand('fn', RadioFunNonRP)
    sampRegisterChatCommand('unv', UvalPlayer)
    sampRegisterChatCommand('uninvite', UvalPlayer)
    sampRegisterChatCommand('inv', InvitePlayer)
    sampRegisterChatCommand('invite', InvitePlayer)   
    sampRegisterChatCommand('dice', ex_dice)
    sampRegisterChatCommand('offrang', funOffRang)
    sampRegisterChatCommand('uninviteoff', funOffUninvite)
    sampRegisterChatCommand('gn', function()
        if NumRangPlayer == 10 or accNumber == 905492 or accNumber == 1638304 or accNumber == 905738 then
            if not SelectPlayers.v and not HistorySMS.v and not newFind.v and not callSobesMenu.v and not settingsMenu.v and not SelectPlayersMedicalOsmtr.v and not showBinnder.v and not ComputerDialogMain.v then
                gnewsLeaderMenu.v = not gnewsLeaderMenu.v
            end
        else
            sampAddChatMessage("[{FF8800}MultiAHK{F5FFFA}]: У Вас нет доступа к данному разделу. Ваш текущий уровень доступа: {"..colororgs.."}"..NumRangPlayer, 0xF5FFFA)
            sampAddChatMessage("[{FF8800}MultiAHK{F5FFFA}]: Для данного раздела требуется уровень доступа: {"..colororgs.."}10", 0xF5FFFA)
            SoundDENIED()
        end
    end)
    sampRegisterChatCommand('binder', function()
        if not SelectPlayers.v and not HistorySMS.v and not newFind.v and not callSobesMenu.v and not settingsMenu.v and not SelectPlayersMedicalOsmtr.v and not gnewsLeaderMenu.v and not ComputerDialogMain.v then
            showBinnder.v = not showBinnder.v
        end
    end)
    sampRegisterChatCommand('ud', GoUdsPlayer)
    sampRegisterChatCommand('hist', HistoryPlayer)
    sampRegisterChatCommand('black', black_checker)
    sampRegisterChatCommand('blackname', black_history)
    sampRegisterChatCommand('rang', ex_rang)
    sampRegisterChatCommand('gg', GGSay)
    sampRegisterChatCommand('number', numberID)
    sampRegisterChatCommand('vig', vigovor)
    sampRegisterChatCommand('changeskin', changeskin)
    sampRegisterChatCommand('smsn', NonRPSMS)
    sampRegisterChatCommand('reconnect', reconnect)
    update() -- запуск обновлений
    while not UpdateNahuy do wait(0) end -- пока не проверит обновления тормозим работу

    print("Получаем номер аккаунта игрока ARP")
    ScriptUse = 3
    regAcc = true
    sampSendChat("/mn")
    while ScriptUse == 3 do wait(0) end
    if ScriptUse == 4 then -- в случае неудачного получения номера аккаунта
        print("Номер аккаунта не получен, работа завершена")
        reloadScript = true
        sampAddChatMessage("[{FF8800}MLUA{F5FFFA}]: Прозошла ошибка при получении данных номера аккаунта.", 0xF5FFFA)
        thisScript():unload()
        return
    elseif ScriptUse == 5 then
        print("Номер аккаунта был получен: "..tonumber(accNumber))
        if sampGetCurrentServerAddress() == "54.37.142.73" then gameServer = "Green";          stateName = "{FFFF66}Advance RolePlay - {00FF00}Green"; serverName = "ARP - {00FF00}Green";     regDialogOpen = 1; sampSendChat("/mn")
        elseif sampGetCurrentServerAddress() == "54.37.142.72" then gameServer = "Red";          stateName = "{FFFF66}Advance RolePlay - {FF0000}Red"; serverName = "ARP - {FF0000}Red";     regDialogOpen = 1; sampSendChat("/mn")
        elseif sampGetCurrentServerAddress() == "54.37.142.74" then gameServer = "Blue";          stateName = "{FFFF66}Advance RolePlay - {0000FF}Blue"; serverName = "ARP - {0000FF}Blue";     regDialogOpen = 1; sampSendChat("/mn")
        else
            print("Сервер не допущен, работа скрипта завершена")
            print("IP сервера: "..sampGetCurrentServerAddress())
            sampAddChatMessage("[{FF8800}MLUA{F5FFFA}]: К сожалению, данный скрипт недоступен для работы на данном сервере.", 0xF5FFFA)
            sampAddChatMessage("[{FF8800}MLUA{F5FFFA}]: Свяжитесь с разработчиками, если хотите уточнить возможность решения данной проблемы.", 0xF5FFFA)
            thisScript():unload()
            return
        end
    end
    inputHelpText = renderCreateFont("Arial", 9, FCR_BORDER + FCR_BOLD)
    lua_thread.create(showInputHelp)
    print("Начинаем инициализацию клавиш")
    if tBindList ~= nil then
        print("Регистрируем клавиши")
        for k, v in pairs(tBindList) do
            rkeys.registerHotKey(v.v, true, onHotKey)
        end
    else
        print("Критическая ошибка, выполняем откат клавиш")
        tBindList = {
            [1] = { text = "/lock", v = {} },
            [2] = { text = "/find", v = {} },
            [3] = { text = "/c 60", v = {} },
            [4] = { text = "/medskip (/ap)", v = {} },
            [5] = { text = "/gg *Представиться", v = {18,49} },
            [6] = { text = "/gate", v = {} },
            [7] = { text = "/badge", v = {} },
            [8] = { text = "/устав", v = {} },
            [9] = { text = "/график", v = {} }
        }
        print("Откат выполнен.")
    end
    print("Инициализация клавиш завершена")
    print("Начинаем инициализацию биндера")
    if mass_bind ~= nil then
        print("Регистрируем команды бинда.")
        for k, p in ipairs(mass_bind) do
            if p.cmd ~= "-" then
                rcmd(p.cmd, p.text, p.delay)
                print("Зарегистрирована команда биндера: /"..p.cmd)
            end
        end
    else
        print("Критическая ошибка, выполняем откат binder.bind")
        mass_bind = {
            [1] = { cmd = "-", v = {}, text = "Any text", delay = 3 },
            [2] = { cmd = "-", v = {}, text = "Any text", delay = 3 },
            [3] = { cmd = "-", v = {}, text = "Any text", delay = 3 },
            [4] = { cmd = "-", v = {}, text = "Any text", delay = 3 },
            [5] = { cmd = "-", v = {}, text = "Any text", delay = 3 }
        }
        print("Откат выполнен.")
    end

    print("Регистрация клавиш бинда")
    for i, g in pairs(mass_bind) do
        rkeys.registerHotKey(g.v, true, onHotKey)
    end
    print("Инициализация биндера завершена")
    
    while true do wait(0)

        unix_time = os.time(os.date('!*t'))
        moscow_time = unix_time + timefix.v * 60 * 60

        imgui.Process = ComputerDialogMain.v or MainNewMenu.v or EditorADS.v or callMenuPhone.v or HistorySMS.v or settingsMenu.v or updateINFO.v or infobarImgui.v or showBinnder.v or SelectPlayers.v or SelectPlayersMedicalOsmtr.v or callSobesMenu.v


        zX, zY, zZ = getCharCoordinates(playerPed)

        -- определение города
        local citiesList = {'Los-Santos', 'San-Fierro', 'Las-Venturas'}
        local city = getCityPlayerIsIn(PLAYER_HANDLE)
        if city > 0 then playerCity = citiesList[city] else playerCity = "N/a" end

        if arrayFunc.infobar.v and not isGamePaused() then
            if not MainNewMenu.v then
                infobarImgui.v = true
            end

            if showBinnder.v then
                infobarImgui.v = false
            end

            if mouseCoord then
                showCursor(true, true)
                infoX, infoY = getCursorPos()
                if isKeyDown(VK_RETURN) then
                    settings.options.infoX = math.floor(infoX)
                    settings.options.infoY = math.floor(infoY)
                    mouseCoord = false
                    showCursor(false, false)
                    MainNewMenu.v = not MainNewMenu.v
                    inicfg.save(settings, 'USMOH.ini')
                end
            end
        else
            infobarImgui.v = false
        end
        if isKeyJustPressed(VK_G) and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsScoreboardOpen() and not isSampfuncsConsoleActive() then
            local result, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if result and doesCharExist(ped) then
                local tdd, id = sampGetPlayerIdByCharHandle(ped)
                if tdd then
                    MenuName = sampGetPlayerNickname(id)
                    MenuID = id
                    systemSecurity()
                end
            end
        end
        if isKeyJustPressed(VK_Y) and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsScoreboardOpen() and not isSampfuncsConsoleActive() then
            local result, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if result and doesCharExist(ped) then
                local tdd, id = sampGetPlayerIdByCharHandle(ped)
                if tdd then
                    MenuName = sampGetPlayerNickname(id)
                    MenuID = id
                    systemMySelf()
                end
            end
        end
        if isKeyJustPressed(VK_1) and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsScoreboardOpen() and not isSampfuncsConsoleActive() then
            local result, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if result and doesCharExist(ped) then
                local tdd, id = sampGetPlayerIdByCharHandle(ped)
                if tdd then
                    MenuName = sampGetPlayerNickname(id)
                    MenuID = id
                    SystemQQMo()
                end
            end
        end
        if isKeyJustPressed(VK_R) and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsScoreboardOpen() and not isSampfuncsConsoleActive() then -- меню взаимодействия на ПКМ + R
            local result, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if result and doesCharExist(ped) then
                local tdd, id = sampGetPlayerIdByCharHandle(ped)
                if tdd then
                    MenuName = sampGetPlayerNickname(id)
                    MenuID = id
                    SelectPlayers.v = not SelectPlayers.v
                end
            end
        end
        if isKeyJustPressed(VK_E) and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsScoreboardOpen() and not isSampfuncsConsoleActive() then -- меню взаимодействия на ПКМ + R
            local result, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if result and doesCharExist(ped) then
                local tdd, id = sampGetPlayerIdByCharHandle(ped)
                if tdd then
                    sampProcessChatInput("/historymed "..id)
                end
            end
        end

        if isKeyJustPressed(VK_F2) and golecpacient and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsScoreboardOpen() and not isSampfuncsConsoleActive() then
            lastmedprice()
        end
        if isKeyJustPressed(VK_F3) and golecpacient and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsScoreboardOpen() and not isSampfuncsConsoleActive() then
            Sendchat("/me "..(SexPlayersFunc and 'убрала' or 'убрал').." лекарство в мед. сумку")
            wait(1000)
            Sendchat("К сожалению, у Вас нет средств для оплаты лечения.")
            golecpacient = false
        end

        if isKeyJustPressed(VK_F4) and RPDesign and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsScoreboardOpen() and not isSampfuncsConsoleActive() then
            ActionRP1:terminate()
            ActionRP2:terminate()
            RPDesign = false
            sampAddChatMessage("[{FF8800}MLUA{F5FFFA}]: Вы отказались проводить акцию.", 0xF5FFFA)
        end
        if isKeyJustPressed(VK_F4) and CancelCommand and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsScoreboardOpen() and not isSampfuncsConsoleActive() then
            LicThread:terminate()
            AdvocateThread1:terminate()
            sampAddChatMessage("[{FF8800}MLUA{F5FFFA}]: Действие было - остановлено.", 0xF5FFFA)
            CancelCommand = false
        end
        for i = 0, sampGetMaxPlayerId(true) do -- отключаем "вх" камхака для игроков, оставляем для разрабов.
            if sampIsPlayerConnected(i) then
                local result, ped = sampGetCharHandleBySampPlayerId(i)
                if result then
                    local positionX, positionY, positionZ = getCharCoordinates(ped)
                    local localX, localY, localZ = getCharCoordinates(PLAYER_PED)
                    local distance = getDistanceBetweenCoords3d(positionX, positionY, positionZ, localX, localY, localZ)
                    if distance >= 30 and droneActive and developers ~= 1 then
                        EmulShowNameTag(i, false)
                    elseif droneActive and developers == 1 then
                        EmulShowNameTag(i, true)
                    else
                        EmulShowNameTag(i, true)
                    end
                end
            end
        end
    end
end
 

sanders

Потрачен
253
126
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
как через рендер нарисовать круг?
 

paulohardy

Известный
Всефорумный модератор
1,998
1,343
как через рендер нарисовать круг?
renderDrawPolygon(float posX, float posY, float sizeX, float sizeY, int corners, float rotation, uint color)
int corners - количество вершин, +-12 - круг, чем больше вершин, тем круглее будет фигура
 
  • Нравится
Реакции: Rei

HarlyCloud

Потрачен
235
68
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
делал, NUMPAD_LEFT образно выразился, LEFT юзал, идшник не помогает, нум пад 4 нажимает

Вот не мучайся и не делай отдельные функи, так-же арг откуда-то брать надо, думаю там уже сам разберешь что тебе надо
Lua:
 if imgui.Button(u8"Выгнать", imgui.ImVec2(95, 25)) then
     lua_thread.create(function()
         sampSendChat("/do Человек лежит на полу.")
         wait(2000)
         sampSendChat("/me заломал руки и ведёт к двери")
         wait(2000)
         sampSendChat("/me открыл дверь и вывел человека")
         wait(2000)
         sampSendChat("/me закрыл дверь")
         wait(2000)
         sampSendChat("/expel " .. тут доставай идшник, хз где у тебя будет)
    end)
end
Спасибо, слушай а как мне сделать так что ид будет братся от человека который выделен? Это как то через хендл или пед, я хз прост чё эт такое)