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

BlackHole

Участник
40
7
Что то я слишком тупой, всеравно не могу понять как координаты вписать туда :/
 

Revavi

Участник
101
24
Как в этом скрипте сделать нажатие "да" в табличке, которая вылазит перед отправкой сообщения в вип чат
В этом коде она нажимает "нет"
Код:
local sampev = require("samp.events")

function sampev.onShowDialog(id, style, title, button1, button2, text)
    if text:find("Стоимость рекламного сообщения:") then
        sampSendDialogResponse(id, 0, 0, 0, "")
        return false
    end
end
код:
local sampev = require("samp.events")

function sampev.onShowDialog(id, style, title, button1, button2, text)
    if text:find("Стоимость рекламного сообщения:") then
        sampSendDialogResponse(id, 1, 0, nil)
        return false
    end
end
вроде так
 
  • Нравится
Реакции: joumey

joumey

Активный
195
43
Как в этом скрипте сделать нажатие "да" в табличке, которая вылазит перед отправкой сообщения в вип чат
В этом коде она нажимает "нет"
Код:
local sampev = require("samp.events")

function sampev.onShowDialog(id, style, title, button1, button2, text)
    if text:find("Стоимость рекламного сообщения:") then
        sampSendDialogResponse(id, 0, 0, 0, "")
        return false
    end
end
https://wiki.blast.hk/ru/moonloader/lua/sampSendDialogResponse sampSendDialogResponse(int id, int button, int listitem, zstring input)
 
  • Нравится
Реакции: Revavi

Revavi

Участник
101
24
Что то я слишком тупой, всеравно не могу понять как координаты вписать туда :/
1681062278408.png
тебе надо сохранять координаты, например, в массив и затем сохранять их в json файл
чтобы их использовать дальше ты просто читаешь данные из файла и записываешь в переменную
 

MLycoris

Режим чтения
Проверенный
1,814
1,856
Что то я слишком тупой, всеравно не могу понять как координаты вписать туда :/
у меня такой пример есть, мб поможет
Lua:
local imgui = require 'mimgui'
local WinState = imgui.new.bool()

function json(filePath)
    local filePath = getWorkingDirectory()..'\\config\\'..(filePath:find('(.+).json') and filePath or filePath..'.json')
    local class = {}
    if not doesDirectoryExist(getWorkingDirectory()..'\\config') then
        createDirectory(getWorkingDirectory()..'\\config')
    end
    function class:Save(tbl)
        if tbl then
            local F = io.open(filePath, 'w')
            F:write(encodeJson(tbl) or {})
            F:close()
            return true, 'ok'
        end
        return false, 'table = nil'
    end
    function class:Load(defaultTable)
        if not doesFileExist(filePath) then
            class:Save(defaultTable or {})
        end
        local F = io.open(filePath, 'r+')
        local TABLE = decodeJson(F:read() or {})
        F:close()
        for def_k, def_v in next, defaultTable do
            if TABLE[def_k] == nil then
                TABLE[def_k] = def_v
            end
        end
        return TABLE
    end
    return class
end
local TestList = json('Example.json'):Load({})

imgui.OnFrame(function() return not WinState[0] end,
    function(player)
        imgui.SetNextWindowPos(imgui.ImVec2(500,500), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(245, 360), imgui.Cond.FirstUseEver)
        imgui.Begin('Window', WinStatee)
        for key, data in ipairs(TestList) do -- парсим таблицу
            imgui.Text('Point number: '..key) imgui.SameLine()
            if imgui.Button('Delete') then
                table.remove(TestList, key)
                json('Example.json'):Save(TestList)
            end
            imgui.Text('Coords: X: '..data.x..' Y: '..data.y..' Z: '..data.z) -- выводим нужные значения
            imgui.Separator()
        end
        imgui.End()
    end
)

