функция помощи луны

SpinQuatts

Известный
Автор темы
52
2
как мне поставить два условия в этой функции?

Код:
    function sampev.onServerMessage(color, text)
   if text:find('') then
      lua_thread.create(function()
      end)
   end
end
 
Решение
lua_thread.create(function() необходимо

Я пытался так:

Lua:
    function sampev.onServerMessage(color, text)
        if state and text:find('a') then
    lua_thread.create(function()      

        --code

          elseif text:find('b') then
       
        --code

        end)
    end
end

и так тоже
Lua:
        if state and text:find('a') then
    lua_thread.create(function()      

        --code
end)
          elseif text:find('b') then
           lua_thread.create(function()  
       
        --code

        end)
    end
end

но это не сработало
Lua:
function sampev.onServerMessage(color, text)
    if text:find('1') then
        lua_thread.create(function()
            wait(2000)
            print('Прошло 2...

SpinQuatts

Известный
Автор темы
52
2
Какие 2 условия?
Lua:
local a = 1
local b = 1
function sampev.onServerMessage(color, text)
    if text:find('') and a == b then
        if color == 12355114523 then
            lua_thread.create(function()
            end)
        end
    end
end

Я хочу что-то вроде этого:

Lua:
function sampev.onServerMessage(color, text)
   if state and text:find('a') then
      lua_thread.create(function()
                                        // код  1//
                end)
            end
    if state and text:find('b') then
              lua_thread.create(function()
                                        // код  2//
         end)
    end
end

почему не работает?
if text:find('1') and/or text:find('2') then
Я знаю это, но мне нужно два разных действия
 
Последнее редактирование:

CaJlaT

07.11.2024 14:55
Модератор
2,855
2,727
Я хочу что-то вроде этого:

Lua:
function sampev.onServerMessage(color, text)
   if state and text:find('a') then
      lua_thread.create(function()
                                        // код  1//
                end)
            end
    if state and text:find('b') then
              lua_thread.create(function()
                                        // код  2//
         end)
    end
end

почему не работает?

Я знаю это, но мне нужно два разных действия
Lua:
function sampev.onServerMessage(color, text)
    if text:find('1') then
        --code
    elseif text:find('2') then
        --code
    end
end
 

SpinQuatts

Известный
Автор темы
52
2
Lua:
function sampev.onServerMessage(color, text)
    if text:find('1') then
        --code
    elseif text:find('2') then
        --code
    end
end

lua_thread.create(function() необходимо

Я пытался так:

Lua:
    function sampev.onServerMessage(color, text)
        if state and text:find('a') then
    lua_thread.create(function()      

        --code

          elseif text:find('b') then
       
        --code

        end)
    end
end

и так тоже
Lua:
           function sampev.onServerMessage(color, text)
 if state and text:find('a') then
    lua_thread.create(function()      

        --code
end)
          elseif text:find('b') then
           lua_thread.create(function()  
       
        --code

        end)
    end
end

но это не сработало
 

CaJlaT

07.11.2024 14:55
Модератор
2,855
2,727
lua_thread.create(function() необходимо

Я пытался так:

Lua:
    function sampev.onServerMessage(color, text)
        if state and text:find('a') then
    lua_thread.create(function()      

        --code

          elseif text:find('b') then
       
        --code

        end)
    end
end

и так тоже
Lua:
        if state and text:find('a') then
    lua_thread.create(function()      

        --code
end)
          elseif text:find('b') then
           lua_thread.create(function()  
       
        --code

        end)
    end
end

но это не сработало
Lua:
function sampev.onServerMessage(color, text)
    if text:find('1') then
        lua_thread.create(function()
            wait(2000)
            print('Прошло 2 секунды после сообщения: '..text)
        end)
    elseif text:find('2') then
        lua_thread.create(function()
            wait(5000)
            print('Прошло 5 секунд после сообщения: '..text)
        end)
    end
end