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

ШPEK

Известный
1,476
525
InputText вместо Input
Поставил InputText вместо Input, игра начала крашить опять...
Lua:
local imgui = require "imgui"
require "lib.moonloader"
local encoding = require "encoding"
local key = require "vkeys"
u8 = encoding.UTF8
encoding.default = "CP1251"

local doing = {
    {
    title = "{FF6666}Лечить",
    submenu = {
        {
        title = "{FF6666}Лечить голову",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me швыряясь в сумке нашёл таблетки \"Аспирин\"")
        wait(1500)
        sampSendChat("/me передал таблетки \"Аспирин\" человеку напротив")
        wait(1000)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        },
        {
        title = "{FF6666}Лечить живот",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me швыряясь в сумке нашёл таблетки \"Мезим\"")
        wait(1500)
        sampSendChat("/me передал таблетки человеку напротив")
        wait(100)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        },
        {
        title = "{FF6666}Универсальное лечение",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me достал нужный медикамент из сумки")
        wait(1500)
        sampSendChat("/me передал медикамент человеку напротив")
        wait(100)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        }
    }
    },
    {
    title = "{FF6666}Сделать укол",
    onclick = function()
    sampSendChat("/me открыл коробочку с новым шприцом")
    wait(1500)
    sampSendChat("/me выкинул коробочку в урну")
    wait(1500)
    sampSendChat("/me взяв баночку со спиртом со стола, стерелизовал руку пациента")
    wait(1500)
    sampSendChat("/me воткнул шприц в вену, введя препарат")
    wait(1500)
    sampSendChat("/me вытащив шприц, выкинул его в урну")
    wait(1500)
    sampSendChat("/inject "..id)
    end
    },
    {
    title = "{FF6666}Сделать операцию",
    onclick = function()
    sampSendChat("/me взял перчатки и маску со стола и надел маску и перчатки")
    wait(1500)
    sampSendChat("/do Маска для наркоза висит на подставке.")
    wait(1500)
    sampSendChat("/me взяв маску для наркоза в правую руку, надела её на лицо пациента")
    wait(1500)
    sampSendChat("/me включил подачу наркоза")
    wait(1500)
    sampSendChat("/do Наркоз действует.")
    wait(1500)
    sampSendChat("/me взяв скальпель в руку, аккуратным движением сделал надрез")
    wait(1500)
    sampSendChat("/me начал процесс операции")
    wait(5000)
    sampSendChat("/me взяв медицинскую нитку и иголку, начал зашивать рану")
    wait(1500)
    sampSendChat("/do Операция проведена.")
    wait(1500)
    sampSendChat("/me привёл пациента в сознание")
    wait(1500)
    sampSendChat("Процесс операции окончен, всё прошло успешно.")
    end
    },
    {
    title = "{66CCFF}Начать мед.осмотр",
    onclick = function()
    sampSendChat("Здравствуйте, сейчас я проведу медицинский осмотр.")
    wait(1500)
    sampSendChat("Хорошо, будьте добры встать к стене.")
    wait(1000)
    sampAddChatMessage("Нажмите NumPad7 чтобы продолжить осмотр", -1)
    repeat
    wait(0)
    until isKeyJustPressed(VK_7)
    sampSendChat("/do На столе лежат тонкие перчатки.")
    wait(1500)
    sampSendChat("/me взял тонкие перчатки со стола")
    wait(1500)
    sampSendChat("/me надел перчатки на руки")
    wait(1500)
    sampSendChat("/do Перчатки на руках.")
    wait(1500)
    sampSendChat("/me приступил к медицинскому осмотру")
    wait(1500)
    sampSendChat("/me провел голову на наличие вшей")
    wait(1500)
    sampSendChat("/me прощупал живот и половой орган человека")
    wait(1500)
    sampSendChat("/do Медицинская карта лежит на столе.")
    wait(1500)
    sampSendChat("/me взял медицинскую карту со стола")
    wait(1500)
    sampSendChat("/do На столе лежит ручка.")
    wait(1500)
    sampSendChat("/me взял ручку со стола")
    wait(1500)
    sampSendChat("/me поставил галочку на против строки \"Здоров\"")
    wait(1500)
    sampSendChat("/me поставил подпись в граффе \"Подпись врача\"")
    wait(1500)
    sampSendChat("/me положив ручку на стол, взял со стола печать \""..bolnica.."\"")
    wait(1500)
    sampSendChat("/me поставив печать \""..bolnica.."\"")
    wait(1500)
    sampSendChat("/me передал медицинскую карту пациенту ")
    wait(100)
    sampSendChat("/oldanim 6")
    wait(3000)
    sampSendChat("/medcard "..id)
    end
    }
}

local imbool = imgui.ImBool(false)
local bolnica = imgui.ImInt(0)
local cena = imgui.ImInt(0)
local nick = imgui.ImBuffer(257)
function imgui.OnDrawFrame()
    if imbool.v then
        imgui.SetNextWindowSize(imgui.ImVec2(150, 200), imgui.Cond.FirstUseEver)
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.Begin(u8"Ministry Ambulance Helper", imbool)
        imgui.Combo("Выбери свою больницу", bolnica, {"Лос-Сантос", "Сан-Фиерро", "Лас-Вентруас"})
        imgui.InputText("Введи свой ник (без _)", nick)
        imgui.InputInt("Введи ценовую политику", politica)
    end
end

function main()
while not isSampAvailable() do wait(100) end
    while true do
        wait(0)
        if isKeyJustPressed(key.VK_7) then
            imbool.v = not imbool.v
        end
        imgui.Process = imbool.v
        local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if valid and doesCharExist(ped) then
                local result, id = sampGetPlayerIdByCharHandle(ped)
                    if result and isKeyJustPressed(key.VK_1) and isKeyJustPressed(key.VK_LMENU) then
                        submenus_show("Взаимодействие с персонажем", doing, "Выбрать", _, "Назад")
                    end
            end
    end
end