function main()
    sampRegisterChatCommand('cmd', function() WinState[0] = not WinState[0] end) -- окно мимгуи
    sampRegisterChatCommand('savecoords', function()
        local x, y, z = getCharCoordinates(1) -- получаем координаты
        local x = string.format("%.2f", x) -- сокращаем чутка
        local y = string.format("%.2f", y)
        local z = string.format("%.2f", z)
        table.insert(TestList, {x = x, y = y, z = z}) -- добавляем в таблицу
        json('Example.json'):Save(TestList) -- сохраняем таблицу
    end)
    wait(-1)
end
 
  • Нравится
Реакции: de_clain

BlackHole

Участник
40
7
Можно как то сделать более компактно?
Какую то переменную там где все координаты будуть

Lua:
script_name(NResourseMAP)
script_author(NaYke)
script_version(1)

require 'lib.moonloader'
local main_color = "{98FB98}"
local tag1 = main_color .. "[NResourseMAP By NaYke] {FFFFFF}- Успешно запущен."
local tag2 = main_color .. "[NResourseMAP By NaYke] {FFFFFF}- Загружено 45 точек ресурсов."

local coord = [[], []]

function main()
    while not isSampAvailable() do wait(0) end
    sampAddChatMessage(tag1, -1)
    sampAddChatMessage(tag2, -1)
    sampRegisterChatCommand("test", function ()
        local x, y, z = getCharCoordinates(PLAYER_PED)
        local res1 = addSphere(494.2589,866.1543,-31.1242, 1.0)
        local res2 = addSphere(484.9253,888.2664,-30.4663, 1.0)
        local res3 = addSphere(476.2323,879.8789,-29.8272, 1.0)
        local res4 = addSphere(467.0316,886.7172,-28.4295, 1.0)
        local res5 = addSphere(511.4182,834.8056,-26.3371, 1.0)
        local res6 = addSphere(515.4222,821.7529,-24.3999, 1.0)
        local res7 = addSphere(525.6802,822.1740,-25.5354, 1.0)
        local res8 = addSphere(532.3553,808.4451,-25.7831, 1.0)
        local res9 = addSphere(518.2730,808.8262,-23.1136, 1.0)
        local res10 = addSphere(554.4703,780.0768,-17.8384, 1.0)
        local res11 = addSphere(565.5139,770.0276,-16.4953, 1.0)
        local res12 = addSphere(496.6376,850.5760,-29.5776, 1.0)
        local res13 = addSphere(505.8997,804.9409,-21.6467, 1.0)
        local res14 = addSphere(562.1069,799.9304,-28.1325, 1.0)
        local res15 = addSphere(584.4244,791.0164,-29.8563, 1.0)
        local res16 = addSphere(601.2403,789.5441,-31.8218, 1.0)
        local res17 = addSphere(616.2394,777.1870,-31.8185, 1.0)
        local res18 = addSphere(664.2033,788.8451,-29.9605, 1.0)
        local res19 = addSphere(499.9399,792.1532,-21.7369, 1.0)
        local res20 = addSphere(494.1013,866.3512,-31.0041, 1.0)
        local res21 = addSphere(470.0822,870.7220,-28.5249, 1.0)
        local res22 = addSphere(496.7372,850.6622,-29.5522, 1.0)
        local res23 = addSphere(615.7032,777.4021,-32.1016, 1.0)
        local res24 = addSphere(648.8140,777.3646,-29.9300, 1.0)
        local res25 = addSphere(664.0432,788.7548,-29.8926, 1.0)
        local res26 = addSphere(685.9511,788.5950,-29.9591, 1.0)
        local res27 = addSphere(693.6030,800.6348,-29.9140, 1.0)
        local res28 = addSphere(716.4759,818.1044,-29.8943, 1.0)
        local res29 = addSphere(712.9354,834.7087,-29.9674, 1.0)
        local aqw = addSphere(716.2796,817.9316,-30.2534, 1.0)
        lua_thread.create(function ()
            wait(5000)
            removeSphere(res1)
            removeSphere(res2)
            removeSphere(res3)
            removeSphere(res4)
            removeSphere(res5)
            removeSphere(res6)
            removeSphere(res7)
            removeSphere(res8)
            removeSphere(res9)
            removeSphere(res10)
            removeSphere(res11)
            removeSphere(res12)
            removeSphere(res13)
            removeSphere(res14)
            removeSphere(res15)
            removeSphere(res16)
            removeSphere(res17)
            removeSphere(res18)
            removeSphere(res19)
            removeSphere(res20)
            removeSphere(res21)
            removeSphere(res22)
            removeSphere(res23)
            removeSphere(res24)
            removeSphere(res25)
            removeSphere(res26)
            removeSphere(res27)
            removeSphere(res28)
            removeSphere(res29)
            removeSphere(aqw)
        end)
    end)
    wait(-1)
