Как засунуть картинку в ImGUI

Hader

Потрачен
Автор темы
37
3
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Версия MoonLoader
.026-beta
Как засунуть картинку в ImGUI и указать ее расположения и размер?
 

ewin

Известный
673
371
У меня сейчас error будет, простите за тупость. Ниже полный код кину скажите строчки что куда писать пожалуйста
Полный код:
script_name("Transport") -- Название скрипта
script_author("by K.Ackerman") -- Автор скрипта
script_description("Информация транспорта версия 1.0") -- Описание скрипта

require "lib.moonloader" -- Подключение библиотеки
local tag = "[ID транспорта 1.0]: " -- Локальнв=ая переменная
local keys = require "vkeys" --
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = "CP1251"
u8 = encoding.UTF8
local inicfg = require 'inicfg'
local fa = require 'fAwesome5'
local flags = require 'moonloader'.font_flag
local events = require 'samp.events'

local combo_select = imgui.ImInt(0)

local tag = "[Информация]: " --
local tag1 = "[Подсказка]: "
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local wite_color = "{FFFFFF}"
--
local sw, sh = getScreenResolution()

-- Спец переменные для imgui
local main_window_state = imgui.ImBool(false)
arrSelectable = {false, false}

local text_buffer = imgui.ImBuffer(256)

local imgur

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
   
    sampRegisterChatCommand("inf", cmd_inf)
   
    imgui.Process = false    -- Процесс
   
    sampAddChatMessage(tag .. "{FFFFFF}Скрипт успешно загружен | Версия 1.0 | by Ackerman", 0xFF0000)
    sampAddChatMessage(tag1 .. "{FFFFFF}Для вывода информации используйте команду {008000}/inf", 0xFF0000)
    -- Разовый цикл
   
    image = imgui.CreateTextureFromFile("moonloader/images/Vehicle_400.")
   
    while true do
        wait(0)
       
        if main_window_state.v == false then
            imgui.Process = false
        end
        -- Бесконечный цикл
    end
end

function cmd_inf(arg)
    sampAddChatMessage(tag .. "{FFFFFF}Добро пожаловать в меню.", 0xFF0000)
    main_window_state.v = not main_window_state.v
    imgui.Process = main_window_state.v
end

