LUA | Клик по текстдрав(кикает).

Devourer007

Новичок
Автор темы
25
0
Версия MoonLoader
.027.0-preview
Доброго времени суток. Написал скрипт(почти сам), вот только беда.. При его активации кикает с сервера. Либо же пока стою на месте, всё хорошо, как только начинаю двигаться, кик.

Подскажите, как исправить?

Безымянный.jpg




LUA:
local offIfAdminMessage = true

local sampev = require 'lib.samp.events'

function main()
    while not isSampLoaded and not isSampfuncsLoaded do wait(250) end
    while not isSampAvailable do wait(250) end
    sampRegisterChatCommand('click', click)
    while true do
        wait(250)
        if click then
            sampSendClickTextdraw(2107) -- если установлен скрипт td show, то через него узнаешь ид
        end
    end
end

function click()
    click = not click
    if click then
        sampAddChatMessage('[Click] Flood - Active', -1)
    else
        sampAddChatMessage('[Click] Flood - Deactive', -1)
    end
end
 
Решение
Должно смотреться примерно так?

LUA:
local offIfAdminMessage = true
local sampev = require 'lib.samp.events'

function main()
    if not isSampLoaded() and not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('click', click)
    if sampTextdrawIsExists(2106) or sampTextdrawIsExists(2110) or sampTextdrawIsExists(2107) or sampTextdrawIsExists(2109) or sampTextdrawIsExists(2111) then
    while true do
        wait(0)
        if click then
            sampSendClickTextdraw(2106) -- если установлен скрипт td show, то через него узнаешь ид
            wait(0)
            sampSendClickTextdraw(2110)
            wait(0)
            sampSendClickTextdraw(2107)
            wait(0)...

qdIbp

Автор темы
Проверенный
1,386
1,141
Он флудит кликами по текстдраву, на некоторых серверах антифлуд кикает за это

Lua:
local sampev = require 'lib.samp.events'
local time = 0
local click = false
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
   
    sampRegisterChatCommand('click', function () click = not click
    if click then sampAddChatMessage('[Click] Flood - Active', -1) time = os.clock() + 2
    else sampAddChatMessage('[Click] Flood - Deactive', -1) time = 0 end end)
   
    while true do wait(0)
        if click then
            if time < os.clock() then
                sampSendClickTextdraw(2107) time = os.clock() + 2
            end
        end
    end
end
Будет кликать раз в 1-2 сек
 
Последнее редактирование:

Devourer007

Новичок
Автор темы
25
0
проверку добавить, чтобы просто так не кликал
Должно смотреться примерно так?

LUA:
local offIfAdminMessage = true
local sampev = require 'lib.samp.events'

function main()
    if not isSampLoaded() and not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('click', click)
    if sampTextdrawIsExists(2106) or sampTextdrawIsExists(2110) or sampTextdrawIsExists(2107) or sampTextdrawIsExists(2109) or sampTextdrawIsExists(2111) then
    while true do
        wait(0)
        if click then
            sampSendClickTextdraw(2106) -- если установлен скрипт td show, то через него узнаешь ид
            wait(0)
            sampSendClickTextdraw(2110)
            wait(0)
            sampSendClickTextdraw(2107)
            wait(0)
            sampSendClickTextdraw(2109)
            wait(0)
            sampSendClickTextdraw(2111)
        end
    end
end

function click()
    click = not click
    if click then
        sampAddChatMessage('[Click] Flood - Active', -1)
    else
        sampAddChatMessage('[Click] Flood - Deactive', -1)
    end
end
 

Manuel Leon

Известный
266
166
Должно смотреться примерно так?

LUA:
local offIfAdminMessage = true
local sampev = require 'lib.samp.events'

function main()
    if not isSampLoaded() and not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('click', click)
    if sampTextdrawIsExists(2106) or sampTextdrawIsExists(2110) or sampTextdrawIsExists(2107) or sampTextdrawIsExists(2109) or sampTextdrawIsExists(2111) then
    while true do
        wait(0)
        if click then
            sampSendClickTextdraw(2106) -- если установлен скрипт td show, то через него узнаешь ид
            wait(0)
            sampSendClickTextdraw(2110)
            wait(0)
            sampSendClickTextdraw(2107)
            wait(0)
            sampSendClickTextdraw(2109)
            wait(0)
            sampSendClickTextdraw(2111)
        end
    end
end

function click()
    click = not click
    if click then
        sampAddChatMessage('[Click] Flood - Active', -1)
    else
        sampAddChatMessage('[Click] Flood - Deactive', -1)
    end
end
Lua:
local offIfAdminMessage = true
local sampev = require 'lib.samp.events'

function main()
    if not isSampLoaded() and not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('click', click)
    while true do
        wait(0)
        if click then
             if sampTextdrawIsExists(2106) or sampTextdrawIsExists(2110) or sampTextdrawIsExists(2107) or sampTextdrawIsExists(2109) or sampTextdrawIsExists(2111) then
                sampSendClickTextdraw(2106) -- если установлен скрипт td show, то через него узнаешь ид
                sampSendClickTextdraw(2110)
                sampSendClickTextdraw(2107)
                sampSendClickTextdraw(2109)
                sampSendClickTextdraw(2111)
            end
        end
    end
end

function click()
    click = not click
    if click then
        sampAddChatMessage('[Click] Flood - Active', -1)
    else
        sampAddChatMessage('[Click] Flood - Deactive', -1)
    end
end
 
  • Нравится
Реакции: Devourer007