end
 
  • Вау
Реакции: joumey

joumey

Активный
195
43
Можно как то сделать более компактно?
Какую то переменную там где все координаты будуть

Lua:
script_name(NResourseMAP)
script_author(NaYke)
script_version(1)

require 'lib.moonloader'
local main_color = "{98FB98}"
local tag1 = main_color .. "[NResourseMAP By NaYke] {FFFFFF}- Успешно запущен."
local tag2 = main_color .. "[NResourseMAP By NaYke] {FFFFFF}- Загружено 45 точек ресурсов."

local coord = [[], []]

function main()
    while not isSampAvailable() do wait(0) end
    sampAddChatMessage(tag1, -1)
    sampAddChatMessage(tag2, -1)
    sampRegisterChatCommand("test", function ()
        local x, y, z = getCharCoordinates(PLAYER_PED)
        local res1 = addSphere(494.2589,866.1543,-31.1242, 1.0)
        local res2 = addSphere(484.9253,888.2664,-30.4663, 1.0)
        local res3 = addSphere(476.2323,879.8789,-29.8272, 1.0)
        local res4 = addSphere(467.0316,886.7172,-28.4295, 1.0)
        local res5 = addSphere(511.4182,834.8056,-26.3371, 1.0)
        local res6 = addSphere(515.4222,821.7529,-24.3999, 1.0)
        local res7 = addSphere(525.6802,822.1740,-25.5354, 1.0)
        local res8 = addSphere(532.3553,808.4451,-25.7831, 1.0)
        local res9 = addSphere(518.2730,808.8262,-23.1136, 1.0)
        local res10 = addSphere(554.4703,780.0768,-17.8384, 1.0)
        local res11 = addSphere(565.5139,770.0276,-16.4953, 1.0)
        local res12 = addSphere(496.6376,850.5760,-29.5776, 1.0)
        local res13 = addSphere(505.8997,804.9409,-21.6467, 1.0)
        local res14 = addSphere(562.1069,799.9304,-28.1325, 1.0)
        local res15 = addSphere(584.4244,791.0164,-29.8563, 1.0)
        local res16 = addSphere(601.2403,789.5441,-31.8218, 1.0)
        local res17 = addSphere(616.2394,777.1870,-31.8185, 1.0)
        local res18 = addSphere(664.2033,788.8451,-29.9605, 1.0)
        local res19 = addSphere(499.9399,792.1532,-21.7369, 1.0)
        local res20 = addSphere(494.1013,866.3512,-31.0041, 1.0)
        local res21 = addSphere(470.0822,870.7220,-28.5249, 1.0)
        local res22 = addSphere(496.7372,850.6622,-29.5522, 1.0)
        local res23 = addSphere(615.7032,777.4021,-32.1016, 1.0)
        local res24 = addSphere(648.8140,777.3646,-29.9300, 1.0)
        local res25 = addSphere(664.0432,788.7548,-29.8926, 1.0)
        local res26 = addSphere(685.9511,788.5950,-29.9591, 1.0)
        local res27 = addSphere(693.6030,800.6348,-29.9140, 1.0)
        local res28 = addSphere(716.4759,818.1044,-29.8943, 1.0)
        local res29 = addSphere(712.9354,834.7087,-29.9674, 1.0)
        local aqw = addSphere(716.2796,817.9316,-30.2534, 1.0)
        lua_thread.create(function ()
            wait(5000)
            removeSphere(res1)
            removeSphere(res2)
            removeSphere(res3)
            removeSphere(res4)
            removeSphere(res5)
            removeSphere(res6)
            removeSphere(res7)
            removeSphere(res8)
            removeSphere(res9)
            removeSphere(res10)
            removeSphere(res11)
            removeSphere(res12)
            removeSphere(res13)
            removeSphere(res14)
            removeSphere(res15)
            removeSphere(res16)
            removeSphere(res17)
            removeSphere(res18)
            removeSphere(res19)
            removeSphere(res20)
            removeSphere(res21)
            removeSphere(res22)
            removeSphere(res23)
            removeSphere(res24)
            removeSphere(res25)
            removeSphere(res26)
            removeSphere(res27)
            removeSphere(res28)
            removeSphere(res29)
            removeSphere(aqw)
        end)
    end)
    wait(-1)