function submenus_show(menu, caption, select_button, close_button, back_button)
    select_button, close_button, back_button = select_button or 'Select', close_button or 'Close', back_button or 'Back'
    prev_menus = {}
    function display(menu, id, caption)
        local string_list = {}
        for i, v in ipairs(menu) do
            table.insert(string_list, type(v.submenu) == 'table' and v.title .. '  >>' or v.title)
        end
        sampShowDialog(id, caption, table.concat(string_list, '\n'), select_button, (#prev_menus > 0) and back_button or close_button, sf.DIALOG_STYLE_LIST)
        repeat
            wait(0)
            local result, button, list = sampHasDialogRespond(id)
            if result then
                if button == 1 and list ~= -1 then
                    local item = menu[list + 1]
                    if type(item.submenu) == 'table' then -- submenu
                        table.insert(prev_menus, {menu = menu, caption = caption})
                        if type(item.onclick) == 'function' then
                            item.onclick(menu, list + 1, item.submenu)
                        end
                        return display(item.submenu, id + 1, item.submenu.title and item.submenu.title or item.title)
                    elseif type(item.onclick) == 'function' then
                        local result = item.onclick(menu, list + 1)
                        if not result then return result end
                        return display(menu, id, caption)
                    end
                else -- if button == 0
                    if #prev_menus > 0 then
                        local prev_menu = prev_menus[#prev_menus]
                        prev_menus[#prev_menus] = nil
                        return display(prev_menu.menu, id - 1, prev_menu.caption)
                    end
                    return false
                end
            end
        until result
    end
    return display(menu, 31337, caption or menu.title)
end
 

Musaigen

abobusnik
Проверенный
1,585
1,309
Поставил InputText вместо Input, игра начала крашить опять...
Lua:
local imgui = require "imgui"
require "lib.moonloader"
local encoding = require "encoding"
local key = require "vkeys"
u8 = encoding.UTF8
encoding.default = "CP1251"

local doing = {
    {
    title = "{FF6666}Лечить",
    submenu = {
        {
        title = "{FF6666}Лечить голову",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me швыряясь в сумке нашёл таблетки \"Аспирин\"")
        wait(1500)
        sampSendChat("/me передал таблетки \"Аспирин\" человеку напротив")
        wait(1000)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        },
        {
        title = "{FF6666}Лечить живот",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me швыряясь в сумке нашёл таблетки \"Мезим\"")
        wait(1500)
        sampSendChat("/me передал таблетки человеку напротив")
        wait(100)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        },
        {
        title = "{FF6666}Универсальное лечение",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me достал нужный медикамент из сумки")
        wait(1500)
        sampSendChat("/me передал медикамент человеку напротив")
        wait(100)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        }
    }
    },
    {
    title = "{FF6666}Сделать укол",
    onclick = function()
    sampSendChat("/me открыл коробочку с новым шприцом")
    wait(1500)
    sampSendChat("/me выкинул коробочку в урну")
    wait(1500)
    sampSendChat("/me взяв баночку со спиртом со стола, стерелизовал руку пациента")
    wait(1500)
    sampSendChat("/me воткнул шприц в вену, введя препарат")
    wait(1500)
    sampSendChat("/me вытащив шприц, выкинул его в урну")
    wait(1500)
    sampSendChat("/inject "..id)
    end
    },
    {
    title = "{FF6666}Сделать операцию",
    onclick = function()
    sampSendChat("/me взял перчатки и маску со стола и надел маску и перчатки")
    wait(1500)
    sampSendChat("/do Маска для наркоза висит на подставке.")
    wait(1500)
    sampSendChat("/me взяв маску для наркоза в правую руку, надела её на лицо пациента")
    wait(1500)
    sampSendChat("/me включил подачу наркоза")
    wait(1500)
    sampSendChat("/do Наркоз действует.")
    wait(1500)
    sampSendChat("/me взяв скальпель в руку, аккуратным движением сделал надрез")
    wait(1500)
    sampSendChat("/me начал процесс операции")
    wait(5000)
    sampSendChat("/me взяв медицинскую нитку и иголку, начал зашивать рану")
    wait(1500)
    sampSendChat("/do Операция проведена.")
    wait(1500)
    sampSendChat("/me привёл пациента в сознание")
    wait(1500)
    sampSendChat("Процесс операции окончен, всё прошло успешно.")
    end
    },
    {
    title = "{66CCFF}Начать мед.осмотр",
    onclick = function()
    sampSendChat("Здравствуйте, сейчас я проведу медицинский осмотр.")
    wait(1500)
    sampSendChat("Хорошо, будьте добры встать к стене.")
    wait(1000)
    sampAddChatMessage("Нажмите NumPad7 чтобы продолжить осмотр", -1)
    repeat
    wait(0)
    until isKeyJustPressed(VK_7)
    sampSendChat("/do На столе лежат тонкие перчатки.")
    wait(1500)
    sampSendChat("/me взял тонкие перчатки со стола")
    wait(1500)
    sampSendChat("/me надел перчатки на руки")
    wait(1500)
    sampSendChat("/do Перчатки на руках.")
    wait(1500)
    sampSendChat("/me приступил к медицинскому осмотру")
    wait(1500)
    sampSendChat("/me провел голову на наличие вшей")
    wait(1500)
    sampSendChat("/me прощупал живот и половой орган человека")
    wait(1500)
    sampSendChat("/do Медицинская карта лежит на столе.")
    wait(1500)
    sampSendChat("/me взял медицинскую карту со стола")
    wait(1500)
    sampSendChat("/do На столе лежит ручка.")
    wait(1500)
    sampSendChat("/me взял ручку со стола")
    wait(1500)
    sampSendChat("/me поставил галочку на против строки \"Здоров\"")
    wait(1500)
    sampSendChat("/me поставил подпись в граффе \"Подпись врача\"")
    wait(1500)
    sampSendChat("/me положив ручку на стол, взял со стола печать \""..bolnica.."\"")
    wait(1500)
    sampSendChat("/me поставив печать \""..bolnica.."\"")
    wait(1500)
    sampSendChat("/me передал медицинскую карту пациенту ")
    wait(100)
    sampSendChat("/oldanim 6")
    wait(3000)
    sampSendChat("/medcard "..id)
    end
    }
}

local imbool = imgui.ImBool(false)
local bolnica = imgui.ImInt(0)
local cena = imgui.ImInt(0)
local nick = imgui.ImBuffer(257)
function imgui.OnDrawFrame()
    if imbool.v then
        imgui.SetNextWindowSize(imgui.ImVec2(150, 200), imgui.Cond.FirstUseEver)
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.Begin(u8"Ministry Ambulance Helper", imbool)
        imgui.Combo("Выбери свою больницу", bolnica, {"Лос-Сантос", "Сан-Фиерро", "Лас-Вентруас"})
        imgui.InputText("Введи свой ник (без _)", nick)
        imgui.InputInt("Введи ценовую политику", politica)
    end
end

function main()
while not isSampAvailable() do wait(100) end
    while true do
        wait(0)
        if isKeyJustPressed(key.VK_7) then
            imbool.v = not imbool.v
        end
        imgui.Process = imbool.v
        local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if valid and doesCharExist(ped) then
                local result, id = sampGetPlayerIdByCharHandle(ped)
                    if result and isKeyJustPressed(key.VK_1) and isKeyJustPressed(key.VK_LMENU) then
                        submenus_show("Взаимодействие с персонажем", doing, "Выбрать", _, "Назад")
                    end
            end
    end
end

function submenus_show(menu, caption, select_button, close_button, back_button)
    select_button, close_button, back_button = select_button or 'Select', close_button or 'Close', back_button or 'Back'
    prev_menus = {}
    function display(menu, id, caption)
        local string_list = {}
        for i, v in ipairs(menu) do
            table.insert(string_list, type(v.submenu) == 'table' and v.title .. '  >>' or v.title)
        end
        sampShowDialog(id, caption, table.concat(string_list, '\n'), select_button, (#prev_menus > 0) and back_button or close_button, sf.DIALOG_STYLE_LIST)
        repeat
            wait(0)
            local result, button, list = sampHasDialogRespond(id)
            if result then
                if button == 1 and list ~= -1 then
                    local item = menu[list + 1]
                    if type(item.submenu) == 'table' then -- submenu
                        table.insert(prev_menus, {menu = menu, caption = caption})
                        if type(item.onclick) == 'function' then
                            item.onclick(menu, list + 1, item.submenu)
                        end
                        return display(item.submenu, id + 1, item.submenu.title and item.submenu.title or item.title)
                    elseif type(item.onclick) == 'function' then
                        local result = item.onclick(menu, list + 1)
                        if not result then return result end
                        return display(menu, id, caption)
                    end
                else -- if button == 0
                    if #prev_menus > 0 then
                        local prev_menu = prev_menus[#prev_menus]
                        prev_menus[#prev_menus] = nil
                        return display(prev_menu.menu, id - 1, prev_menu.caption)
                    end
                    return false
                end
            end
        until result
    end
    return display(menu, 31337, caption or menu.title)
end
Переменная politika сьебалась.

UPD. politica*
UPD [20:22]. Скидывай код, я не ванга.
 
Последнее редактирование:
  • Нравится
Реакции: ШPEK

ШPEK

Известный
1,476
525
Переменная politika сьебалась.

UPD. politica*
upload_2018-7-14_21-22-1.png
 

ШPEK

Известный
1,476
525
Переменная politika сьебалась.

UPD. politica*
UPD [20:22]. Скидывай код, я не ванга.
Lua:
local imgui = require "imgui"
require "lib.moonloader"
local encoding = require "encoding"
local key = require "vkeys"
u8 = encoding.UTF8
encoding.default = "CP1251"

local doing = {
    {
    title = "{FF6666}Лечить",
    submenu = {
        {
        title = "{FF6666}Лечить голову",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me швыряясь в сумке нашёл таблетки \"Аспирин\"")
        wait(1500)
        sampSendChat("/me передал таблетки \"Аспирин\" человеку напротив")
        wait(1000)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        },
        {
        title = "{FF6666}Лечить живот",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me швыряясь в сумке нашёл таблетки \"Мезим\"")
        wait(1500)
        sampSendChat("/me передал таблетки человеку напротив")
        wait(100)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        },
        {
        title = "{FF6666}Универсальное лечение",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me достал нужный медикамент из сумки")
        wait(1500)
        sampSendChat("/me передал медикамент человеку напротив")
        wait(100)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        }
    }
    },
    {
    title = "{FF6666}Сделать укол",
    onclick = function()
    sampSendChat("/me открыл коробочку с новым шприцом")
    wait(1500)
    sampSendChat("/me выкинул коробочку в урну")
    wait(1500)
    sampSendChat("/me взяв баночку со спиртом со стола, стерелизовал руку пациента")
    wait(1500)
    sampSendChat("/me воткнул шприц в вену, введя препарат")
    wait(1500)
    sampSendChat("/me вытащив шприц, выкинул его в урну")
    wait(1500)
    sampSendChat("/inject "..id)
    end
    },
    {
    title = "{FF6666}Сделать операцию",
    onclick = function()
    sampSendChat("/me взял перчатки и маску со стола и надел маску и перчатки")
    wait(1500)
    sampSendChat("/do Маска для наркоза висит на подставке.")
    wait(1500)
    sampSendChat("/me взяв маску для наркоза в правую руку, надела её на лицо пациента")
    wait(1500)
    sampSendChat("/me включил подачу наркоза")
    wait(1500)
    sampSendChat("/do Наркоз действует.")
    wait(1500)
    sampSendChat("/me взяв скальпель в руку, аккуратным движением сделал надрез")
    wait(1500)
    sampSendChat("/me начал процесс операции")
    wait(5000)
    sampSendChat("/me взяв медицинскую нитку и иголку, начал зашивать рану")
    wait(1500)
    sampSendChat("/do Операция проведена.")
    wait(1500)
    sampSendChat("/me привёл пациента в сознание")
    wait(1500)
    sampSendChat("Процесс операции окончен, всё прошло успешно.")
    end
    },
    {
    title = "{66CCFF}Начать мед.осмотр",
    onclick = function()
    sampSendChat("Здравствуйте, сейчас я проведу медицинский осмотр.")
    wait(1500)
    sampSendChat("Хорошо, будьте добры встать к стене.")
    wait(1000)
    sampAddChatMessage("Нажмите NumPad7 чтобы продолжить осмотр", -1)
    repeat
    wait(0)
    until isKeyJustPressed(VK_7)
    sampSendChat("/do На столе лежат тонкие перчатки.")
    wait(1500)
    sampSendChat("/me взял тонкие перчатки со стола")
    wait(1500)
    sampSendChat("/me надел перчатки на руки")
    wait(1500)
    sampSendChat("/do Перчатки на руках.")
    wait(1500)
    sampSendChat("/me приступил к медицинскому осмотру")
    wait(1500)
    sampSendChat("/me провел голову на наличие вшей")
    wait(1500)
    sampSendChat("/me прощупал живот и половой орган человека")
    wait(1500)
    sampSendChat("/do Медицинская карта лежит на столе.")
    wait(1500)
    sampSendChat("/me взял медицинскую карту со стола")
    wait(1500)
    sampSendChat("/do На столе лежит ручка.")
    wait(1500)
    sampSendChat("/me взял ручку со стола")
    wait(1500)
    sampSendChat("/me поставил галочку на против строки \"Здоров\"")
    wait(1500)
    sampSendChat("/me поставил подпись в граффе \"Подпись врача\"")
    wait(1500)
    sampSendChat("/me положив ручку на стол, взял со стола печать \""..bolnica.."\"")
    wait(1500)
    sampSendChat("/me поставив печать \""..bolnica.."\"")
    wait(1500)
    sampSendChat("/me передал медицинскую карту пациенту ")
    wait(100)
    sampSendChat("/oldanim 6")
    wait(3000)
    sampSendChat("/medcard "..id)
    end
    }
}

local imbool = imgui.ImBool(false)
local bolnica = imgui.ImInt(0)
local cena = imgui.ImInt(0)
local nick = imgui.ImBuffer(257)
function imgui.OnDrawFrame()
    if imbool.v then
        imgui.SetNextWindowSize(imgui.ImVec2(150, 200), imgui.Cond.FirstUseEver)
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.Begin(u8"Ministry Ambulance Helper", imbool)
        imgui.Combo("Выбери свою больницу", bolnica, {"Лос-Сантос", "Сан-Фиерро", "Лас-Вентруас"})
        imgui.InputText("Введи свой ник (без _)", nick)
        imgui.InputInt("Введи ценовую политику", cena)
    end
end

function main()
while not isSampAvailable() do wait(100) end
    while true do
        wait(0)
        if isKeyJustPressed(key.VK_7) then
            imbool.v = not imbool.v
        end
        imgui.Process = imbool.v
        local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if valid and doesCharExist(ped) then
                local result, id = sampGetPlayerIdByCharHandle(ped)
                    if result and isKeyJustPressed(key.VK_1) and isKeyJustPressed(key.VK_LMENU) then
                        submenus_show("Взаимодействие с персонажем", doing, "Выбрать", _, "Назад")
                    end
            end
    end
end

function submenus_show(menu, caption, select_button, close_button, back_button)
    select_button, close_button, back_button = select_button or 'Select', close_button or 'Close', back_button or 'Back'
    prev_menus = {}
    function display(menu, id, caption)
        local string_list = {}
        for i, v in ipairs(menu) do
            table.insert(string_list, type(v.submenu) == 'table' and v.title .. '  >>' or v.title)
        end
        sampShowDialog(id, caption, table.concat(string_list, '\n'), select_button, (#prev_menus > 0) and back_button or close_button, sf.DIALOG_STYLE_LIST)
        repeat
            wait(0)
            local result, button, list = sampHasDialogRespond(id)
            if result then
                if button == 1 and list ~= -1 then
                    local item = menu[list + 1]
                    if type(item.submenu) == 'table' then -- submenu
                        table.insert(prev_menus, {menu = menu, caption = caption})
                        if type(item.onclick) == 'function' then
                            item.onclick(menu, list + 1, item.submenu)
                        end
                        return display(item.submenu, id + 1, item.submenu.title and item.submenu.title or item.title)
                    elseif type(item.onclick) == 'function' then
                        local result = item.onclick(menu, list + 1)
                        if not result then return result end
                        return display(menu, id, caption)
                    end
                else -- if button == 0
                    if #prev_menus > 0 then
                        local prev_menu = prev_menus[#prev_menus]
                        prev_menus[#prev_menus] = nil
                        return display(prev_menu.menu, id - 1, prev_menu.caption)
                    end
                    return false
                end
            end
        until result
    end
    return display(menu, 31337, caption or menu.title)
end
 

Musaigen

abobusnik
Проверенный
1,585
1,309
Lua:
local imgui = require "imgui"
require "lib.moonloader"
local encoding = require "encoding"
local key = require "vkeys"
u8 = encoding.UTF8
encoding.default = "CP1251"

local doing = {
    {
    title = "{FF6666}Лечить",
    submenu = {
        {
        title = "{FF6666}Лечить голову",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me швыряясь в сумке нашёл таблетки \"Аспирин\"")
        wait(1500)
        sampSendChat("/me передал таблетки \"Аспирин\" человеку напротив")
        wait(1000)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        },
        {
        title = "{FF6666}Лечить живот",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me швыряясь в сумке нашёл таблетки \"Мезим\"")
        wait(1500)
        sampSendChat("/me передал таблетки человеку напротив")
        wait(100)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        },
        {
        title = "{FF6666}Универсальное лечение",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me достал нужный медикамент из сумки")
        wait(1500)
        sampSendChat("/me передал медикамент человеку напротив")
        wait(100)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        }
    }
    },
    {
    title = "{FF6666}Сделать укол",
    onclick = function()
    sampSendChat("/me открыл коробочку с новым шприцом")
    wait(1500)
    sampSendChat("/me выкинул коробочку в урну")
    wait(1500)
    sampSendChat("/me взяв баночку со спиртом со стола, стерелизовал руку пациента")
    wait(1500)
    sampSendChat("/me воткнул шприц в вену, введя препарат")
    wait(1500)
    sampSendChat("/me вытащив шприц, выкинул его в урну")
    wait(1500)
    sampSendChat("/inject "..id)
    end
    },
    {
    title = "{FF6666}Сделать операцию",
    onclick = function()
    sampSendChat("/me взял перчатки и маску со стола и надел маску и перчатки")
    wait(1500)
    sampSendChat("/do Маска для наркоза висит на подставке.")
    wait(1500)
    sampSendChat("/me взяв маску для наркоза в правую руку, надела её на лицо пациента")
    wait(1500)
    sampSendChat("/me включил подачу наркоза")
    wait(1500)
    sampSendChat("/do Наркоз действует.")
    wait(1500)
    sampSendChat("/me взяв скальпель в руку, аккуратным движением сделал надрез")
    wait(1500)
    sampSendChat("/me начал процесс операции")
    wait(5000)
    sampSendChat("/me взяв медицинскую нитку и иголку, начал зашивать рану")
    wait(1500)
    sampSendChat("/do Операция проведена.")
    wait(1500)
    sampSendChat("/me привёл пациента в сознание")
    wait(1500)
    sampSendChat("Процесс операции окончен, всё прошло успешно.")
    end
    },
    {
    title = "{66CCFF}Начать мед.осмотр",
    onclick = function()
    sampSendChat("Здравствуйте, сейчас я проведу медицинский осмотр.")
    wait(1500)
    sampSendChat("Хорошо, будьте добры встать к стене.")
    wait(1000)
    sampAddChatMessage("Нажмите NumPad7 чтобы продолжить осмотр", -1)
    repeat
    wait(0)
    until isKeyJustPressed(VK_7)
    sampSendChat("/do На столе лежат тонкие перчатки.")
    wait(1500)
    sampSendChat("/me взял тонкие перчатки со стола")
    wait(1500)
    sampSendChat("/me надел перчатки на руки")
    wait(1500)
    sampSendChat("/do Перчатки на руках.")
    wait(1500)
    sampSendChat("/me приступил к медицинскому осмотру")
    wait(1500)
    sampSendChat("/me провел голову на наличие вшей")
    wait(1500)
    sampSendChat("/me прощупал живот и половой орган человека")
    wait(1500)
    sampSendChat("/do Медицинская карта лежит на столе.")
    wait(1500)
    sampSendChat("/me взял медицинскую карту со стола")
    wait(1500)
    sampSendChat("/do На столе лежит ручка.")
    wait(1500)
    sampSendChat("/me взял ручку со стола")
    wait(1500)
    sampSendChat("/me поставил галочку на против строки \"Здоров\"")
    wait(1500)
    sampSendChat("/me поставил подпись в граффе \"Подпись врача\"")
    wait(1500)
    sampSendChat("/me положив ручку на стол, взял со стола печать \""..bolnica.."\"")
    wait(1500)
    sampSendChat("/me поставив печать \""..bolnica.."\"")
    wait(1500)
    sampSendChat("/me передал медицинскую карту пациенту ")
    wait(100)
    sampSendChat("/oldanim 6")
    wait(3000)
    sampSendChat("/medcard "..id)
    end
    }
}

local imbool = imgui.ImBool(false)
local bolnica = imgui.ImInt(0)
local cena = imgui.ImInt(0)
local nick = imgui.ImBuffer(257)
function imgui.OnDrawFrame()
    if imbool.v then
        imgui.SetNextWindowSize(imgui.ImVec2(150, 200), imgui.Cond.FirstUseEver)
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.Begin(u8"Ministry Ambulance Helper", imbool)
        imgui.Combo("Выбери свою больницу", bolnica, {"Лос-Сантос", "Сан-Фиерро", "Лас-Вентруас"})
        imgui.InputText("Введи свой ник (без _)", nick)
        imgui.InputInt("Введи ценовую политику", cena)
    end
end

function main()
while not isSampAvailable() do wait(100) end
    while true do
        wait(0)
        if isKeyJustPressed(key.VK_7) then
            imbool.v = not imbool.v
        end
        imgui.Process = imbool.v
        local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if valid and doesCharExist(ped) then
                local result, id = sampGetPlayerIdByCharHandle(ped)
                    if result and isKeyJustPressed(key.VK_1) and isKeyJustPressed(key.VK_LMENU) then
                        submenus_show("Взаимодействие с персонажем", doing, "Выбрать", _, "Назад")
                    end
            end
    end
end

function submenus_show(menu, caption, select_button, close_button, back_button)
    select_button, close_button, back_button = select_button or 'Select', close_button or 'Close', back_button or 'Back'
    prev_menus = {}
    function display(menu, id, caption)
        local string_list = {}
        for i, v in ipairs(menu) do
            table.insert(string_list, type(v.submenu) == 'table' and v.title .. '  >>' or v.title)
        end
        sampShowDialog(id, caption, table.concat(string_list, '\n'), select_button, (#prev_menus > 0) and back_button or close_button, sf.DIALOG_STYLE_LIST)
        repeat
            wait(0)
            local result, button, list = sampHasDialogRespond(id)
            if result then
                if button == 1 and list ~= -1 then
                    local item = menu[list + 1]
                    if type(item.submenu) == 'table' then -- submenu
                        table.insert(prev_menus, {menu = menu, caption = caption})
                        if type(item.onclick) == 'function' then
                            item.onclick(menu, list + 1, item.submenu)
                        end
                        return display(item.submenu, id + 1, item.submenu.title and item.submenu.title or item.title)
                    elseif type(item.onclick) == 'function' then
                        local result = item.onclick(menu, list + 1)
                        if not result then return result end
                        return display(menu, id, caption)
                    end
                else -- if button == 0
                    if #prev_menus > 0 then
                        local prev_menu = prev_menus[#prev_menus]
                        prev_menus[#prev_menus] = nil
                        return display(prev_menu.menu, id - 1, prev_menu.caption)
                    end
                    return false
                end
            end
        until result
    end
    return display(menu, 31337, caption or menu.title)
end
imgui.End() тоже убежал.
 
  • Нравится
Реакции: ШPEK

ШPEK

Известный
1,476
525
imgui.End() тоже убежал.
Почему "?" вместо нормальных символов?
Lua:
local imgui = require "imgui"
require "lib.moonloader"
local encoding = require "encoding"
local key = require "vkeys"
u8 = encoding.UTF8
encoding.default = "CP1251"

local doing = {
    {
    title = "{FF6666}Лечить",
    submenu = {
        {
        title = "{FF6666}Лечить голову",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me швыряясь в сумке нашёл таблетки \"Аспирин\"")
        wait(1500)
        sampSendChat("/me передал таблетки \"Аспирин\" человеку напротив")
        wait(1000)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        },
        {
        title = "{FF6666}Лечить живот",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me швыряясь в сумке нашёл таблетки \"Мезим\"")
        wait(1500)
        sampSendChat("/me передал таблетки человеку напротив")
        wait(100)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        },
        {
        title = "{FF6666}Универсальное лечение",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me достал нужный медикамент из сумки")
        wait(1500)
        sampSendChat("/me передал медикамент человеку напротив")
        wait(100)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        }
    }
    },
    {
    title = "{FF6666}Сделать укол",
    onclick = function()
    sampSendChat("/me открыл коробочку с новым шприцом")
    wait(1500)
    sampSendChat("/me выкинул коробочку в урну")
    wait(1500)
    sampSendChat("/me взяв баночку со спиртом со стола, стерелизовал руку пациента")
    wait(1500)
    sampSendChat("/me воткнул шприц в вену, введя препарат")
    wait(1500)
    sampSendChat("/me вытащив шприц, выкинул его в урну")
    wait(1500)
    sampSendChat("/inject "..id)
    end
    },
    {
    title = "{FF6666}Сделать операцию",
    onclick = function()
    sampSendChat("/me взял перчатки и маску со стола и надел маску и перчатки")
    wait(1500)
    sampSendChat("/do Маска для наркоза висит на подставке.")
    wait(1500)
    sampSendChat("/me взяв маску для наркоза в правую руку, надела её на лицо пациента")
    wait(1500)
    sampSendChat("/me включил подачу наркоза")
    wait(1500)
    sampSendChat("/do Наркоз действует.")
    wait(1500)
    sampSendChat("/me взяв скальпель в руку, аккуратным движением сделал надрез")
    wait(1500)
    sampSendChat("/me начал процесс операции")
    wait(5000)
    sampSendChat("/me взяв медицинскую нитку и иголку, начал зашивать рану")
    wait(1500)
    sampSendChat("/do Операция проведена.")
    wait(1500)
    sampSendChat("/me привёл пациента в сознание")
    wait(1500)
    sampSendChat("Процесс операции окончен, всё прошло успешно.")
    end
    },
    {
    title = "{66CCFF}Начать мед.осмотр",
    onclick = function()
    sampSendChat("Здравствуйте, сейчас я проведу медицинский осмотр.")
    wait(1500)
    sampSendChat("Хорошо, будьте добры встать к стене.")
    wait(1000)
    sampAddChatMessage("Нажмите NumPad7 чтобы продолжить осмотр", -1)
    repeat
    wait(0)
    until isKeyJustPressed(VK_7)
    sampSendChat("/do На столе лежат тонкие перчатки.")
    wait(1500)
    sampSendChat("/me взял тонкие перчатки со стола")
    wait(1500)
    sampSendChat("/me надел перчатки на руки")
    wait(1500)
    sampSendChat("/do Перчатки на руках.")
    wait(1500)
    sampSendChat("/me приступил к медицинскому осмотру")
    wait(1500)
    sampSendChat("/me провел голову на наличие вшей")
    wait(1500)
    sampSendChat("/me прощупал живот и половой орган человека")
    wait(1500)
    sampSendChat("/do Медицинская карта лежит на столе.")
    wait(1500)
    sampSendChat("/me взял медицинскую карту со стола")
    wait(1500)
    sampSendChat("/do На столе лежит ручка.")
    wait(1500)
    sampSendChat("/me взял ручку со стола")
    wait(1500)
    sampSendChat("/me поставил галочку на против строки \"Здоров\"")
    wait(1500)
    sampSendChat("/me поставил подпись в граффе \"Подпись врача\"")
    wait(1500)
    sampSendChat("/me положив ручку на стол, взял со стола печать \""..bolnica.."\"")
    wait(1500)
    sampSendChat("/me поставив печать \""..bolnica.."\"")
    wait(1500)
    sampSendChat("/me передал медицинскую карту пациенту ")
    wait(100)
    sampSendChat("/oldanim 6")
    wait(3000)
    sampSendChat("/medcard "..id)
    end
    }
}

local imbool = imgui.ImBool(false)
local bolnica = imgui.ImInt(0)
local cena = imgui.ImInt(0)
local nick = imgui.ImBuffer(257)
function imgui.OnDrawFrame()
    if imbool.v then
        imgui.SetNextWindowSize(imgui.ImVec2(150, 200), imgui.Cond.FirstUseEver)
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.Begin(u8"Ministry Ambulance Helper", imbool)
        imgui.Combo("Выбери свою больницу", bolnica, {"Лос-Сантос", "Сан-Фиерро", "Лас-Вентруас"})
        imgui.InputText("Введи свой ник (без _)", nick)
        imgui.InputInt("Введи ценовую политику", cena)
        imgui.End()
    end
end

function main()
while not isSampAvailable() do wait(100) end
    while true do
        wait(0)
        if isKeyJustPressed(key.VK_7) then
            imbool.v = not imbool.v
        end
        imgui.Process = imbool.v
        local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if valid and doesCharExist(ped) then
                local result, id = sampGetPlayerIdByCharHandle(ped)
                    if result and isKeyJustPressed(key.VK_1) and isKeyJustPressed(key.VK_LMENU) then
                        submenus_show("Взаимодействие с персонажем", doing, "Выбрать", _, "Назад")
                    end
            end
    end
end

function submenus_show(menu, caption, select_button, close_button, back_button)
    select_button, close_button, back_button = select_button or 'Select', close_button or 'Close', back_button or 'Back'
    prev_menus = {}
    function display(menu, id, caption)
        local string_list = {}
        for i, v in ipairs(menu) do
            table.insert(string_list, type(v.submenu) == 'table' and v.title .. '  >>' or v.title)
        end
        sampShowDialog(id, caption, table.concat(string_list, '\n'), select_button, (#prev_menus > 0) and back_button or close_button, sf.DIALOG_STYLE_LIST)
        repeat
            wait(0)
            local result, button, list = sampHasDialogRespond(id)
            if result then
                if button == 1 and list ~= -1 then
                    local item = menu[list + 1]
                    if type(item.submenu) == 'table' then -- submenu
                        table.insert(prev_menus, {menu = menu, caption = caption})
                        if type(item.onclick) == 'function' then
                            item.onclick(menu, list + 1, item.submenu)
                        end
                        return display(item.submenu, id + 1, item.submenu.title and item.submenu.title or item.title)
                    elseif type(item.onclick) == 'function' then
                        local result = item.onclick(menu, list + 1)
                        if not result then return result end
                        return display(menu, id, caption)
                    end
                else -- if button == 0
                    if #prev_menus > 0 then
                        local prev_menu = prev_menus[#prev_menus]
                        prev_menus[#prev_menus] = nil
                        return display(prev_menu.menu, id - 1, prev_menu.caption)
                    end
                    return false
                end
            end
        until result
    end
    return display(menu, 31337, caption or menu.title)
end
 

Musaigen

abobusnik
Проверенный
1,585
1,309
Почему "?" вместо нормальных символов?
Lua:
local imgui = require "imgui"
require "lib.moonloader"
local encoding = require "encoding"
local key = require "vkeys"
u8 = encoding.UTF8
encoding.default = "CP1251"

local doing = {
    {
    title = "{FF6666}Лечить",
    submenu = {
        {
        title = "{FF6666}Лечить голову",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me швыряясь в сумке нашёл таблетки \"Аспирин\"")
        wait(1500)
        sampSendChat("/me передал таблетки \"Аспирин\" человеку напротив")
        wait(1000)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        },
        {
        title = "{FF6666}Лечить живот",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me швыряясь в сумке нашёл таблетки \"Мезим\"")
        wait(1500)
        sampSendChat("/me передал таблетки человеку напротив")
        wait(100)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        },
        {
        title = "{FF6666}Универсальное лечение",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me достал нужный медикамент из сумки")
        wait(1500)
        sampSendChat("/me передал медикамент человеку напротив")
        wait(100)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        }
    }
    },
    {
    title = "{FF6666}Сделать укол",
    onclick = function()
    sampSendChat("/me открыл коробочку с новым шприцом")
    wait(1500)
    sampSendChat("/me выкинул коробочку в урну")
    wait(1500)
    sampSendChat("/me взяв баночку со спиртом со стола, стерелизовал руку пациента")
    wait(1500)
    sampSendChat("/me воткнул шприц в вену, введя препарат")
    wait(1500)
    sampSendChat("/me вытащив шприц, выкинул его в урну")
    wait(1500)
    sampSendChat("/inject "..id)
    end
    },
    {
    title = "{FF6666}Сделать операцию",
    onclick = function()
    sampSendChat("/me взял перчатки и маску со стола и надел маску и перчатки")
    wait(1500)
    sampSendChat("/do Маска для наркоза висит на подставке.")
    wait(1500)
    sampSendChat("/me взяв маску для наркоза в правую руку, надела её на лицо пациента")
    wait(1500)
    sampSendChat("/me включил подачу наркоза")
    wait(1500)
    sampSendChat("/do Наркоз действует.")
    wait(1500)
    sampSendChat("/me взяв скальпель в руку, аккуратным движением сделал надрез")
    wait(1500)
    sampSendChat("/me начал процесс операции")
    wait(5000)
    sampSendChat("/me взяв медицинскую нитку и иголку, начал зашивать рану")
    wait(1500)
    sampSendChat("/do Операция проведена.")
    wait(1500)
    sampSendChat("/me привёл пациента в сознание")
    wait(1500)
    sampSendChat("Процесс операции окончен, всё прошло успешно.")
    end
    },
    {
    title = "{66CCFF}Начать мед.осмотр",
    onclick = function()
    sampSendChat("Здравствуйте, сейчас я проведу медицинский осмотр.")
    wait(1500)
    sampSendChat("Хорошо, будьте добры встать к стене.")
    wait(1000)
    sampAddChatMessage("Нажмите NumPad7 чтобы продолжить осмотр", -1)
    repeat
    wait(0)
    until isKeyJustPressed(VK_7)
    sampSendChat("/do На столе лежат тонкие перчатки.")
    wait(1500)
    sampSendChat("/me взял тонкие перчатки со стола")
    wait(1500)
    sampSendChat("/me надел перчатки на руки")
    wait(1500)
    sampSendChat("/do Перчатки на руках.")
    wait(1500)
    sampSendChat("/me приступил к медицинскому осмотру")
    wait(1500)
    sampSendChat("/me провел голову на наличие вшей")
    wait(1500)
    sampSendChat("/me прощупал живот и половой орган человека")
    wait(1500)
    sampSendChat("/do Медицинская карта лежит на столе.")
    wait(1500)
    sampSendChat("/me взял медицинскую карту со стола")
    wait(1500)
    sampSendChat("/do На столе лежит ручка.")
    wait(1500)
    sampSendChat("/me взял ручку со стола")
    wait(1500)
    sampSendChat("/me поставил галочку на против строки \"Здоров\"")
    wait(1500)
    sampSendChat("/me поставил подпись в граффе \"Подпись врача\"")
    wait(1500)
    sampSendChat("/me положив ручку на стол, взял со стола печать \""..bolnica.."\"")
    wait(1500)
    sampSendChat("/me поставив печать \""..bolnica.."\"")
    wait(1500)
    sampSendChat("/me передал медицинскую карту пациенту ")
    wait(100)
    sampSendChat("/oldanim 6")
    wait(3000)
    sampSendChat("/medcard "..id)
    end
    }
}

local imbool = imgui.ImBool(false)
local bolnica = imgui.ImInt(0)
local cena = imgui.ImInt(0)
local nick = imgui.ImBuffer(257)
function imgui.OnDrawFrame()
    if imbool.v then
        imgui.SetNextWindowSize(imgui.ImVec2(150, 200), imgui.Cond.FirstUseEver)
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.Begin(u8"Ministry Ambulance Helper", imbool)
        imgui.Combo("Выбери свою больницу", bolnica, {"Лос-Сантос", "Сан-Фиерро", "Лас-Вентруас"})
        imgui.InputText("Введи свой ник (без _)", nick)
        imgui.InputInt("Введи ценовую политику", cena)
        imgui.End()
    end
end

function main()
while not isSampAvailable() do wait(100) end
    while true do
        wait(0)
        if isKeyJustPressed(key.VK_7) then
            imbool.v = not imbool.v
        end
        imgui.Process = imbool.v
        local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if valid and doesCharExist(ped) then
                local result, id = sampGetPlayerIdByCharHandle(ped)
                    if result and isKeyJustPressed(key.VK_1) and isKeyJustPressed(key.VK_LMENU) then
                        submenus_show("Взаимодействие с персонажем", doing, "Выбрать", _, "Назад")
                    end
            end
    end
end

function submenus_show(menu, caption, select_button, close_button, back_button)
    select_button, close_button, back_button = select_button or 'Select', close_button or 'Close', back_button or 'Back'
    prev_menus = {}
    function display(menu, id, caption)
        local string_list = {}
        for i, v in ipairs(menu) do
            table.insert(string_list, type(v.submenu) == 'table' and v.title .. '  >>' or v.title)
        end
        sampShowDialog(id, caption, table.concat(string_list, '\n'), select_button, (#prev_menus > 0) and back_button or close_button, sf.DIALOG_STYLE_LIST)
        repeat
            wait(0)
            local result, button, list = sampHasDialogRespond(id)
            if result then
                if button == 1 and list ~= -1 then
                    local item = menu[list + 1]
                    if type(item.submenu) == 'table' then -- submenu
                        table.insert(prev_menus, {menu = menu, caption = caption})
                        if type(item.onclick) == 'function' then
                            item.onclick(menu, list + 1, item.submenu)
                        end
                        return display(item.submenu, id + 1, item.submenu.title and item.submenu.title or item.title)
                    elseif type(item.onclick) == 'function' then
                        local result = item.onclick(menu, list + 1)
                        if not result then return result end
                        return display(menu, id, caption)
                    end
                else -- if button == 0
                    if #prev_menus > 0 then
                        local prev_menu = prev_menus[#prev_menus]
                        prev_menus[#prev_menus] = nil
                        return display(prev_menu.menu, id - 1, prev_menu.caption)
                    end
                    return false
                end
            end
        until result
    end
    return display(menu, 31337, caption or menu.title)
end
Кодировка Windows-1251.
 
  • Нравится
Реакции: ШPEK

T1cKz

Известный
596
246
Почему "?" вместо нормальных символов?
Lua:
local imgui = require "imgui"
require "lib.moonloader"
local encoding = require "encoding"
local key = require "vkeys"
u8 = encoding.UTF8
encoding.default = "CP1251"

local doing = {
    {
    title = "{FF6666}Лечить",
    submenu = {
        {
        title = "{FF6666}Лечить голову",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me швыряясь в сумке нашёл таблетки \"Аспирин\"")
        wait(1500)
        sampSendChat("/me передал таблетки \"Аспирин\" человеку напротив")
        wait(1000)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        },
        {
        title = "{FF6666}Лечить живот",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me швыряясь в сумке нашёл таблетки \"Мезим\"")
        wait(1500)
        sampSendChat("/me передал таблетки человеку напротив")
        wait(100)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        },
        {
        title = "{FF6666}Универсальное лечение",
        onclick = function()
        sampSendChat("/me открыв сумку, протянул туда руку")
        wait(1500)
        sampSendChat("/me достал нужный медикамент из сумки")
        wait(1500)
        sampSendChat("/me передал медикамент человеку напротив")
        wait(100)
        sampSendChat("/oldanim 6")
        wait(3000)
        sampSendChat("Скорейшего выздоровления! Больше не болейте")
        wait(100)
        sampSendChat(")")
        wait(1500)
        sampSendChat("/heal "..id.." "..cena)
        end
        }
    }
    },
    {
    title = "{FF6666}Сделать укол",
    onclick = function()
    sampSendChat("/me открыл коробочку с новым шприцом")
    wait(1500)
    sampSendChat("/me выкинул коробочку в урну")
    wait(1500)
    sampSendChat("/me взяв баночку со спиртом со стола, стерелизовал руку пациента")
    wait(1500)
    sampSendChat("/me воткнул шприц в вену, введя препарат")
    wait(1500)
    sampSendChat("/me вытащив шприц, выкинул его в урну")
    wait(1500)
    sampSendChat("/inject "..id)
    end
    },
    {
    title = "{FF6666}Сделать операцию",
    onclick = function()
    sampSendChat("/me взял перчатки и маску со стола и надел маску и перчатки")
    wait(1500)
    sampSendChat("/do Маска для наркоза висит на подставке.")
    wait(1500)
    sampSendChat("/me взяв маску для наркоза в правую руку, надела её на лицо пациента")
    wait(1500)
    sampSendChat("/me включил подачу наркоза")
    wait(1500)
    sampSendChat("/do Наркоз действует.")
    wait(1500)
    sampSendChat("/me взяв скальпель в руку, аккуратным движением сделал надрез")
    wait(1500)
    sampSendChat("/me начал процесс операции")
    wait(5000)
    sampSendChat("/me взяв медицинскую нитку и иголку, начал зашивать рану")
    wait(1500)
    sampSendChat("/do Операция проведена.")
    wait(1500)
    sampSendChat("/me привёл пациента в сознание")
    wait(1500)
    sampSendChat("Процесс операции окончен, всё прошло успешно.")
    end
    },
    {
    title = "{66CCFF}Начать мед.осмотр",
    onclick = function()
    sampSendChat("Здравствуйте, сейчас я проведу медицинский осмотр.")
    wait(1500)
    sampSendChat("Хорошо, будьте добры встать к стене.")
    wait(1000)
    sampAddChatMessage("Нажмите NumPad7 чтобы продолжить осмотр", -1)
    repeat
    wait(0)
    until isKeyJustPressed(VK_7)
    sampSendChat("/do На столе лежат тонкие перчатки.")
    wait(1500)
    sampSendChat("/me взял тонкие перчатки со стола")
    wait(1500)
    sampSendChat("/me надел перчатки на руки")
    wait(1500)
    sampSendChat("/do Перчатки на руках.")
    wait(1500)
    sampSendChat("/me приступил к медицинскому осмотру")
    wait(1500)
    sampSendChat("/me провел голову на наличие вшей")
    wait(1500)
    sampSendChat("/me прощупал живот и половой орган человека")
    wait(1500)
    sampSendChat("/do Медицинская карта лежит на столе.")
    wait(1500)
    sampSendChat("/me взял медицинскую карту со стола")
    wait(1500)
    sampSendChat("/do На столе лежит ручка.")
    wait(1500)
    sampSendChat("/me взял ручку со стола")
    wait(1500)
    sampSendChat("/me поставил галочку на против строки \"Здоров\"")
    wait(1500)
    sampSendChat("/me поставил подпись в граффе \"Подпись врача\"")
    wait(1500)
    sampSendChat("/me положив ручку на стол, взял со стола печать \""..bolnica.."\"")
    wait(1500)
    sampSendChat("/me поставив печать \""..bolnica.."\"")
    wait(1500)
    sampSendChat("/me передал медицинскую карту пациенту ")
    wait(100)
    sampSendChat("/oldanim 6")
    wait(3000)
    sampSendChat("/medcard "..id)
    end
    }
}

local imbool = imgui.ImBool(false)
local bolnica = imgui.ImInt(0)
local cena = imgui.ImInt(0)
local nick = imgui.ImBuffer(257)
function imgui.OnDrawFrame()
    if imbool.v then
        imgui.SetNextWindowSize(imgui.ImVec2(150, 200), imgui.Cond.FirstUseEver)
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.Begin(u8"Ministry Ambulance Helper", imbool)
        imgui.Combo("Выбери свою больницу", bolnica, {"Лос-Сантос", "Сан-Фиерро", "Лас-Вентруас"})
        imgui.InputText("Введи свой ник (без _)", nick)
        imgui.InputInt("Введи ценовую политику", cena)
        imgui.End()
    end
end

function main()
while not isSampAvailable() do wait(100) end
    while true do
        wait(0)
        if isKeyJustPressed(key.VK_7) then
            imbool.v = not imbool.v
        end
        imgui.Process = imbool.v
        local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if valid and doesCharExist(ped) then
                local result, id = sampGetPlayerIdByCharHandle(ped)
                    if result and isKeyJustPressed(key.VK_1) and isKeyJustPressed(key.VK_LMENU) then
                        submenus_show("Взаимодействие с персонажем", doing, "Выбрать", _, "Назад")
                    end
            end
    end
end

function submenus_show(menu, caption, select_button, close_button, back_button)
    select_button, close_button, back_button = select_button or 'Select', close_button or 'Close', back_button or 'Back'
    prev_menus = {}
    function display(menu, id, caption)
        local string_list = {}
        for i, v in ipairs(menu) do
            table.insert(string_list, type(v.submenu) == 'table' and v.title .. '  >>' or v.title)
        end
        sampShowDialog(id, caption, table.concat(string_list, '\n'), select_button, (#prev_menus > 0) and back_button or close_button, sf.DIALOG_STYLE_LIST)
        repeat
            wait(0)
            local result, button, list = sampHasDialogRespond(id)
            if result then
                if button == 1 and list ~= -1 then
                    local item = menu[list + 1]
                    if type(item.submenu) == 'table' then -- submenu
                        table.insert(prev_menus, {menu = menu, caption = caption})
                        if type(item.onclick) == 'function' then
                            item.onclick(menu, list + 1, item.submenu)
                        end
                        return display(item.submenu, id + 1, item.submenu.title and item.submenu.title or item.title)
                    elseif type(item.onclick) == 'function' then
                        local result = item.onclick(menu, list + 1)
                        if not result then return result end
                        return display(menu, id, caption)
                    end
                else -- if button == 0
                    if #prev_menus > 0 then
                        local prev_menu = prev_menus[#prev_menus]
                        prev_menus[#prev_menus] = nil
                        return display(prev_menu.menu, id - 1, prev_menu.caption)
                    end
                    return false
                end
            end
        until result
    end
    return display(menu, 31337, caption or menu.title)
end
Формат рускава текста в imgui u8"Руцкий текст"
Нахуй ты английский пишешь с декодером u8
А русский без?
 
  • Нравится
Реакции: ШPEK

ШPEK

Известный
1,476
525
Где найти ID клавиш для isKeyDown(int keyId)?
Код:
VK_LBUTTON = 0x01,
    VK_RBUTTON = 0x02,
    VK_CANCEL = 0x03,
    VK_MBUTTON = 0x04,
    VK_XBUTTON1 = 0x05,
    VK_XBUTTON2 = 0x06,
    VK_BACK = 0x08,
    VK_TAB = 0x09,
    VK_CLEAR = 0x0C,
    VK_RETURN = 0x0D,
    VK_SHIFT = 0x10,
    VK_CONTROL = 0x11,
    VK_MENU = 0x12,
    VK_PAUSE = 0x13,
    VK_CAPITAL = 0x14,
    VK_KANA = 0x15,
    VK_JUNJA = 0x17,
    VK_FINAL = 0x18,
    VK_KANJI = 0x19,
    VK_ESCAPE = 0x1B,
    VK_CONVERT = 0x1C,
    VK_NONCONVERT = 0x1D,
    VK_ACCEPT = 0x1E,
    VK_MODECHANGE = 0x1F,
    VK_SPACE = 0x20,
    VK_PRIOR = 0x21,
    VK_NEXT = 0x22,
    VK_END = 0x23,
    VK_HOME = 0x24,
    VK_LEFT = 0x25,
    VK_UP = 0x26,
    VK_RIGHT = 0x27,
    VK_DOWN = 0x28,
    VK_SELECT = 0x29,
    VK_PRINT = 0x2A,
    VK_EXECUTE = 0x2B,
    VK_SNAPSHOT = 0x2C,
    VK_INSERT = 0x2D,
    VK_DELETE = 0x2E,
    VK_HELP = 0x2F,
    VK_0 = 0x30,
    VK_1 = 0x31,
    VK_2 = 0x32,
    VK_3 = 0x33,
    VK_4 = 0x34,
    VK_5 = 0x35,
    VK_6 = 0x36,
    VK_7 = 0x37,
    VK_8 = 0x38,
    VK_9 = 0x39,
    VK_A = 0x41,
    VK_B = 0x42,
    VK_C = 0x43,
    VK_D = 0x44,
    VK_E = 0x45,
    VK_F = 0x46,
    VK_G = 0x47,
    VK_H = 0x48,
    VK_I = 0x49,
    VK_J = 0x4A,
    VK_K = 0x4B,
    VK_L = 0x4C,
    VK_M = 0x4D,
    VK_N = 0x4E,
    VK_O = 0x4F,
    VK_P = 0x50,
    VK_Q = 0x51,
    VK_R = 0x52,
    VK_S = 0x53,
    VK_T = 0x54,
    VK_U = 0x55,
    VK_V = 0x56,
    VK_W = 0x57,
    VK_X = 0x58,
    VK_Y = 0x59,
    VK_Z = 0x5A,
    VK_LWIN = 0x5B,
    VK_RWIN = 0x5C,
    VK_APPS = 0x5D,
    VK_SLEEP = 0x5F,
    VK_NUMPAD0 = 0x60,
    VK_NUMPAD1 = 0x61,
    VK_NUMPAD2 = 0x62,
    VK_NUMPAD3 = 0x63,
    VK_NUMPAD4 = 0x64,
    VK_NUMPAD5 = 0x65,
    VK_NUMPAD6 = 0x66,
    VK_NUMPAD7 = 0x67,
    VK_NUMPAD8 = 0x68,
    VK_NUMPAD9 = 0x69,
    VK_MULTIPLY = 0x6A,
    VK_ADD = 0x6B,
    VK_SEPARATOR = 0x6C,
    VK_SUBTRACT = 0x6D,
    VK_DECIMAL = 0x6E,
    VK_DIVIDE = 0x6F,
    VK_F1 = 0x70,
    VK_F2 = 0x71,
    VK_F3 = 0x72,
    VK_F4 = 0x73,
    VK_F5 = 0x74,
    VK_F6 = 0x75,
    VK_F7 = 0x76,
    VK_F8 = 0x77,
    VK_F9 = 0x78,
    VK_F10 = 0x79,
    VK_F11 = 0x7A,
    VK_F12 = 0x7B,
    VK_F13 = 0x7C,
    VK_F14 = 0x7D,
    VK_F15 = 0x7E,
    VK_F16 = 0x7F,
    VK_F17 = 0x80,
    VK_F18 = 0x81,
    VK_F19 = 0x82,
    VK_F20 = 0x83,
    VK_F21 = 0x84,
    VK_F22 = 0x85,
    VK_F23 = 0x86,
    VK_F24 = 0x87,
    VK_NUMLOCK = 0x90,
    VK_SCROLL = 0x91,
    VK_OEM_FJ_JISHO = 0x92,
    VK_OEM_FJ_MASSHOU = 0x93,
    VK_OEM_FJ_TOUROKU = 0x94,
    VK_OEM_FJ_LOYA = 0x95,
    VK_OEM_FJ_ROYA = 0x96,
    VK_LSHIFT = 0xA0,
    VK_RSHIFT = 0xA1,
    VK_LCONTROL = 0xA2,
    VK_RCONTROL = 0xA3,
    VK_LMENU = 0xA4,
    VK_RMENU = 0xA5,
    VK_BROWSER_BACK = 0xA6,
    VK_BROWSER_FORWARD = 0xA7,
    VK_BROWSER_REFRESH = 0xA8,
    VK_BROWSER_STOP = 0xA9,
    VK_BROWSER_SEARCH = 0xAA,
    VK_BROWSER_FAVORITES = 0xAB,
    VK_BROWSER_HOME = 0xAC,
    VK_VOLUME_MUTE = 0xAD,
    VK_VOLUME_DOWN = 0xAE,
    VK_VOLUME_UP = 0xAF,
    VK_MEDIA_NEXT_TRACK = 0xB0,
    VK_MEDIA_PREV_TRACK = 0xB1,
    VK_MEDIA_STOP = 0xB2,
    VK_MEDIA_PLAY_PAUSE = 0xB3,
    VK_LAUNCH_MAIL = 0xB4,
    VK_LAUNCH_MEDIA_SELECT = 0xB5,
    VK_LAUNCH_APP1 = 0xB6,
    VK_LAUNCH_APP2 = 0xB7,
    VK_OEM_1 = 0xBA,
    VK_OEM_PLUS = 0xBB,
    VK_OEM_COMMA = 0xBC,
    VK_OEM_MINUS = 0xBD,
    VK_OEM_PERIOD = 0xBE,
    VK_OEM_2 = 0xBF,
    VK_OEM_3 = 0xC0,
    VK_ABNT_C1 = 0xC1,
    VK_ABNT_C2 = 0xC2,
    VK_OEM_4 = 0xDB,
    VK_OEM_5 = 0xDC,
    VK_OEM_6 = 0xDD,
    VK_OEM_7 = 0xDE,
    VK_OEM_8 = 0xDF,
    VK_OEM_AX = 0xE1,
    VK_OEM_102 = 0xE2,
    VK_ICO_HELP = 0xE3,
    VK_PROCESSKEY = 0xE5,
    VK_ICO_CLEAR = 0xE6,
    VK_PACKET = 0xE7,
    VK_OEM_RESET = 0xE9,
    VK_OEM_JUMP = 0xEA,
    VK_OEM_PA1 = 0xEB,
    VK_OEM_PA2 = 0xEC,
    VK_OEM_PA3 = 0xED,
    VK_OEM_WSCTRL = 0xEE,
    VK_OEM_CUSEL = 0xEF,
    VK_OEM_ATTN = 0xF0,
    VK_OEM_FINISH = 0xF1,
    VK_OEM_COPY = 0xF2,
    VK_OEM_AUTO = 0xF3,
    VK_OEM_ENLW = 0xF4,
    VK_OEM_BACKTAB = 0xF5,
    VK_ATTN = 0xF6,
    VK_CRSEL = 0xF7,
    VK_EXSEL = 0xF8,
    VK_EREOF = 0xF9,
    VK_PLAY = 0xFA,
    VK_ZOOM = 0xFB,
    VK_PA1 = 0xFD,
    VK_OEM_CLEAR = 0xFE,
 

Liquell

Известный
14
2
Код:
VK_LBUTTON = 0x01,
    VK_RBUTTON = 0x02,
    VK_CANCEL = 0x03,
    VK_MBUTTON = 0x04,
    VK_XBUTTON1 = 0x05,
    VK_XBUTTON2 = 0x06,
    VK_BACK = 0x08,
    VK_TAB = 0x09,
    VK_CLEAR = 0x0C,
    VK_RETURN = 0x0D,
    VK_SHIFT = 0x10,
    VK_CONTROL = 0x11,
    VK_MENU = 0x12,
    VK_PAUSE = 0x13,
    VK_CAPITAL = 0x14,
    VK_KANA = 0x15,
    VK_JUNJA = 0x17,
    VK_FINAL = 0x18,
    VK_KANJI = 0x19,
    VK_ESCAPE = 0x1B,
    VK_CONVERT = 0x1C,
    VK_NONCONVERT = 0x1D,
    VK_ACCEPT = 0x1E,
    VK_MODECHANGE = 0x1F,
    VK_SPACE = 0x20,
    VK_PRIOR = 0x21,
    VK_NEXT = 0x22,
    VK_END = 0x23,
    VK_HOME = 0x24,
    VK_LEFT = 0x25,
    VK_UP = 0x26,
    VK_RIGHT = 0x27,
    VK_DOWN = 0x28,
    VK_SELECT = 0x29,
    VK_PRINT = 0x2A,
    VK_EXECUTE = 0x2B,
    VK_SNAPSHOT = 0x2C,
    VK_INSERT = 0x2D,
    VK_DELETE = 0x2E,
    VK_HELP = 0x2F,
    VK_0 = 0x30,
    VK_1 = 0x31,
    VK_2 = 0x32,
    VK_3 = 0x33,
    VK_4 = 0x34,
    VK_5 = 0x35,
    VK_6 = 0x36,
    VK_7 = 0x37,
    VK_8 = 0x38,
    VK_9 = 0x39,
    VK_A = 0x41,
    VK_B = 0x42,
    VK_C = 0x43,
    VK_D = 0x44,
    VK_E = 0x45,
    VK_F = 0x46,
    VK_G = 0x47,
    VK_H = 0x48,
    VK_I = 0x49,
    VK_J = 0x4A,
    VK_K = 0x4B,
    VK_L = 0x4C,
    VK_M = 0x4D,
    VK_N = 0x4E,
    VK_O = 0x4F,
    VK_P = 0x50,
    VK_Q = 0x51,
    VK_R = 0x52,
    VK_S = 0x53,
    VK_T = 0x54,
    VK_U = 0x55,
    VK_V = 0x56,
    VK_W = 0x57,
    VK_X = 0x58,
    VK_Y = 0x59,
    VK_Z = 0x5A,
    VK_LWIN = 0x5B,
    VK_RWIN = 0x5C,
    VK_APPS = 0x5D,
    VK_SLEEP = 0x5F,
    VK_NUMPAD0 = 0x60,
    VK_NUMPAD1 = 0x61,
    VK_NUMPAD2 = 0x62,
    VK_NUMPAD3 = 0x63,
    VK_NUMPAD4 = 0x64,
    VK_NUMPAD5 = 0x65,
    VK_NUMPAD6 = 0x66,
    VK_NUMPAD7 = 0x67,
    VK_NUMPAD8 = 0x68,
    VK_NUMPAD9 = 0x69,
    VK_MULTIPLY = 0x6A,
    VK_ADD = 0x6B,
    VK_SEPARATOR = 0x6C,
    VK_SUBTRACT = 0x6D,
    VK_DECIMAL = 0x6E,
    VK_DIVIDE = 0x6F,
    VK_F1 = 0x70,
    VK_F2 = 0x71,
    VK_F3 = 0x72,
    VK_F4 = 0x73,
    VK_F5 = 0x74,
    VK_F6 = 0x75,
    VK_F7 = 0x76,
    VK_F8 = 0x77,
    VK_F9 = 0x78,
    VK_F10 = 0x79,
    VK_F11 = 0x7A,
    VK_F12 = 0x7B,
    VK_F13 = 0x7C,
    VK_F14 = 0x7D,
    VK_F15 = 0x7E,
    VK_F16 = 0x7F,
    VK_F17 = 0x80,
    VK_F18 = 0x81,
    VK_F19 = 0x82,
    VK_F20 = 0x83,
    VK_F21 = 0x84,
    VK_F22 = 0x85,
    VK_F23 = 0x86,
    VK_F24 = 0x87,
    VK_NUMLOCK = 0x90,
    VK_SCROLL = 0x91,
    VK_OEM_FJ_JISHO = 0x92,
    VK_OEM_FJ_MASSHOU = 0x93,
    VK_OEM_FJ_TOUROKU = 0x94,
    VK_OEM_FJ_LOYA = 0x95,
    VK_OEM_FJ_ROYA = 0x96,
    VK_LSHIFT = 0xA0,
    VK_RSHIFT = 0xA1,
    VK_LCONTROL = 0xA2,
    VK_RCONTROL = 0xA3,
    VK_LMENU = 0xA4,
    VK_RMENU = 0xA5,
    VK_BROWSER_BACK = 0xA6,
    VK_BROWSER_FORWARD = 0xA7,
    VK_BROWSER_REFRESH = 0xA8,
    VK_BROWSER_STOP = 0xA9,
    VK_BROWSER_SEARCH = 0xAA,
    VK_BROWSER_FAVORITES = 0xAB,
    VK_BROWSER_HOME = 0xAC,
    VK_VOLUME_MUTE = 0xAD,
    VK_VOLUME_DOWN = 0xAE,
    VK_VOLUME_UP = 0xAF,
    VK_MEDIA_NEXT_TRACK = 0xB0,
    VK_MEDIA_PREV_TRACK = 0xB1,
    VK_MEDIA_STOP = 0xB2,
    VK_MEDIA_PLAY_PAUSE = 0xB3,
    VK_LAUNCH_MAIL = 0xB4,
    VK_LAUNCH_MEDIA_SELECT = 0xB5,
    VK_LAUNCH_APP1 = 0xB6,
    VK_LAUNCH_APP2 = 0xB7,
    VK_OEM_1 = 0xBA,
    VK_OEM_PLUS = 0xBB,
    VK_OEM_COMMA = 0xBC,
    VK_OEM_MINUS = 0xBD,
    VK_OEM_PERIOD = 0xBE,
    VK_OEM_2 = 0xBF,
    VK_OEM_3 = 0xC0,
    VK_ABNT_C1 = 0xC1,
    VK_ABNT_C2 = 0xC2,
    VK_OEM_4 = 0xDB,
    VK_OEM_5 = 0xDC,
    VK_OEM_6 = 0xDD,
    VK_OEM_7 = 0xDE,
    VK_OEM_8 = 0xDF,
    VK_OEM_AX = 0xE1,
    VK_OEM_102 = 0xE2,
    VK_ICO_HELP = 0xE3,
    VK_PROCESSKEY = 0xE5,
    VK_ICO_CLEAR = 0xE6,
    VK_PACKET = 0xE7,
    VK_OEM_RESET = 0xE9,
    VK_OEM_JUMP = 0xEA,
    VK_OEM_PA1 = 0xEB,
    VK_OEM_PA2 = 0xEC,
    VK_OEM_PA3 = 0xED,
    VK_OEM_WSCTRL = 0xEE,
    VK_OEM_CUSEL = 0xEF,
    VK_OEM_ATTN = 0xF0,
    VK_OEM_FINISH = 0xF1,
    VK_OEM_COPY = 0xF2,
    VK_OEM_AUTO = 0xF3,
    VK_OEM_ENLW = 0xF4,
    VK_OEM_BACKTAB = 0xF5,
    VK_ATTN = 0xF6,
    VK_CRSEL = 0xF7,
    VK_EXSEL = 0xF8,
    VK_EREOF = 0xF9,
    VK_PLAY = 0xFA,
    VK_ZOOM = 0xFB,
    VK_PA1 = 0xFD,
    VK_OEM_CLEAR = 0xFE,
Спасибо
 

Liquell

Известный
14
2
Как сделать так чтобы скрипт роботал до повторного введения команды?