хелп со скриптом

rertlop

Участник
Автор темы
47
3
Не могу понять почему не работает, поясните дураку



код:
local sampev = require "lib.samp.events"

local power = false

function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('ic', function()
    power = not power
        sampAddChatMessage('{E9EC10}[A-close] Скрипт '..(power and '{00ff00}включен{ffffff}!' or '{ff4040}выключен{ffffff}!'), -1)
    end)
    while true do
        wait(1000)
        if power then
            sampSendClickTextdraw(2083)
            wait(1000)
    end)
    sampRegisterChatCommand('il', function()
        bool = not bool
        sampAddChatMessage(bool and ('{F1C232}Скрипт включен.') or ('{F1C232}Скрипт выключен.'), -1)
    end)
    while true do wait(0)
        if bool then
            for i = 0, 2048 do
                if sampIs3dTextDefined(i) then
                    local pp = {sampGet3dTextInfoById(i)}
                    if pp[1]:match('Самолет:') then
                        if not sampIsCursorActive() then
                            setVirtualKeyDown(18, true)
                            wait(100)
                            setVirtualKeyDown(13, true)
                            wait(100)
                            setVirtualKeyDown(18, false)
                            wait(100)
                            setVirtualKeyDown(13, false)
                            wait(100)
                            setVirtualKeyDown(13, false)
                            wait(100)
                            setVirtualKeyDown(13, false)
                            wait(100)
                            setVirtualKeyDown(13, false)
                            wait(100)
                        end
                    end
                end
            end
        end
    end
end