function imgui.OnDrawFrame()

    if not main_window_state then
        imgui.Process = false
    end

    -- Положение окна
    imgui.SetNextWindowSize(imgui.ImVec2(400, 500), imgui.Cond.FirstUseEver)
    imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
    --
   

    imgui.Begin(u8"ID Автомобилей v: 1.0 · by Ackerman ®", main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
                    if imgui.Selectable("401 Bravura", false) then
                        imgui.Image(image, imgui.ImVec2(imgui.GetWindowWidth(), imgui.GetWindowWidth()/2))
                    end
                   
                    if imgui.IsItemHovered("401 Bravura") then
                        imgui.BeginTooltip(image, imgui.ImVec2(imgui.GetWindowWidth(), imgui.GetWindowWidth()/2))
                        imgui.EndTooltip()
                    end
                   
    imgui.End()
   
end

-- Центровка названия в окне

function apply_custom_style()
    imgui.SwitchContext()
    local style = imgui.GetStyle()
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
end
apply_custom_style()
unknown.png
 

Вложения

  • image.lua
    1.2 KB · Просмотры: 17
  • Нравится
Реакции: Ackerman_Kirito

Ackerman_Kirito

Новичок
24
0
Полностью заменил на ваш код, спасибо за уделенное время, выдал ошибку
[ML] (error) imgui_id.lua: C:\Game play\Äëÿ ñáîðêè\SAMP\moonloader\imgui_id.lua:7: attempt to index local 'new' (a nil value)
stack traceback:.
Изменил только в вашем коде путь к своему файлу
вот:
require 'lib.sampfuncs'
require 'lib.moonloader'

local imgui = require 'imgui'

local new = imgui.new
local renderWindow = new.bool(false)

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('imgui', function()
        renderWindow[0] = not renderWindow[0]
    end)
    while true do
        wait(0)
        
    end
end

imgui.OnInitialize(function()
    imgui.GetIO().IniFilename = nil
    img = imgui.CreateTextureFromFile(getGameDirectory() .. '\\moonloader\\images\\Vehicle_400.jpg')
end)

local newFrame = imgui.OnFrame(
    function() return renderWindow[0] end,
    function(self)
        local resX, resY = getScreenResolution()
        local sizeX, sizeY = 600, 600
        imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
        imgui.Begin('Main Window', renderWindow)
        imgui.Text("Text")
        if imgui.IsItemHovered() then
            imgui.BeginTooltip()
            imgui.Image(img, imgui.ImVec2(300,300))
            imgui.EndTooltip()
        end
        imgui.End()
    end
)
 

ewin

Известный
673
371
Полностью заменил на ваш код, спасибо за уделенное время, выдал ошибку
[ML] (error) imgui_id.lua: C:\Game play\Äëÿ ñáîðêè\SAMP\moonloader\imgui_id.lua:7: attempt to index local 'new' (a nil value)
stack traceback:.
Изменил только в вашем коде путь к своему файлу
вот:
require 'lib.sampfuncs'
require 'lib.moonloader'

local imgui = require 'imgui'

local new = imgui.new
local renderWindow = new.bool(false)

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('imgui', function()
        renderWindow[0] = not renderWindow[0]
    end)
    while true do
        wait(0)
       
    end
end

imgui.OnInitialize(function()
    imgui.GetIO().IniFilename = nil
    img = imgui.CreateTextureFromFile(getGameDirectory() .. '\\moonloader\\images\\Vehicle_400.jpg')
end)

local newFrame = imgui.OnFrame(
    function() return renderWindow[0] end,
    function(self)
        local resX, resY = getScreenResolution()
        local sizeX, sizeY = 600, 600
        imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
        imgui.Begin('Main Window', renderWindow)
        imgui.Text("Text")
        if imgui.IsItemHovered() then
            imgui.BeginTooltip()
            imgui.Image(img, imgui.ImVec2(300,300))
            imgui.EndTooltip()
        end
        imgui.End()
    end
)
local imgui = require 'imgui'
ты имгуи подключаешь, а не мимгуи
вот так должно быть:
local imgui = require 'mimgui'
 
  • Нравится
Реакции: Ackerman_Kirito

Ackerman_Kirito

Новичок
24
0
local imgui = require 'imgui'
ты имгуи подключаешь, а не мимгуи
вот так должно быть:
local imgui = require 'mimgui'
Lua:
script_name("Transport") -- Название скрипта
script_author("by K.Ackerman") -- Автор скрипта
script_description("Информация транспорта версия 1.0") -- Описание скрипта

require 'lib.sampfuncs'
require 'lib.moonloader'

local imgui = require 'mimgui'

local new = imgui.new
local renderWindow = new.bool(false)

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('imgui', function()
        renderWindow[0] = not renderWindow[0]
    end)
    while true do
        wait(0)
       
    end
end

imgui.OnInitialize(function()
    imgui.GetIO().IniFilename = nil
    img = imgui.CreateTextureFromFile(getGameDirectory() .. '\\moonloader\\images\\123.jpg')
end)

local newFrame = imgui.OnFrame(
    function() return renderWindow[0] end,
    function(self)
        local resX, resY = getScreenResolution()
        local sizeX, sizeY = 600, 600
        imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
        imgui.Begin('Main Window', renderWindow)
        imgui.Text("Text")
        if imgui.IsItemHovered() then
            imgui.BeginTooltip()
            imgui.Image(img, imgui.ImVec2(300,300))
            imgui.EndTooltip()
        end
        imgui.End()
    end
)
Все равно выдает ошибку:
[ML] (error) Transport: C:\Game play\Для сборки\SAMP\moonloader\imgui_id.lua:8: module 'mimgui' not found:
no field package.preload['mimgui']
 

ewin

Известный
673
371
Lua:
script_name("Transport") -- Название скрипта
script_author("by K.Ackerman") -- Автор скрипта
script_description("Информация транспорта версия 1.0") -- Описание скрипта

require 'lib.sampfuncs'
require 'lib.moonloader'

local imgui = require 'mimgui'

local new = imgui.new
local renderWindow = new.bool(false)

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('imgui', function()
        renderWindow[0] = not renderWindow[0]
    end)
    while true do
        wait(0)
      
    end
end

imgui.OnInitialize(function()
    imgui.GetIO().IniFilename = nil
    img = imgui.CreateTextureFromFile(getGameDirectory() .. '\\moonloader\\images\\123.jpg')
end)

local newFrame = imgui.OnFrame(
    function() return renderWindow[0] end,
    function(self)
        local resX, resY = getScreenResolution()
        local sizeX, sizeY = 600, 600
        imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
        imgui.Begin('Main Window', renderWindow)
        imgui.Text("Text")
        if imgui.IsItemHovered() then
            imgui.BeginTooltip()
            imgui.Image(img, imgui.ImVec2(300,300))
            imgui.EndTooltip()
        end
        imgui.End()
    end
)
Все равно выдает ошибку:
[ML] (error) Transport: C:\Game play\Для сборки\SAMP\moonloader\imgui_id.lua:8: module 'mimgui' not found:
no field package.preload['mimgui']
mimgui не установлен
 
  • Нравится
Реакции: Ackerman_Kirito

Ackerman_Kirito

Новичок
24
0
Теперь вот
[ML] (error) Transport: C:\Game play\Для сборки\SAMP\moonloader\imgui_id.lua:11: attempt to index local 'new' (a nil value)
stack traceback:
Можно тебя попросить на основе моего кода написать тело к наводке на кнопку я на основании этого уже разберусь(( я совсем запутался
 

ewin

Известный
673
371
Теперь вот
[ML] (error) Transport: C:\Game play\Для сборки\SAMP\moonloader\imgui_id.lua:11: attempt to index local 'new' (a nil value)
stack traceback:
Можно тебя попросить на основе моего кода написать тело к наводке на кнопку я на основании этого уже разберусь(( я совсем запутался
Astronomical#3369 дс
 
  • Нравится
Реакции: Ackerman_Kirito

sat0ry

Известный
1,092
293
Привет, снова я с вопросом.
Спасибо @ewin что оказал огромную помощь в скрипте.
Я дополнил его получилось вот:

Сбились названия авто. Код со скинами идентичен (принцип написания) Буду благодарен за помощь! :**
u8 перед текстом
 

Ackerman_Kirito

Новичок
24
0
Давай тогда полный код
Только ногу не сломай)
Полный код:
require 'lib.sampfuncs'
require 'lib.moonloader'

local keys = require 'vkeys'
local imgui = require 'mimgui'
local tag1 = "[Подсказка]: "
local tag = "[Информация]: "

local new = imgui.new
local renderWindow = new.bool(false)
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local tCarsName = {"Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel", "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
"Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam", "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BFInjection", "Hunter",
"Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus", "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie", "Stallion", "Rumpo",
"RCBandit", "Romero","Packer", "Monster", "Admiral", "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder", "Reefer", "Tropic", "Flatbed",
"Yankee", "Caddy", "Solair", "Berkley'sRCVan", "Skimmer", "PCJ-600", "Faggio", "Freeway", "RCBaron", "RCRaider", "Glendale", "Oceanic", "Sanchez", "Sparrow",
"Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX", "Burrito", "Camper", "Marquis", "Baggage",
"Dozer", "Maverick", "NewsChopper", "Rancher", "FBIRancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking", "BlistaCompact", "PoliceMaverick",
"Boxvillde", "Benson", "Mesa", "RCGoblin", "HotringRacerA", "HotringRacerB", "BloodringBanger", "Rancher", "SuperGT", "Elegant", "Journey", "Bike",
"MountainBike", "Beagle", "Cropduster", "Stunt", "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "hydra", "FCR-900", "NRG-500", "HPV1000",
"CementTruck", "TowTruck", "Fortune", "Cadrona", "FBITruck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer", "Remington", "Slamvan", "Blade", "Freight",
"Streak", "Vortex", "Vincent", "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo", "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada",
"Yosemite", "Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance", "RCTiger", "Flash", "Tahoma", "Savanna", "Bandito",
"FreightFlat", "StreakCarriage", "Kart", "Mower", "Dune", "Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400", "NewsVan",
"Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club", "FreightBox", "Trailer", "Andromada", "Dodo", "RCCam", "Launch", "PoliceCar", "PoliceCar",
"PoliceCar", "PoliceRanger", "Picador", "S.W.A.T", "Alpha", "Phoenix", "GlendaleShit", "SadlerShit", "Luggage A", "Luggage B", "Stairs", "Boxville", "Tiller",
"UtilityTrailer"}
NameCar = {
    [400] = "Landstalker",
    [401] = 'Bravura',
    [402] = 'Buffalo',
    [403] = 'Linerunner',
    [404] = 'Perenniel',
    [405] = 'Sentinel',
    [406] = 'Dumper',
    [407] = 'Firetruck',
    [408] = 'Trashmaster',
    [409] = 'Stretch',
    [410] = 'Manana',
    [411] = 'Infernus',
    [412] = 'Voodoo',
    [413] = 'Pony',
    [414] = 'Mule',
    [415] = 'Cheetah',
    [416] = 'Ambulance',
    [417] = 'Leviathan',
    [418] = 'Moonbeam',
    [419] = 'Esperanto',
    [420] = 'Taxi',
    [421] = 'Washington',
    [422] = 'Bobcat',
    [423] = 'Mr Whoopee',
    [424] = 'BF Injection',
    [425] = 'Hunter',
    [426] = 'Premier',
    [427] = 'Enforcer',
    [428] = 'Securicar',
    [429] = 'Banshee',
    [430] = 'Predator',
    [431] = 'Bus',
    [432] = 'Rhino',
    [433] = 'Barracks',
    [434] = 'Hotknife',
    [435] = 'Article Trailer',
    [436] = 'Previon',
    [437] = 'Coach',
    [438] = 'Cabbie',
    [439] = 'Stallion',
    [440] = 'Rumpo',
    [441] = 'RC Bandit',
    [442] = 'Romero',
    [443] = 'Packer',
    [444] = 'Monster',
    [445] = 'Admiral',
    [446] = 'Squallo',
    [447] = 'Seasparrow',
    [448] = 'Pizzaboy',
    [449] = 'Tram',
    [450] = 'Article Trailer 2',
    [451] = 'Turismo',
    [452] = 'Speeder',
    [453] = 'Reefer',
    [454] = 'Tropic',
    [455] = 'Flatbed',
    [456] = 'Yankee',
    [457] = 'Caddy',
    [458] = 'Solair',
    [459] = "Berkley's RC",
    [460] = 'Skimmer',
    [461] = 'PCJ-600',
    [462] = 'Faggio',
    [463] = 'Freeway',
    [464] = 'RC Baron',
    [465] = 'RC Raider',
    [466] = 'Glendale',
    [467] = 'Oceanic',
    [468] = 'Sanchez',
    [469] = 'Sparrow',
    [470] = 'Patriot',
    [471] = 'Quad',
    [472] = 'Coastguard',
    [473] = 'Dinghy',
    [474] = 'Hermes',
    [475] = 'Sabre',
    [476] = 'Rustler',
    [477] = 'ZR-350',
    [478] = 'Walton',
    [479] = 'Regina',
    [480] = 'Comet',
    [481] = 'BMX',
    [482] = 'Burrito',
    [483] = 'Camper',
    [484] = 'Marquis',
    [485] = 'Baggage',
    [486] = 'Dozer',
    [487] = 'Maverick',
    [488] = 'SAN News Maverick',
    [489] = 'Rancher',
    [490] = 'FBI Rancher',
    [491] = 'Virgo',
    [492] = 'Greenwood',
    [493] = 'Jetmax',
    [494] = 'Hotring Racer',
    [495] = 'Sandking',
    [496] = 'Blista Compact',
    [497] = 'Police Maverick',
    [498] = 'Boxville',
    [499] = 'Benson',
    [500] = 'Mesa',
    [501] = 'RC Goblin',
    [502] = 'Hotring Racer A',
    [503] = 'Hotring Racer B',
    [504] = 'Bloodring Banger',
    [505] = 'Rancher',
    [506] = 'Super GT',
    [507] = 'Elegant',
    [508] = 'Journey',
    [509] = 'Bike',
    [510] = 'Mountain Bike',
    [511] = 'Beagle',
    [512] = 'Cropduster',
    [513] = 'Stuntplane',
    [514] = 'Tanker',
    [515] = 'Roadtrain',
    [516] = 'Nebula',
    [517] = 'Majestic',
    [518] = 'Buccaneer',
    [519] = 'Shamal',
    [520] = 'Hydra',
    [521] = 'FCR-900',
    [522] = 'NRG-500',
    [523] = 'HPV1000',
    [524] = 'Cement Truck',
    [525] = 'Towtruck',
    [526] = 'Fortune',
    [527] = 'Cadrona',
    [528] = 'FBI Truck',
    [529] = 'Willard',
    [530] = 'Forklift',
    [531] = 'Tractor',
    [532] = 'Combine Harvester',
    [533] = 'Feltzer',
    [534] = 'Remington',
    [535] = 'Slamvan',
    [536] = 'Blade',
    [537] = 'Freight (Train)',
    [538] = 'Brownstreak (Train)',
    [539] = 'Vortex',
    [540] = 'Vincent',
    [541] = 'Bullet',
    [542] = 'Clover',
    [543] = 'Sadler',
    [544] = 'Firetruck LA',
    [545] = 'Hustler',
    [546] = 'Intruder',
    [547] = 'Primo',
    [548] = 'Cargobob',
    [549] = 'Tampa',
    [550] = 'Sunrise',
    [551] = 'Merit',
    [552] = 'Utility Van',
    [553] = 'Nevada',
    [554] = 'Yosemite',
    [555] = 'Windsor',
    [556] = 'Monster A',
    [557] = 'Monster B',
    [558] = 'Uranus',
    [559] = 'Jester',
    [560] = 'Sultan',
    [561] = 'Stratum',
    [562] = 'Elegy',
    [563] = 'Raindance',
    [564] = 'RC Tiger',
    [565] = 'Flash',
    [566] = 'Tahoma',
    [567] = 'Savanna',
    [568] = 'Bandito',
    [569] = 'Freight Flat Trailer',
    [570] = 'Streak Trailer',
    [571] = 'Kart',
    [572] = 'Mower',
    [573] = 'Dune',
    [574] = 'Sweeper',
    [575] = 'Broadway',
    [576] = 'Tornado',
    [577] = 'AT400',
    [578] = 'DFT-30',
    [579] = 'Huntley',
    [580] = 'Stafford',
    [581] = 'BF-400',
    [582] = 'Newsvan',
    [583] = 'Tug',
    [584] = 'Petrol Trailer',
    [585] = 'Emperor',
    [586] = 'Wayfarer',
    [587] = 'Euros',
    [588] = 'Hotdog',
    [589] = 'Club',
    [590] = 'Freight Box Trailer',
    [591] = 'Article Trailer 3',
    [592] = 'Andromada',
    [593] = 'Dodo',
    [594] = 'RC Cam',
    [595] = 'Launch',
    [596] = 'Police Car (LSPD)',
    [597] = 'Police Car (SFPD)',
    [598] = 'Police Car (LVPD)',
    [599] = 'Police Ranger',
    [600] = 'Picador',
    [601] = 'S.W.A.T.',
    [602] = 'Alpha',
    [603] = 'Phoenix',
    [604] = 'Glendale Shit',
    [605] = 'Sadler Shit',
    [606] = 'Baggage Trailer A',
    [607] = 'Baggage Trailer B',
    [608] = 'Tug Stairs Trailer',
    [609] = 'Boxville',
    [610] = 'Farm Trailer',
    [611] = 'Utility Trailer',
  }

local tSkinName = {"cj", "truth", "maccer", "andre", "bbthin", "bb", "emmet", "Male01", "janitor", "bfori", "bfost", "vbfycrp",
"bfyri", "bfyst", "bmori", "bmost", "bmyap", "bmybu", "bmybe", "bmydj", "bmyri", "bmycr", "bmyst", "wmybmx",
 "wbdyg1", "wbdyg2", "wmybp", "wmycon", "bmydrug", "wmydrug", "hmydrug", "dwfolc", "dwmolc1", "dwmolc2", "dwmylc1", "hmogar",
 "wmygol1", "wmygol2", "hfori", "hfost", "hfyri", "hfyst", "jethro", "hmori", "hmost", "hmybe", "hmyri", "hmycr",
 "hmyst", "omokung", "wmymech", "bmymoun", "wmymoun", "Unknown", "ofost", "ofyri", "ofyst", "omori", "omost", "omyri",
 "omyst", "wmyplt", "wmopj", "bfypro", "hfypro", "kendl", "bmypol1", "bmypol2", "wmoprea", "sbfyst", "wmosci", "wmysgrd",
 "swmyhp1", "swmyhp2", "swfopro", "wfystew", "swmotr1", "wmotr1", "bmotr1", "vbmybox", "vwmybox", "vhmyelv", "vbmyelv", "vimyelv",
 "vwfypro", "ryder3", "vwfyst1", "wfori", "wfost", "wfyjg", "wfyri", "wfyro", "wfyst", "wmori", "wmost", "wmyjg",
 "wmylg", "wmyri", "wmyro", "wmycr", "wmyst", "ballas1", "ballas2", "ballas3", "fam1", "fam2", "fam3", "lsv1",
 "lsv2", "lsv3", "maffa", "maffb", "mafboss", "vla1", "vla2", "vla3", "triada", "triadb", "sindaco", "triboss",
 "dnb1", "dnb2", "dnb3", "vmaff1", "vmaff2", "vmaff3", "vmaff4", "dnmylc", "dnfolc1", "dnfolc2", "dnfylc", "dnmolc1",
 "dnmolc2", "sbmotr2", "swmotr2", "sbmytr3", "swmotr3", "wfybe", "bfybe", "hfybe", "sofybu", "sbmyst", "sbmycr", "bmycg",
 "wfycrk", "hmycm", "wmybu", "bfybu", "smokev", "wfybu", "dwfylc1", "wfypro", "wmyconb", "wmybe", "wmypizz", "bmobar",
 "cwfyhb", "cwmofr", "cwmohb1", "cwmohb2", "cwmyfr", "cwmyhb1", "bmyboun", "wmyboun", "wmomib", "bmymib", "wmybell", "bmochil",
 "sofyri", "somyst", "vwmybjd", "vwfycrp", "sfr1", "sfr2", "sfr3", "bmybar", "wmybar", "wfysex", "wmyammo", "bmytatt",
 "vwmycr", "vbmocd", "vbmycr", "vhmycr", "sbmyri", "somyri", "somybu", "swmyst", "wmyva", "copgrl3", "gungrl3", "mecgrl3",
 "nurgrl3", "crogrl3", "gangrl3", "cwfofr", "cwfohb", "cwfyfr1", "cwfyfr2", "cwmyhb2", "dwfylc2", "dwmylc2", "omykara", "wmykara",
 "wfyburg", "vwmycd", "vhfypro", "suzie", "omonood", "omoboat", "wfyclot", "vwmotr1", "vwmotr2", "vwfywai", "sbfori", "swfyri",
 "wmyclot", "sbfost", "sbfyri", "sbmocd", "sbmori", "sbmost", "shmycr", "sofori", "sofost", "sofyst", "somobu", "somori",
 "somost", "swmotr5", "swfori", "swfost", "swfyst", "swmocd", "swmori", "swmost", "shfypro", "sbfypro", "swmotr4", "swmyri",
 "smyst", "smyst2", "sfypro", "vbfyst2", "vbfypro", "vhfyst3", "bikera", "bikerb", "bmypimp", "swmycr", "wfylg", "wmyva2",
 "bmosec", "bikdrug", "wmych", "sbfystr", "swfystr", "heck1", "heck2", "bmycon", "wmycd1", "bmocd", "vwfywa2", "wmoice",
 "tenpen", "pulaski", "Hernandez", "dwayne", "smoke", "sweet", "ryder", "forelli", "tbone", "laemt1", "lvemt1", "sfemt1",
 "lafd1", "lvfd1", "sffd1", "lapd1", "sfpd1", "lvpd1", "csher", "lapdm1", "swat", "fbi", "army", "dsher",
 "zero", "rose", "paul", "cesar", "ogloc", "wuzimu", "torino", "jizzy", "maddogg", "cat", "claude",}
NameSkin = {
    [0] = 'no skin',
    [1] = 'truth',
    [2] = 'maccer',
    [3] = 'andre',
    [4] = 'bbthin',
    [5] = 'bb',
    [6] = 'emmet',
    [7] = 'Male01',
    [8] = 'janitor',
    [9] = 'bfori',
    [10] = 'bfost',
    [11] = 'vbfycrp',
    [12] = 'bfyri',
    [13] = 'bfyst',
    [14] = 'bmori',
    [15] = 'bmost',
    [16] = 'bmyap',
    [17] = 'bmybu',
    [18] = 'bmybe',
    [19] = 'bmydj',
    [20] = 'bmyri',
    [21] = 'bmycr',
    [22] = 'bmyst',
    [23] = 'wmybmx',
    [24] = 'wbdyg1',
    [25] = 'wbdyg2',
    [26] = 'wmybp',
    [27] = 'wmycon',
    [28] = 'bmydrug',
    [29] = 'wmydrug',
    [30] = 'hmydrug',
    [31] = 'dwfolc',
    [32] = 'dwmolc1',
    [33] = 'dwmolc2',
    [34] = 'dwmylc1',
    [35] = 'hmogar',
    [36] = 'wmygol1',
    [37] = 'wmygol2',
    [38] = 'hfori',
    [39] = 'hfost',
    [40] = 'hfyri',
    [41] = 'hfyst',
    [42] = 'jethro',
    [43] = 'hmori',
    [44] = 'hmost',
    [45] = 'hmybe',
    [46] = 'hmyri',
    [47] = 'hmycr',
    [48] = 'hmyst',
    [49] = 'omokung',
    [50] = 'wmymech',
    [51] = 'bmymoun',
    [52] = 'wmymoun',
    [53] = 'Unknown',
    [54] = 'ofost',
    [55] = 'ofyri',
    [56] = 'ofyst',
    [57] = 'omori',
    [58] = 'omost',
    [59] = "omyri",
    [60] = 'omyst',
    [61] = 'wmyplt',
    [62] = 'wmopj',
    [63] = 'bfypro',
    [64] = 'hfypro',
    [65] = 'kendl',
    [66] = 'bmypol1',
    [67] = 'bmypol2',
    [68] = 'wmoprea',
    [69] = 'sbfyst',
    [70] = 'wmosci',
    [71] = 'wmysgrd',
    [72] = 'swmyhp1',
    [73] = 'swmyhp2',
    [74] = 'no skin',
    [75] = 'swfopro',
    [76] = 'wfystew',
    [77] = 'swmotr1',
    [78] = 'wmotr1',
    [79] = 'bmotr1',
    [80] = 'vbmybox',
    [81] = 'vwmybox',
    [82] = 'vhmyelv',
    [83] = 'vbmyelv',
    [84] = 'vimyelv',
    [85] = 'vwfypro',
    [86] = 'ryder3',
    [87] = 'vwfyst1',
    [88] = 'wfori',
    [89] = 'wfost',
    [90] = 'wfyjg',
    [91] = 'wfyri',
    [92] = 'wfyro',
    [93] = 'wfyst',
    [94] = 'wmori',
    [95] = 'wmost',
    [96] = 'wmyjg',
    [97] = 'wmylg',
    [98] = 'wmyri',
    [99] = 'wmyro',
    [100] = 'wmycr',
    [101] = 'wmyst',
    [102] = 'ballas1',
    [103] = 'ballas2',
    [104] = 'ballas3',
    [105] = 'fam1',
    [106] = 'fam2',
    [107] = 'fam3',
    [108] = 'lsv1',
    [109] = 'lsv2',
    [110] = 'lsv3',
    [111] = 'maffa',
    [112] = 'maffb',
    [113] = 'mafboss',
    [114] = 'vla1',
    [115] = 'vla2',
    [116] = 'vla3',
    [117] = 'triada',
    [118] = 'triadb',
    [119] = 'sindaco',
    [120] = 'triboss',
    [121] = 'dnb1',
    [122] = 'dnb2',
    [123] = 'dnb3',
    [124] = 'vmaff1',
    [125] = 'vmaff2',
    [126] = 'vmaff3',
    [127] = 'vmaff4',
    [128] = 'dnmylc',
    [129] = 'dnfolc1',
    [130] = 'dnfolc2',
    [131] = 'dnfylc',
    [132] = 'dnmolc1',
    [133] = 'dnmolc2',
    [134] = 'sbmotr2',
    [135] = 'swmotr2',
    [136] = 'sbmytr3',
    [137] = 'swmotr3',
    [138] = 'wfybe',
    [139] = 'bfybe',
    [140] = 'hfybe',
    [141] = 'sofybu',
    [142] = 'sbmyst',
    [143] = 'sbmycr',
    [144] = 'bmycg LA',
    [145] = 'wfycrk',
    [146] = 'hmycm',
    [147] = 'wmybu',
    [148] = 'bfybu',
    [149] = 'smokev',
    [150] = 'wfybu',
    [151] = 'dwfylc1',
    [152] = 'wfypro',
    [153] = 'wmyconb',
    [154] = 'wmybe',
    [155] = 'wmypizz',
    [156] = 'bmobar',
    [157] = 'cwfyhb',
    [158] = 'cwmofr',
    [159] = 'cwmohb1',
    [160] = 'cwmohb2',
    [161] = 'cwmyfr',
    [162] = 'cwmyhb1',
    [163] = 'bmyboun',
    [164] = 'wmyboun',
    [165] = 'wmomib',
    [166] = 'bmymib',
    [167] = 'wmybell',
    [168] = 'bmochil',
    [169] = 'sofyri',
    [170] = 'somyst',
    [171] = 'vwmybjd',
    [172] = 'vwfycrp',
    [173] = 'sfr1',
    [174] = 'sfr2',
    [175] = 'sfr3',
    [176] = 'bmybar',
    [177] = 'wmybar',
    [178] = 'wfysex',
    [179] = 'wmyammo',
    [180] = 'bmytatt',
    [181] = 'vwmycr',
    [182] = 'vbmocd',
    [183] = 'vbmycr',
    [184] = 'vhmycr',
    [185] = 'sbmyri',
    [186] = 'somyri',
    [187] = 'somybu',
    [188] = 'swmyst',
    [189] = 'wmyva',
    [190] = 'copgrl3',
    [191] = 'gungrl3',
    [192] = 'mecgrl3',
    [193] = 'nurgrl3',
    [194] = 'crogrl3',
    [195] = 'gangrl3',
    [196] = 'cwfofr',
    [197] = 'cwfohb',
    [198] = 'cwfyfr1',
    [199] = 'cwfyfr2',
    [200] = 'cwmyhb2',
    [201] = 'dwfylc2',
    [202] = 'dwmylc2',
    [203] = 'omykara',
    [204] = 'wmykara',
    [205] = 'wfyburg',
    [206] = 'vwmycd',
    [207] = 'vhfypro',
    [208] = 'suzie',
    [209] = 'omonood',
    [210] = 'omoboat',
    [211] = 'wfyclot',
    [212] = 'vwmotr1',
    [213] = 'vwmotr2',
    [214] = 'vwfywai',
    [215] = 'sbfori',
    [216] = 'swfyri',
    [217] = 'wmyclot',
    [218] = 'sbfost',
    [219] = 'sbfyri',
    [220] = 'sbmocd',
    [221] = 'sbmori',
    [222] = 'sbmost',
    [223] = 'shmycr',
    [224] = 'sofori',
    [225] = 'sofost',
    [226] = 'sofyst',
    [227] = 'somobu',
    [228] = 'somori',
    [229] = 'somost',
    [230] = 'swmotr5',
    [231] = 'swfori',
    [232] = 'swfost',
    [233] = 'swfyst',
    [234] = 'swmocd',
    [235] = 'swmori',
    [236] = 'swmost',
    [237] = 'shfypro',
    [238] = 'sbfypro',
    [239] = 'swmotr4',
    [240] = 'swmyri',
    [241] = 'smyst',
    [242] = 'smyst2',
    [243] = 'sfypro',
    [244] = 'vbfyst2',
    [245] = 'vbfypro',
    [246] = 'vhfyst3',
    [247] = 'bikera',
    [248] = 'bikerb',
    [249] = 'bmypimp',
    [250] = 'swmycr',
    [251] = 'wfylg',
    [252] = 'wmyva2',
    [253] = 'bmosec',
    [254] = 'bikdrug',
    [255] = 'wmych',
    [256] = 'sbfystr',
    [257] = 'swfystr',
    [258] = 'heck1',
    [259] = 'heck2',
    [260] = 'bmycon',
    [261] = 'wmycd1',
    [262] = 'bmocd',
    [263] = 'vwfywa2',
    [264] = 'wmoice',
    [265] = 'tenpen',
    [266] = 'pulaski',
    [267] = 'Hernandez',
    [268] = 'dwayne',
    [269] = 'smoke',
    [270] = 'sweet',
    [271] = 'ryder',
    [272] = 'forelli',
    [273] = 'tbone',
    [274] = 'laemt1',
    [275] = 'lvemt1',
    [276] = 'sfemt1',
    [277] = 'lafd1',
    [278] = 'lvfd1',
    [279] = 'sffd1',
    [280] = 'lapd1',
    [281] = 'sfpd1',
    [282] = 'lvpd1',
    [283] = 'csher',
    [284] = 'lapdm1',
    [285] = 'swat',
    [286] = 'fbi',
    [287] = 'army',
    [288] = 'dsher',
    [289] = 'zero',
    [290] = 'rose',
    [291] = 'paul',
    [292] = 'cesar',
    [293] = 'ogloc',
    [294] = "wuzimu",
    [295] = 'torino',
    [296] = 'jizzy',
    [297] = 'maddogg',
    [298] = 'Catalina',
    [299] = 'claude',
  }

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('inf', function()
        renderWindow[0] = not renderWindow[0]
    end)
    
    sampAddChatMessage(tag .. "{FFFFFF}Версия скрипта 1.1 успешно загружена | Для Администраторов {FF0000}Advance {FFFFFF}выдача траспорта/скина доступна с 4 lvl'a", 0xFF0000)
    sampAddChatMessage(tag1 .. "{FFFFFF}Для вывода информации используйте команду {008000}/inf", 0xFF0000)
    
    while true do
        wait(0)
        
    end
end

imgui.OnInitialize(function()
    imgui.GetIO().IniFilename = nil
    tCars = {}
    for i = 400, 611, 1 do
        tCars[i] = imgui.CreateTextureFromFile(getGameDirectory() .. "\\moonloader\\images\\Vehicle_" .. i .. ".jpg")
    end
end)

imgui.OnInitialize(function()
    imgui.GetIO().IniFilename = nil
    tSkin = {}
    for i = 0, 299, 1 do
        tSkin[i] = imgui.CreateTextureFromFile(getGameDirectory() .. "\\moonloader\\skins\\Skin_" .. i .. ".png")
    end
end)

function getNameVehicleModel(id)
    local name
    if NameCar[id] ~= nil then
        name = NameCar[id]
    else
        name = u8'Неизвестно'
    end
    return name
end

function getNameVehicleModel(id)
    local name
    if NameSkin[id] ~= nil then
        name = NameSkin[id]
    else
        name = 'Неизвестно'
    end
    return name
end

local newFrame = imgui.OnFrame(
    function() return renderWindow[0] end,
    
    
    function(self)
        local resX, resY = getScreenResolution()
        local sizeX, sizeY = 1180, 600
        imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
        imgui.Begin(u8'ID Автомобилей | скинов v: 1.1 · by Ackerman ®', renderWindow, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)

        imgui.CenterTextColored(imgui.ImVec4(1,1,1,1), u8"Выберите нужный ID.")
        imgui.BeginChild("Window1", imgui.ImVec2(770, 540), true)
            imgui.Text(u8"Список транспорта с картинками:")
            imgui.Separator()
        kl = 0
        posvehx = 5
        posvehy = 60
        postextx = 10
        postexty = 145

        for i = 400, 611, 1 do
            imgui.SetCursorPos(imgui.ImVec2(posvehx, posvehy))
            imgui.BeginChild("##clickzona" .. i, imgui.ImVec2(115, 80))
            imgui.EndChild()

            if imgui.IsItemClicked() then
                sampSendChat("/vec " .. i .. " 0 0")

                renderWindow[0] = true
            end

            imgui.SetCursorPos(imgui.ImVec2(posvehx, posvehy))
            imgui.Image(tCars[i], imgui.ImVec2(115, 80))

            if imgui.IsItemHovered() then
            imgui.SetCursorPos(imgui.ImVec2(posvehx, posvehy))
            imgui.Image(tCars[i], imgui.ImVec2(120, 85))
            imgui.BeginTooltip()
            imgui.TextUnformatted(u8"\nТранспорт: " .. getNameVehicleModel(i) .. "[" .. i .. "]")
            imgui.EndTooltip()
            end

            imgui.SetCursorPos(imgui.ImVec2(postextx, postexty))
            imgui.Text(getNameVehicleModel(i) .. "[" .. i .. "]")

            postextx = postextx + 130
            posvehx = posvehx + 130
            kl = kl + 1

            if kl > 5 then
            kl = 0
            posvehx = 5
            postextx = 10
            posvehy = posvehy + 110
            postexty = posvehy + 90
            end
        end
                
        imgui.EndChild()
        
        imgui.SameLine()
        
            imgui.BeginChild("Window", imgui.ImVec2(390, 540), true)
                imgui.Text(u8"Список скинов с картинками:")
            
                imgui.Separator()
                kl = 0
                posvehx = 5
                posvehy = 60
                postextx = 10
                postexty = 145

                for i = 0, 299, 1 do
                    imgui.SetCursorPos(imgui.ImVec2(posvehx, posvehy))
                    imgui.BeginChild("##clickzona" .. i, imgui.ImVec2(50, 80))
                    imgui.EndChild()

                    if imgui.IsItemClicked(1) then
                        sampSendChat("/skin " .. "")

                        renderWindow[0] = true
                    end

                    imgui.SetCursorPos(imgui.ImVec2(posvehx, posvehy))
                    imgui.Image(tSkin[i], imgui.ImVec2(50, 80))

                    if imgui.IsItemHovered() then
                    imgui.SetCursorPos(imgui.ImVec2(posvehx, posvehy))
                    imgui.Image(tSkin[i], imgui.ImVec2(55, 85))
                    imgui.BeginTooltip()
                    imgui.TextUnformatted(u8"\nСкин: " .. getNameVehicleModel(i) .. "[" .. i .. "]")
                    imgui.EndTooltip()
                    end

                    imgui.SetCursorPos(imgui.ImVec2(postextx, postexty))
                    imgui.Text(getNameVehicleModel(i) .. "[" .. i .. "]")

                    postextx = postextx + 145
                    posvehx = posvehx + 145
                    kl = kl + 1

                    if kl > 2 then
                    kl = 0
                    posvehx = 5
                    postextx = 10
                    posvehy = posvehy + 110
                    postexty = posvehy + 90
                    end
                end
                imgui.End()
            imgui.EndChild()
        
    end
)