end
таблица, poses = {все координаты}
for k, v in pairs(poses) do
addSphere(v)
end
с ремуве также
 

Revavi

Участник
101
24
кто-нибудь знает как реализовать эту фишку из police helper reborn?
1681069158294.png

я про выбор определённой строчки в колонках
 

chapo

🫡 В армии с 17.10.2023. В ЛС НЕ ОТВЕЧАЮ
Друг
8,772
11,216
Можно как то сделать более компактно?
Какую то переменную там где все координаты будуть

Lua:
script_name(NResourseMAP)
script_author(NaYke)
script_version(1)

require 'lib.moonloader'
local main_color = "{98FB98}"
local tag1 = main_color .. "[NResourseMAP By NaYke] {FFFFFF}- Успешно запущен."
local tag2 = main_color .. "[NResourseMAP By NaYke] {FFFFFF}- Загружено 45 точек ресурсов."

local coord = [[], []]

function main()
    while not isSampAvailable() do wait(0) end
    sampAddChatMessage(tag1, -1)
    sampAddChatMessage(tag2, -1)
    sampRegisterChatCommand("test", function ()
        local x, y, z = getCharCoordinates(PLAYER_PED)
        local res1 = addSphere(494.2589,866.1543,-31.1242, 1.0)
        local res2 = addSphere(484.9253,888.2664,-30.4663, 1.0)
        local res3 = addSphere(476.2323,879.8789,-29.8272, 1.0)
        local res4 = addSphere(467.0316,886.7172,-28.4295, 1.0)
        local res5 = addSphere(511.4182,834.8056,-26.3371, 1.0)
        local res6 = addSphere(515.4222,821.7529,-24.3999, 1.0)
        local res7 = addSphere(525.6802,822.1740,-25.5354, 1.0)
        local res8 = addSphere(532.3553,808.4451,-25.7831, 1.0)
        local res9 = addSphere(518.2730,808.8262,-23.1136, 1.0)
        local res10 = addSphere(554.4703,780.0768,-17.8384, 1.0)
        local res11 = addSphere(565.5139,770.0276,-16.4953, 1.0)
        local res12 = addSphere(496.6376,850.5760,-29.5776, 1.0)
        local res13 = addSphere(505.8997,804.9409,-21.6467, 1.0)
        local res14 = addSphere(562.1069,799.9304,-28.1325, 1.0)
        local res15 = addSphere(584.4244,791.0164,-29.8563, 1.0)
        local res16 = addSphere(601.2403,789.5441,-31.8218, 1.0)
        local res17 = addSphere(616.2394,777.1870,-31.8185, 1.0)
        local res18 = addSphere(664.2033,788.8451,-29.9605, 1.0)
        local res19 = addSphere(499.9399,792.1532,-21.7369, 1.0)
        local res20 = addSphere(494.1013,866.3512,-31.0041, 1.0)
        local res21 = addSphere(470.0822,870.7220,-28.5249, 1.0)
        local res22 = addSphere(496.7372,850.6622,-29.5522, 1.0)
        local res23 = addSphere(615.7032,777.4021,-32.1016, 1.0)
        local res24 = addSphere(648.8140,777.3646,-29.9300, 1.0)
        local res25 = addSphere(664.0432,788.7548,-29.8926, 1.0)
        local res26 = addSphere(685.9511,788.5950,-29.9591, 1.0)
        local res27 = addSphere(693.6030,800.6348,-29.9140, 1.0)
        local res28 = addSphere(716.4759,818.1044,-29.8943, 1.0)
        local res29 = addSphere(712.9354,834.7087,-29.9674, 1.0)
        local aqw = addSphere(716.2796,817.9316,-30.2534, 1.0)
        lua_thread.create(function ()
            wait(5000)
            removeSphere(res1)
            removeSphere(res2)
            removeSphere(res3)
            removeSphere(res4)
            removeSphere(res5)
            removeSphere(res6)
            removeSphere(res7)
            removeSphere(res8)
            removeSphere(res9)
            removeSphere(res10)
            removeSphere(res11)
            removeSphere(res12)
            removeSphere(res13)
            removeSphere(res14)
            removeSphere(res15)
            removeSphere(res16)
            removeSphere(res17)
            removeSphere(res18)
            removeSphere(res19)
            removeSphere(res20)
            removeSphere(res21)
            removeSphere(res22)
            removeSphere(res23)
            removeSphere(res24)
            removeSphere(res25)
            removeSphere(res26)
            removeSphere(res27)
            removeSphere(res28)
            removeSphere(res29)
            removeSphere(aqw)
        end)
    end)
    wait(-1)
