когда вместе не робит код

Oki_Bern

Участник
Автор темы
169
6
смотрите столкнулся с такой проблемой, когда эти два кода вместе, второй из них работает а первый не работает, в чем проблемка может быть?

Lua:
local samp = require('samp.events')
function samp.onServerMessage(color, text)
    if text:find('text') then
        lua_thread.create(function()
            wait(1000)
            ctm = false
            sampAddChatMessage('text', -1)
         end)
    end
end

local samp = require('samp.events')
function samp.onServerMessage(color, text)
    if text:find('text') then
        lua_thread.create(function()
            wait(1000)
            ctm = false
            sampAddChatMessage('text', -1)
         end)
    end
end
 
Решение
Lua:
local samp = require('samp.events')

function samp.onServerMessage(color, text)
    if text:find('text') then
        lua_thread.create(function()
            wait(1000)
            ctm = false
            sampAddChatMessage('text', -1)
        end)
    end
    if text:find('penis') then
        lua_thread.create(function()
            wait(1000)
            ctm = false
            sampAddChatMessage('text', -1)
        end)
    end
end

quesada

q-team
Проверенный
849
1,160
Lua:
local samp = require('samp.events')

function samp.onServerMessage(color, text)
    if text:find('text') then
        lua_thread.create(function()
            wait(1000)
            ctm = false
            sampAddChatMessage('text', -1)
        end)
    end
    if text:find('penis') then
        lua_thread.create(function()
            wait(1000)
            ctm = false
            sampAddChatMessage('text', -1)
        end)
    end
end
 
  • Нравится
Реакции: Artem Kolesnikov

Oki_Bern

Участник
Автор темы
169
6
Lua:
local samp = require('samp.events')

function samp.onServerMessage(color, text)
    if text:find('text') then
        lua_thread.create(function()
            wait(1000)
            ctm = false
            sampAddChatMessage('text', -1)
        end)
    end
    if text:find('penis') then
        lua_thread.create(function()
            wait(1000)
            ctm = false
            sampAddChatMessage('text', -1)
        end)
    end
end
Спасибо, а можно так же сделать связку из 4ех? (попробывал работает только первый и последний)
 

Hinаta

Известный
784
356
Спасибо, а можно так же сделать связку из 4ех? (попробывал работает только первый и последний)
их сколько угодно может быть, просто все условия должны быть в одной функции
 

Oki_Bern

Участник
Автор темы
169
6
их сколько угодно может быть, просто все условия должны быть в одной функции
да я понял, все сработало теперь, просто до этого наверное у меня слишком длинная строчка была, уменьшил ее и все заработало