lua трабл с SAMP.lua

andrey_hacker

Известный
Автор темы
274
88
Всем привет, дело в том, что когда я хочу сделать что-то типо этого:
Lua:
    if message:find('qq') then
        sampAddChatMessage('text', -1)
        return false
    end
и после того, как видит qq мне начинает флудиться text, а если я не буду писать return false то пишется 1 раз, помогите пожалуйста, как сделать так, чтобы text писался 1 раз даже с return false.
(Даже с return false показывается qq в чате)
 

andrey_hacker

Известный
Автор темы
274
88
Lua:
local event = require("lib.samp.event")
function event.onServerMessage(color, text)
    if text:find('qq') then
        sampAddChatMessage(text, -1)
        return false
    end
end
Вроде всё правильно, но это не точно.
в том-то и дело, что у меня оно флудит как бешенный
 

andrey_hacker

Известный
Автор темы
274
88
Lua:
while true do -- в мэине
        wait(0) 
    if mw.v == false then
        imgui.Process = false
    end
    if testCheat('pd') then
        apd1()
    end     
    if sampIsPlayerConnected(PLAYER_PED) then
    _, _, buffer, _ = sampTextdrawGetBoxEnabledColorAndSize(2061)
    buffer = buffer - imgui.ImVec2(sampTextdrawGetPos(2061)).x
    _, _, eat, _ = sampTextdrawGetBoxEnabledColorAndSize(2061)
    eat = (eat - imgui.ImVec2(sampTextdrawGetPos(2061)).x) * 1.83
    if eat < kushat.v then
        if autokushat.v then
            if eatmetod.v == 0 then
                sampAddChatMessage('Чисас поем', -1)
                wait(1500)
                sampSendChat('/eat')
                wait(2500)
                sampSendDialogResponse(9965, 1, 0, false)
                wait(1500)
                sampCloseCurrentDialogWithButton(0)
            end
            if eatmetod.v == 1 then
                sampAddChatMessage('Чисас поем', -1)
                wait(1500)
                sampSendChat('/eat') 
                wait(2500)
                sampSendDialogResponse(9965, 1, 2, false)
                wait(1500)
                sampCloseCurrentDialogWithButton(0)
            end
            if eatmetod.v == 2 then
                sampAddChatMessage('Чисас поем', -1)
                wait(1500)
                sampSendChat('/meatbag')
            end
            if eatmetod.v == 3 then
                sampSendChat('/home')
                wait(900)
                sampSendDialogResponse(174, 1, 1, false)
                wait(900)
                sampSendDialogResponse(2431, 1, 0, false)
                wait(900)
                sampSendDialogResponse(185, 1, 6, false)
            end
        end
    end
    end


function sampev.onServerMessage(color, message)
if message:find('qq') then
     sampAddChatMessage('text', -1)
     return false
end
end
 

|| NN - NoName ||

Известный
1,049
630
Сейчас всё сделал так же как у тебя, только не вставлял то, что у тебя в main, у меня всё норм.
Попробуй создай отдельный скрипт, в который вставь только:

Lua:
local sampev = require(lib.samp.events)

function sampev.onServerMessage(color, message)
  if message:find('qq') then
     sampAddChatMessage('text', -1)
     return false
  end
end

После чего, отпишись.
 

andrey_hacker

Известный
Автор темы
274
88
Сейчас всё сделал так же как у тебя, только не вставлял то, что у тебя в main, у меня всё норм.
Попробуй создай отдельный скрипт, в который вставь только:

Lua:
local sampev = require(lib.samp.events)

function sampev.onServerMessage(color, message)
  if message:find('qq') then
     sampAddChatMessage('text', -1)
     return false
  end
end

После чего, отпишись.
нормально работает
 

Tema05

Известный
1,442
402
Lua:
while true do -- в мэине
        wait(0)
    if mw.v == false then
        imgui.Process = false
    end
    if testCheat('pd') then
        apd1()
    end    
    if sampIsPlayerConnected(PLAYER_PED) then
    _, _, buffer, _ = sampTextdrawGetBoxEnabledColorAndSize(2061)
    buffer = buffer - imgui.ImVec2(sampTextdrawGetPos(2061)).x
    _, _, eat, _ = sampTextdrawGetBoxEnabledColorAndSize(2061)
    eat = (eat - imgui.ImVec2(sampTextdrawGetPos(2061)).x) * 1.83
    if eat < kushat.v then
        if autokushat.v then
            if eatmetod.v == 0 then
                sampAddChatMessage('Чисас поем', -1)
                wait(1500)
                sampSendChat('/eat')
                wait(2500)
                sampSendDialogResponse(9965, 1, 0, false)
                wait(1500)
                sampCloseCurrentDialogWithButton(0)
            end
            if eatmetod.v == 1 then
                sampAddChatMessage('Чисас поем', -1)
                wait(1500)
                sampSendChat('/eat')
                wait(2500)
                sampSendDialogResponse(9965, 1, 2, false)
                wait(1500)
                sampCloseCurrentDialogWithButton(0)
            end
            if eatmetod.v == 2 then
                sampAddChatMessage('Чисас поем', -1)
                wait(1500)
                sampSendChat('/meatbag')
            end
            if eatmetod.v == 3 then
                sampSendChat('/home')
                wait(900)
                sampSendDialogResponse(174, 1, 1, false)
                wait(900)
                sampSendDialogResponse(2431, 1, 0, false)
                wait(900)
                sampSendDialogResponse(185, 1, 6, false)
            end
        end
    end
    end


function sampev.onServerMessage(color, message)
if message:find('qq') then
     sampAddChatMessage('text', -1)
     return false
end
end
Зачем это?
Lua:
_, _, buffer, _ = sampTextdrawGetBoxEnabledColorAndSize(2061)
buffer = buffer - imgui.ImVec2(sampTextdrawGetPos(2061)).x