end
Lua:
local spheres, list = {}, {
        { 494.2589, 866.1543, -31.1242 },
        { 484.9253, 888.2664, -30.4663 },
        { 476.2323, 879.8789, -29.8272 },
        { 467.0316, 886.7172, -28.4295 },
        { 511.4182, 834.8056, -26.3371 },
        { 515.4222, 821.7529, -24.3999 },
        { 525.6802, 822.1740, -25.5354 },
        { 532.3553, 808.4451, -25.7831 },
        { 518.2730, 808.8262, -23.1136 },
        { 554.4703, 780.0768, -17.8384 },
        { 565.5139, 770.0276, -16.4953 },
        { 496.6376, 850.5760, -29.5776 },
        { 505.8997, 804.9409, -21.6467 },
        { 562.1069, 799.9304, -28.1325 },
        { 584.4244, 791.0164, -29.8563 },
        { 601.2403, 789.5441, -31.8218 },
        { 616.2394, 777.1870, -31.8185 },
        { 664.2033, 788.8451, -29.9605 },
        { 499.9399, 792.1532, -21.7369 },
        { 494.1013, 866.3512, -31.0041 },
        { 470.0822, 870.7220, -28.5249 },
        { 496.7372, 850.6622, -29.5522 },
        { 615.7032, 777.4021, -32.1016 },
        { 648.8140, 777.3646, -29.9300 },
        { 664.0432, 788.7548, -29.8926 },
        { 685.9511, 788.5950, -29.9591 },
        { 693.6030, 800.6348, -29.9140 },
        { 716.4759, 818.1044, -29.8943 },
        { 712.9354, 834.7087, -29.9674 },
        { 716.2796, 817.9316, -30.2534 }
}

