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

S.Walston

Новичок
22
1
C++:
----------------------------------------------------------------------------------------

local limgui, imgui = pcall(require, 'imgui') assert(limgui, 'Library \'imgui\' not found.')
local limadd, imadd = pcall(require, 'imgui_addons') assert(limadd, 'Library \'imgui_addons\' not found.')
local lencoding, encoding = pcall(require, 'encoding') assert(lencoding, 'Library \'encoding\' not found.')

----------------------------------------------------------------------------------------

encoding.default = 'CP1251'
local u8 = encoding.UTF8
local sampev = require 'lib.samp.events'
local active = true
local mem = require 'memory'
local main_color = 0xFFFFFF
local tag = "{FFD700}[INFOBAR]:"
local keys = require 'vkeys'
local playsec = 0
local playmin = 0
local playhours = 0
local tables
local imgui = require 'imgui'
local encoding = require 'encoding'

----------------------------------------------------------------------------------------

activate = false

----------------------------------------------------------------------------------------

local window = imgui.ImBool(false)
local number_linux_state = imgui.ImBool(false)
local text_buffer = imgui.ImBuffer(256)

----------------------------------------------------------------------------------------

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampAddChatMessage("[Fantasy] Скрипт загружен. Специально для Fantasy Empire", 0xFFd86bf3)
    sampAddChatMessage("[Fantasy] Версия скрипта: v1.0", 0xFFd86bf3)
    sampRegisterChatCommand("poisk", function ()
        window.v = not window.v
    end)
    lua_thread.create(flooder)
    while true do
        wait(0)
            playsec = playsec + 1
            if playsec == 60 and playmin then
                playmin = playmin + 1
                playsec = 0
            end
            if playmin == 60 then
                playhours = playhours + 1
                playmin = 0
            end
        if number_linux_state.v == false then
        imgui.Process = true
        end
        imgui.Process = window.v
    end
    wait(-1)
end

function cmd_imgui(arg)
    number_linux_state.v = not number_linux_state.v
    imgui.Process = number_linux_state.v or show_2_winow.v
end

