Как продолжить код, подскажите

Kirill Dumchik

Участник
Автор темы
61
3
Версия MoonLoader
Другое
Подскажите, как продолжить код, чтобы реагировало на 2 слово, пробовал многое но чет не могу догнать как.\
Типо он щас реагирует на 123, а хочу чтобы еще и на 345 реагировало
1:
function sampev.onServerMessage(color, text)
  if text:find("123")then
  lua_thread.create(function()
        wait(2000)
        sampAddChatMessage("{FF8C00}[папв] {FFFAFA}Привет, {4682B4}"..sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) .. main_color_text .. "{FFFAFA}. Тызаыха", -1)
    end)
  end
end
 
  • Нравится
Реакции: PoundFoolish
Решение
Спасибо.А можно как то, чтобы на 345 шел другой мессейнж?
Lua:
function sampev.onServerMessage(color, text)
  if text:find("123") then
    lua_thread.create(function()
        wait(2000)
        sampAddChatMessage("{FF8C00}[папв] {FFFAFA}Привет, {4682B4}"..sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) .. main_color_text .. "{FFFAFA}. Тызаыха", -1)
    end)
   elseif text:find("456") then
    lua_thread.create(function()
        wait(2000)
        sampAddChatMessage("{FF8C00}[kfkfjf] {FFFAFA}Привет, {4682B4}"..sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) .. main_color_text .. "{FFFAFA}. Тызаыха", -1)
    end)
  end
end

Dmitriy Makarov

25.05.2021
Проверенный
2,478
1,113
Lua:
function sampev.onServerMessage(color, text)
    if text:find("123") or text:find("345") then -- Если найдёт "123" или "345", то..
        lua_thread.create(function()
            wait(2000)
            sampAddChatMessage("{FF8C00}[папв] {FFFAFA}Привет, {4682B4}"..sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) .. main_color_text .. "{FFFAFA}. Тызаыха", -1)
        end)
    end
end
 

PoundFoolish

Участник
81
1
Lua:
function sampev.onServerMessage(color, text)
    if text:find("123") or text:find("345") then -- Если найдёт "123" или "345", то..
        lua_thread.create(function()
            wait(2000)
            sampAddChatMessage("{FF8C00}[папв] {FFFAFA}Привет, {4682B4}"..sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) .. main_color_text .. "{FFFAFA}. Тызаыха", -1)
        end)
    end
end
Спасибо.А можно как то, чтобы на 345 шел другой мессейнж?
 

neverlane

t.me/neverlane00
Друг
997
1,132
Спасибо.А можно как то, чтобы на 345 шел другой мессейнж?
Lua:
function sampev.onServerMessage(color, text)
  if text:find("123") then
    lua_thread.create(function()
        wait(2000)
        sampAddChatMessage("{FF8C00}[папв] {FFFAFA}Привет, {4682B4}"..sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) .. main_color_text .. "{FFFAFA}. Тызаыха", -1)
    end)
   elseif text:find("456") then
    lua_thread.create(function()
        wait(2000)
        sampAddChatMessage("{FF8C00}[kfkfjf] {FFFAFA}Привет, {4682B4}"..sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) .. main_color_text .. "{FFFAFA}. Тызаыха", -1)
    end)
  end
end
 
  • Нравится
Реакции: PoundFoolish