function main()
    while not isSampAvailable() do wait(0) end
    sampAddChatMessage(tag1, -1)
    sampAddChatMessage(tag2, -1)
    sampRegisterChatCommand("test", function ()
        local x, y, z = getCharCoordinates(PLAYER_PED)
        for index, pos in ipairs(list) do
            table.insert(spheres, addSphere(table.unpack(pos), 1.0))
        end
        lua_thread.create(function ()
            wait(5000)
            for _, sphere in ipairs(spheres) do
                removeSphere(sphere)
            end
        end)
    end)
    wait(-1)
end
 
  • Вау
Реакции: de_clain

BlackHole

Участник
40
7
Lua:
local spheres, list = {}, {
        { 494.2589, 866.1543, -31.1242 },
        { 484.9253, 888.2664, -30.4663 },
        { 476.2323, 879.8789, -29.8272 },
        { 467.0316, 886.7172, -28.4295 },
        { 511.4182, 834.8056, -26.3371 },
        { 515.4222, 821.7529, -24.3999 },
        { 525.6802, 822.1740, -25.5354 },
        { 532.3553, 808.4451, -25.7831 },
        { 518.2730, 808.8262, -23.1136 },
        { 554.4703, 780.0768, -17.8384 },
        { 565.5139, 770.0276, -16.4953 },
        { 496.6376, 850.5760, -29.5776 },
        { 505.8997, 804.9409, -21.6467 },
        { 562.1069, 799.9304, -28.1325 },
        { 584.4244, 791.0164, -29.8563 },
        { 601.2403, 789.5441, -31.8218 },
        { 616.2394, 777.1870, -31.8185 },
        { 664.2033, 788.8451, -29.9605 },
        { 499.9399, 792.1532, -21.7369 },
        { 494.1013, 866.3512, -31.0041 },
        { 470.0822, 870.7220, -28.5249 },
        { 496.7372, 850.6622, -29.5522 },
        { 615.7032, 777.4021, -32.1016 },
        { 648.8140, 777.3646, -29.9300 },
        { 664.0432, 788.7548, -29.8926 },
        { 685.9511, 788.5950, -29.9591 },
        { 693.6030, 800.6348, -29.9140 },
        { 716.4759, 818.1044, -29.8943 },
        { 712.9354, 834.7087, -29.9674 },
        { 716.2796, 817.9316, -30.2534 }
}

function main()
    while not isSampAvailable() do wait(0) end
    sampAddChatMessage(tag1, -1)
    sampAddChatMessage(tag2, -1)
    sampRegisterChatCommand("test", function ()
        local x, y, z = getCharCoordinates(PLAYER_PED)
        for index, pos in ipairs(list) do
            table.insert(spheres, addSphere(table.unpack(pos), 1.0))
        end
        lua_thread.create(function ()
            wait(5000)
            for _, sphere in ipairs(spheres) do
                removeSphere(sphere)
            end
        end)
    end)
    wait(-1)
end
Сделал так, вроде все работает ошибок нету, но метки не появляются, может есть другие какие то метки?
 

Dmitriy Makarov

25.05.2021
Проверенный
2,478
1,113
кто-нибудь знает как реализовать эту фишку из police helper reborn?Посмотреть вложение 197111
я про выбор определённой строчки в колонках
Это вроде imgui.Selectable.
C++:
IMGUI_API bool          Selectable(const char* label, bool selected = false, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0,0));  // size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height
 
  • Нравится
Реакции: Revavi

Revavi

Участник
101
24
а как сделать чтобы значки стояли в одном столбце, а текст в другом? я, наверное, плохо объяснил, просто покажу пример из мвд хелпера
1681075733263.png
 
  • Грустно
Реакции: qdIbp

tyukapa

Активный
298
65
У меня есть скрипт у которого активация такая:
Код:
sampRegisterChatCommand('ff', function(arg)

Мне нужно чтобы он работал автоматически при входе в самп, но так чтобы именно работал т.к. там function(arg)