function imgui.OnDrawFrame()
    local iScreenWidth, iScreenHeight = getScreenResolution()
    local btn_size = imgui.ImVec2(-0.1, 0)
    activeB = imgui.ImBool(activate)
   
    if not window.v and not number_linux_state.v then
        imgui.process = false
    end
   
    if window.v then
       
        imgui.SetNextWindowPos(imgui.ImVec2(iScreenWidth / 2, iScreenHeight / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(500, 350), imgui.Cond.FirstUseEver)
     
        imgui.Begin(u8"Fantasy Empire", window, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
       
        imgui.Separator()
       
        if imgui.Button(u8 "Пиар семья 1 кликом!") then
            imgui.OpenPopup(u8 "Пиар семьи в радио и вип")
            lua_thread.create(function()
                sampSendChat("/vr Проходит набор в империю Fantasy. Все улучшения, Discord, Беседа в ВК. Звоните/Пишите", -1)
                wait(1000)
                sampSendChat("/ad 1 Проходит набор в империю Fantasy. Все улучшения, Discord, Беседа в ВК. Звоните/Пишите")
                wait(1000)
            end)
        end
        if imgui.Button(u8 "Выдать рацию") then
            imgui.OpenPopup(u8 "Выдать рацию новому")
            lua_thread.create(function()
                sampSendChat("/me резким движением рук снимает рюкзак с плеча, после чего открывает его", -1)
                wait(1000)
                sampSendChat("/me достает оттуда рацию, передает его человеку")
                wait(1000)
                sampSendChat("/todo Вот бери*улыбаясь", -1)
                wait(1000)
            end)
        end
       
        imgui.Separator()
        imgui.NewLine()
       
        imgui.Text(u8 'Авто - Пиар Fantasy Empire в вип чат')
        if imadd.ToggleButton(u8 "Sprunk##", activeB) then activate = not activate if activate then sampAddChatMessage('{FF69B4}Автопиар успешно включен!', -1) else sampAddChatMessage('{FF69B4}Вы выключили автопиар!', -1) end end
        imgui.SameLine(); imgui.Text(u8 'Нажми на кнопку, если хочешь включить пиар')
    end
   
    imgui.End()
end
       
        if number_linux_state.v then
       
        if not isCharInAnyCar(PLAYER_PED) then
        imgui.SetNextWindowPos(imgui.ImVec2(430, 824), imgui.Cond.FirstUseEver)
        imgui.ShowCursor = false
        imgui.SetMouseCursor(-1)
        _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
        server = sampGetCurrentServerName(PLAYER_HANDLE)
        ip = sampGetCurrentServerAddress(PLAYER_PED)
        weap = getCurrentCharWeapon(PLAYER_PED)
        weaponid = getWeapontypeModel(weap)
        ammo = getAmmoInCharWeapon(PLAYER_PED, weap)
        nick = sampGetPlayerNickname(id)
        fFps = mem.getfloat(0xB7CB50, 4, false)  
        ping = sampGetPlayerPing(id)
        time = (os.date("%H",os.time())..':'..os.date("%M",os.time())..':'..os.date("%S",os.time()))
        date = (os.date("%d",os.time())..'/'..os.date("%m",os.time())..'/'..os.date("%Y",os.time()))
        Health = getCharHealth(PLAYER_PED)
        Armor = getCharArmour(PLAYER_PED)
        Level = sampGetPlayerScore(id)
        pspeed = getCharSpeed(PLAYER_PED)
        local online = getGameTimer()/100000
        local afk = os.clock() - online
        x,y,z = getCharCoordinates(PLAYER_PED)
        Hours = (os.date("%H", os.time()))
        Minuts = (os.date("%M", os.time()))
        Seconds = (os.date("%S", os.time()))
        imgui.Begin("INFOBAR | Coded by NNC.", window, imgui.WindowFlags.NoTitleBar + imgui.WindowFlags.NoResize + imgui.WindowFlags.AlwaysAutoResize + imgui.WindowFlags.ShowBorders)
        imgui.Text("Server: " .. server, main_color)
        imgui.Text("NickName: " .. nick ..  " | ID: " .. id, main_color)
        imgui.Text("Online: " .. online .. " | AFK: " .. afk, main_color)
        imgui.End()
    else
        imgui.SetNextWindowPos(imgui.ImVec2(430, 824), imgui.Cond.FirstUseEver)
        imgui.ShowCursor = false
        imgui.SetMouseCursor(-1)
        _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
        car = storeCarCharIsInNoSave(playerPed)
        carmodel = getCarModel(car)
        carname = getGxtText(getNameOfVehicleModel(carmodel))
        _, cid = sampGetVehicleIdByCarHandle(car)
        carhp = getCarHealth(car)
        cspeed = getCarSpeed(car)
        server = sampGetCurrentServerName(PLAYER_HANDLE)
        ip = sampGetCurrentServerAddress(PLAYER_PED)
        nick = sampGetPlayerNickname(id)
        fFps = mem.getfloat(0xB7CB50, 4, false)  
        ping = sampGetPlayerPing(id)
        time = (os.date("%H",os.time())..':'..os.date("%M",os.time())..':'..os.date("%S",os.time()))
        date = (os.date("%d",os.time())..'/'..os.date("%m",os.time())..'/'..os.date("%Y",os.time()))
        Health = getCharHealth(PLAYER_PED)
        Armor = getCharArmour(PLAYER_PED)
        Hours = (os.date("%H", os.time()))
        Minuts = (os.date("%M", os.time()))
        Seconds = (os.date("%S", os.time()))
        Level = sampGetPlayerScore(id)
        x,y,z = getCharCoordinates(PLAYER_PED)
        imgui.Begin("INFOBAR | Coded by NNC.", window, imgui.WindowFlags.NoTitleBar + imgui.WindowFlags.NoResize + imgui.WindowFlags.AlwaysAutoResize + imgui.WindowFlags.ShowBorders)
        imgui.Text("Server: " .. server, main_color)
        imgui.Text("NickName: " .. nick ..  " | ID: " .. id, main_color)
        imgui.Text("Ping: " .. ping .. " | Level: " .. Level .. " | FPS: " .. math.floor(fFps), main_color)
        imgui.Text("Time: " .. time .. " | Date: " .. date, main_color)
        imgui.Text("City: " .. city[getCityPlayerIsIn(PLAYER_HANDLE)] .. " | PlayerTime: " .. playhours .. ":" .. playmin .. ":" .. playsec, main_color)
        imgui.Text("Health: " .. Health .. " | Armour: " .. Armor .. " | Speed: " .. math.floor(cspeed * 2.5), main_color)
        imgui.Text("CarHP: " .. carhp .. " | CarID: " .. cid .. " | CarType: " .. carmodel, main_color)
        imgui.Text("X: " .. math.floor(x) .. " | Y: " .. math.floor(y) .. " | Z: " .. math.floor(z), main_color)
    end
   
    imgui.End()
end

function flooder()
    while true do
        if activate then
            sampSendChat("/vr Проходит набор в империю Fantasy. Все улучшения, Discord, Беседа в ВК. Звоните/Пишите")
        end
        wait(300000)
    end
end

function black_grey()
    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(1.00, 1.00, 1.00, 0.95)
    colors[clr.TextDisabled] = ImVec4(0.50, 0.50, 0.50, 1.00)
    colors[clr.WindowBg] = ImVec4(0.13, 0.12, 0.12, 1.00)
    colors[clr.ChildWindowBg] = ImVec4(0.13, 0.12, 0.12, 1.00)
    colors[clr.PopupBg] = ImVec4(0.05, 0.05, 0.05, 0.94)
    colors[clr.Border] = ImVec4(0.53, 0.53, 0.53, 0.46)
    colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg] = ImVec4(0.00, 0.00, 0.00, 0.85)
    colors[clr.FrameBgHovered] = ImVec4(0.22, 0.22, 0.22, 0.40)
    colors[clr.FrameBgActive] = ImVec4(0.16, 0.16, 0.16, 0.53)
    colors[clr.TitleBg] = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.TitleBgActive] = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.MenuBarBg] = ImVec4(0.12, 0.12, 0.12, 1.00)
    colors[clr.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.53)
    colors[clr.ScrollbarGrab] = ImVec4(0.31, 0.31, 0.31, 1.00)
    colors[clr.ScrollbarGrabHovered] = ImVec4(0.41, 0.41, 0.41, 1.00)
    colors[clr.ScrollbarGrabActive] = ImVec4(0.48, 0.48, 0.48, 1.00)
    colors[clr.ComboBg] = ImVec4(0.24, 0.24, 0.24, 0.99)
    colors[clr.CheckMark] = ImVec4(0.79, 0.79, 0.79, 1.00)
    colors[clr.SliderGrab] = ImVec4(0.48, 0.47, 0.47, 0.91)
    colors[clr.SliderGrabActive] = ImVec4(0.56, 0.55, 0.55, 0.62)
    colors[clr.Button] = ImVec4(0.50, 0.50, 0.50, 0.63)
    colors[clr.ButtonHovered] = ImVec4(0.67, 0.67, 0.68, 0.63)
    colors[clr.ButtonActive] = ImVec4(0.26, 0.26, 0.26, 0.63)
    colors[clr.Header] = ImVec4(0.54, 0.54, 0.54, 0.58)
    colors[clr.HeaderHovered] = ImVec4(0.64, 0.65, 0.65, 0.80)
    colors[clr.HeaderActive] = ImVec4(0.25, 0.25, 0.25, 0.80)
    colors[clr.Separator] = ImVec4(0.58, 0.58, 0.58, 0.50)
    colors[clr.SeparatorHovered] = ImVec4(0.81, 0.81, 0.81, 0.64)
    colors[clr.SeparatorActive] = ImVec4(0.81, 0.81, 0.81, 0.64)
    colors[clr.ResizeGrip] = ImVec4(0.87, 0.87, 0.87, 0.53)
    colors[clr.ResizeGripHovered] = ImVec4(0.87, 0.87, 0.87, 0.74)
    colors[clr.ResizeGripActive] = ImVec4(0.87, 0.87, 0.87, 0.74)
    colors[clr.CloseButton] = ImVec4(0.45, 0.45, 0.45, 0.50)
    colors[clr.CloseButtonHovered] = ImVec4(0.70, 0.70, 0.90, 0.60)
    colors[clr.CloseButtonActive] = ImVec4(0.70, 0.70, 0.70, 1.00)
    colors[clr.PlotLines] = ImVec4(0.68, 0.68, 0.68, 1.00)
    colors[clr.PlotLinesHovered] = ImVec4(0.68, 0.68, 0.68, 1.00)
    colors[clr.PlotHistogram] = ImVec4(0.90, 0.77, 0.33, 1.00)
    colors[clr.PlotHistogramHovered] = ImVec4(0.87, 0.55, 0.08, 1.00)
    colors[clr.TextSelectedBg] = ImVec4(0.47, 0.60, 0.76, 0.47)
    colors[clr.ModalWindowDarkening] = ImVec4(0.88, 0.88, 0.88, 0.35)
