Помогите с lua

ScripTER 2.0

Участник
Автор темы
106
4
Помогите сделать одовреммено в
while true do
wait(22) -- задержка
if status then
local x, y, z = getCharCoordinates(PLAYER_PED)
local result, _, _, _, _, _, _, _, _, _ = Search3Dtext(x, y, z, 3, "{73B461}Для")
if result then
setGameKeyState(21, 255)
wait(2)
setGameKeyState(21, 0)
result = false
Что бы не только альт нажимал но и после альт нажимал левую кнопку мыши в центр экрана
вот целый код скрипта
Кодик:
sampev = require "samp.events"
local status = false

function main()
    repeat wait(0) until isSampAvailable()
    sampAddChatMessage("{2F4F4F}[WFALT]{FFFFFF} Автоматический сбор ресурсов подгружен {191970} x {ffffff} команда для активации - {FF1493}/wfalt", -1)
    sampRegisterChatCommand('wfalt', function()
        status = not status
        if status then
            sampAddChatMessage("{2F4F4F}[WFALT]{FFFFFF} some good of resources {33EA0D}ON", -1)
        else
            sampAddChatMessage("{2F4F4F}[WFALT]{FFFFFF} какие-то дерьмовые ресурсы {F51111}OFF", -1)
        end
    end)
    while true do
        wait(22) -- задержка
        if status then
            local x, y, z = getCharCoordinates(PLAYER_PED)
            local result, _, _, _, _, _, _, _, _, _ = Search3Dtext(x, y, z, 3, "{73B461}Для")
            if result then
                setGameKeyState(21, 255)
                wait(2)
                setGameKeyState(21, 0)
                result = false
            end
        end
    end
end

function Search3Dtext(x, y, z, radius, patern) -- https://www.blast.hk/threads/13380/post-119168
    local text = ""
    local color = 0
    local posX = 0.0
    local posY = 0.0
    local posZ = 0.0
    local distance = 0.0
    local ignoreWalls = false
    local player = -1
    local vehicle = -1
    local result = false

    for id = 0, 2048 do
        if sampIs3dTextDefined(id) then
            local text2, color2, posX2, posY2, posZ2, distance2, ignoreWalls2, player2, vehicle2 = sampGet3dTextInfoById(id)
            if getDistanceBetweenCoords3d(x, y, z, posX2, posY2, posZ2) < radius then
                if string.len(patern) ~= 0 then
                    if string.match(text2, patern, 0) ~= nil then result = true end
                else
                    result = true
                end
                if result then
                    text = text2
                    color = color2
                    posX = posX2
                    posY = posY2
                    posZ = posZ2
                    distance = distance2
                    ignoreWalls = ignoreWalls2
                    player = player2
                    vehicle = vehicle2
                    radius = getDistanceBetweenCoords3d(x, y, z, posX, posY, posZ)
                end
            end
        end
    end

    return result, text, color, posX, posY, posZ, distance, ignoreWalls, player, vehicle
end
Кто сделает что бы он работал как надо тому скину 560р на карту!
Заранее спасибо.
 

ScripTER 2.0

Участник
Автор темы
106
4
Lua:
setGameKeyState(17,255) -- Нажать ЛКМ
wait(2)
setGameKeyState(17,0) -- Отпустить ЛКМ
Я сам так пробувал он нажимает альт и нажимает очень быстро W

Lua:
setGameKeyState(17,255) -- Нажать ЛКМ
wait(2)
setGameKeyState(17,0) -- Отпустить ЛКМ
Так?

Код:
if result then
                setGameKeyState(21, 255)
                wait(2)
                setGameKeyState(21, 0)
                setGameKeyState(17,255) -- Нажать ЛКМ
                wait(2)
               setGameKeyState(17,0)
                result = false
 

Fellespe.

Участник
42
8
Я сам так пробувал он нажимает альт и нажимает очень быстро W


Так?

Код:
if result then
                setGameKeyState(21, 255)
                wait(2)
                setGameKeyState(21, 0)
                setGameKeyState(17,255) -- Нажать ЛКМ
                wait(2)
               setGameKeyState(17,0)
                result = false
Да
 
  • Злость
Реакции: ScripTER 2.0