Ближайший 3д текст и нажатие клавиши

gromkiy.

Участник
Автор темы
24
9
Нужен скрипт, который нажмет кнопку H, когда я буду возле 3d текста "Посигнальте Чтобы доставить груз" как его сделать?
 
Решение
Нужен скрипт, который нажмет кнопку H, когда я буду возле 3d текста "Посигнальте Чтобы доставить груз" как его сделать?
Lua:
require "lib.moonloader"

local KEY_H, script_enabled = 72, true

function main()
    if isSampAvailable() then
        sampAddChatMessage("[SIGNAL] Загружен. by: нейросеть", 0x1E90FF)
        sampRegisterChatCommand("signal", cmd_signal)
    end
    
    while true do
        wait(0)
        if not isSampAvailable() then wait(1000) goto continue end
        
        if script_enabled then
            for i = 0, 2049 do
                if sampIs3dTextDefined(i) then
                    local text, color, x, y, z = sampGet3dTextInfoById(i)
                    if text and text:find("Посигнальте Чтобы доставить...

Нейросеть

Участник
62
38
Нужен скрипт, который нажмет кнопку H, когда я буду возле 3d текста "Посигнальте Чтобы доставить груз" как его сделать?
Lua:
require "lib.moonloader"

local KEY_H, script_enabled = 72, true

function main()
    if isSampAvailable() then
        sampAddChatMessage("[SIGNAL] Загружен. by: нейросеть", 0x1E90FF)
        sampRegisterChatCommand("signal", cmd_signal)
    end
    
    while true do
        wait(0)
        if not isSampAvailable() then wait(1000) goto continue end
        
        if script_enabled then
            for i = 0, 2049 do
                if sampIs3dTextDefined(i) then
                    local text, color, x, y, z = sampGet3dTextInfoById(i)
                    if text and text:find("Посигнальте Чтобы доставить груз") then
                        local px, py, pz = getCharCoordinates(PLAYER_PED)
                        if math.sqrt((x-px)^2+(y-py)^2+(z-pz)^2) < 10.0 then
                            setVirtualKeyDown(KEY_H, true)
                            wait(50)
                            setVirtualKeyDown(KEY_H, false)
                            wait(2000)
                        end
                    end
                end
            end
        end
        ::continue::
    end
end

function cmd_signal()
    script_enabled = not script_enabled
    sampAddChatMessage("[SIGNAL] Скрипт " .. (script_enabled and "активирован" or "деактивирован"), script_enabled and 0x1E90FF or 0xFF0000)
end
 
  • Нравится
Реакции: gromkiy.