end
black_grey()
Приветствую всех, не могли бы подсказать, почему number_linux_state не включается при запуске скрипта?
Поднимаю тему!
 

S.Walston

Новичок
22
1
нужно расположить его в ondrawframe
кого именно?
Код:
function imgui.OnDrawFrame()
    local iScreenWidth, iScreenHeight = getScreenResolution()
    local btn_size = imgui.ImVec2(-0.1, 0)
    activeB = imgui.ImBool(activate)
    
    if not window.v and not number_linux_state.v then
        imgui.process = false
    end
    
    if window.v then
        
        imgui.SetNextWindowPos(imgui.ImVec2(iScreenWidth / 2, iScreenHeight / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(500, 350), imgui.Cond.FirstUseEver)
      
        imgui.Begin(u8"Fantasy Empire", window, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
        
        imgui.Separator()
        
        if imgui.Button(u8 "Пиар семья 1 кликом!") then
            imgui.OpenPopup(u8 "Пиар семьи в радио и вип")
            lua_thread.create(function()
                sampSendChat("/vr Проходит набор в империю Fantasy. Все улучшения, Discord, Беседа в ВК. Звоните/Пишите", -1)
                wait(1000)
                sampSendChat("/ad 1 Проходит набор в империю Fantasy. Все улучшения, Discord, Беседа в ВК. Звоните/Пишите")
                wait(1000)
            end)
        end
        if imgui.Button(u8 "Выдать рацию") then
            imgui.OpenPopup(u8 "Выдать рацию новому")
            lua_thread.create(function()
                sampSendChat("/me резким движением рук снимает рюкзак с плеча, после чего открывает его", -1)
                wait(1000)
                sampSendChat("/me достает оттуда рацию, передает его человеку")
                wait(1000)
                sampSendChat("/todo Вот бери*улыбаясь", -1)
                wait(1000)
            end)
        end
        
        imgui.Separator()
        imgui.NewLine()
        
        imgui.Text(u8 'Авто - Пиар Fantasy Empire в вип чат')
        if imadd.ToggleButton(u8 "Sprunk##", activeB) then activate = not activate if activate then sampAddChatMessage('{FF69B4}Автопиар успешно включен!', -1) else sampAddChatMessage('{FF69B4}Вы выключили автопиар!', -1) end end
        imgui.SameLine(); imgui.Text(u8 'Нажми на кнопку, если хочешь включить пиар')
    end
    imgui.End()
end
        
    if number_linux_state.v then
        
        if not isCharInAnyCar(PLAYER_PED) then
        imgui.SetNextWindowPos(imgui.ImVec2(430, 824), imgui.Cond.FirstUseEver)
        imgui.ShowCursor = false
        imgui.SetMouseCursor(-1)
        _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
        server = sampGetCurrentServerName(PLAYER_HANDLE)
        ip = sampGetCurrentServerAddress(PLAYER_PED)
        weap = getCurrentCharWeapon(PLAYER_PED)
        weaponid = getWeapontypeModel(weap)
        ammo = getAmmoInCharWeapon(PLAYER_PED, weap)
        nick = sampGetPlayerNickname(id)
        fFps = mem.getfloat(0xB7CB50, 4, false)   
        ping = sampGetPlayerPing(id)
        time = (os.date("%H",os.time())..':'..os.date("%M",os.time())..':'..os.date("%S",os.time()))
        date = (os.date("%d",os.time())..'/'..os.date("%m",os.time())..'/'..os.date("%Y",os.time()))
        Health = getCharHealth(PLAYER_PED)
        Armor = getCharArmour(PLAYER_PED)
        Level = sampGetPlayerScore(id)
        pspeed = getCharSpeed(PLAYER_PED)
        local online = getGameTimer()/100000
        local afk = os.clock() - online
        x,y,z = getCharCoordinates(PLAYER_PED)
        Hours = (os.date("%H", os.time()))
        Minuts = (os.date("%M", os.time()))
        Seconds = (os.date("%S", os.time()))
        imgui.Begin("INFOBAR | Coded by NNC.", window, imgui.WindowFlags.NoTitleBar + imgui.WindowFlags.NoResize + imgui.WindowFlags.AlwaysAutoResize + imgui.WindowFlags.ShowBorders, number_linux_state)
        imgui.Text("Server: " .. server, main_color)
        imgui.Text("NickName: " .. nick ..  " | ID: " .. id, main_color)
        imgui.Text("Online: " .. online .. " | AFK: " .. afk, main_color)
        imgui.End()
    else
        imgui.SetNextWindowPos(imgui.ImVec2(430, 824), imgui.Cond.FirstUseEver)
        imgui.ShowCursor = false
        imgui.SetMouseCursor(-1)
        _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
        car = storeCarCharIsInNoSave(playerPed)
        carmodel = getCarModel(car)
        carname = getGxtText(getNameOfVehicleModel(carmodel))
        _, cid = sampGetVehicleIdByCarHandle(car)
        carhp = getCarHealth(car)
        cspeed = getCarSpeed(car)
        server = sampGetCurrentServerName(PLAYER_HANDLE)
        ip = sampGetCurrentServerAddress(PLAYER_PED)
        nick = sampGetPlayerNickname(id)
        fFps = mem.getfloat(0xB7CB50, 4, false)   
        ping = sampGetPlayerPing(id)
        time = (os.date("%H",os.time())..':'..os.date("%M",os.time())..':'..os.date("%S",os.time()))
        date = (os.date("%d",os.time())..'/'..os.date("%m",os.time())..'/'..os.date("%Y",os.time()))
        Health = getCharHealth(PLAYER_PED)
        Armor = getCharArmour(PLAYER_PED)
        Hours = (os.date("%H", os.time()))
        Minuts = (os.date("%M", os.time()))
        Seconds = (os.date("%S", os.time()))
        Level = sampGetPlayerScore(id)
        x,y,z = getCharCoordinates(PLAYER_PED)
        imgui.Begin("INFOBAR | Coded by NNC.", window, imgui.WindowFlags.NoTitleBar + imgui.WindowFlags.NoResize + imgui.WindowFlags.AlwaysAutoResize + imgui.WindowFlags.ShowBorders)
        imgui.Text("Server: " .. server, main_color)
        imgui.Text("NickName: " .. nick ..  " | ID: " .. id, main_color)
        imgui.Text("Ping: " .. ping .. " | Level: " .. Level .. " | FPS: " .. math.floor(fFps), main_color)
        imgui.Text("Time: " .. time .. " | Date: " .. date, main_color)
        imgui.Text("City: " .. city[getCityPlayerIsIn(PLAYER_HANDLE)] .. " | PlayerTime: " .. playhours .. ":" .. playmin .. ":" .. playsec, main_color)
        imgui.Text("Health: " .. Health .. " | Armour: " .. Armor .. " | Speed: " .. math.floor(cspeed * 2.5), main_color)
        imgui.Text("CarHP: " .. carhp .. " | CarID: " .. cid .. " | CarType: " .. carmodel, main_color)
        imgui.Text("X: " .. math.floor(x) .. " | Y: " .. math.floor(y) .. " | Z: " .. math.floor(z), main_color)
    end
    imgui.End()
end
По факту вставлен
 

shizzard

Участник
150
7
Lua:
        function sampev.onServerMessage(color,text)
                                            if text:find(mainIni.imessage.itext) then
                                                return false
                                            end
                                        end
ретёрн фалсит только английские слова, русские нет
 

shizzard

Участник
150
7
1598863683122.png
ofcourse
Кодировка Windows1251?
Кстати,как сделать манипуляцию с текстом независимо от регистра и последующих знаков, чтобы убрать например из чата слово Server достаточно было вписать serv
и как создавать новый инпут и новое значение в массиве прямо в скрипте?
 

Izvinisb

Известный
Проверенный
963
601
Как сделать подсказку при наведении? imgui
введи этот вопрос в гугл и получишь ->
Lua:
function imgui.TextQuestion(txt)
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.PushTextWrapPos(450)
        imgui.TextUnformatted(txt)
        imgui.PopTextWrapPos()
        imgui.EndTooltip()
    end
end
 

Viem

Известный
49
5
Как в imgui.Text изменить стиль шрифта.
Увеличить/Жирность/Обводку
 

HpP

Известный
368
119
Можно ли, получить свою должность в какой-либо организации?