Поговорим о onServerMessage

plohoy.

Известный
Автор темы
109
25
Версия MoonLoader
.026-beta
Код:
local sampev = require 'lib.samp.events'
local gg = require 'lib.samp.events'
local bb = require 'lib.samp.events'

function sampev.onServerMessage(color, text)
    if text:find("test") and box1.v then
        sendTelegramNotification('test')
    end
end
   
    function gg.onServerMessage(color, text)
    if text:find("test1") and box2.v then
        sendTelegramNotification('тест1')
    end
end

function bb.onServerMessage(color, text)
    if text:find("test2") and box3.v then
        sendTelegramNotification('test2')
    end
end
Так не работает, а по отдельности работает, как пофиксить?
 
  • Bug
Реакции: zTechnology
Решение
Lua:
local sampev = require 'lib.samp.events'

function sampev.onServerMessage(color, text)
    if text:find("test") and box1.v then
        sendTelegramNotification('test')       
    elseif text:find("test1") and box2.v then
        sendTelegramNotification('тест1')
    elseif text:find("test2") and box3.v then
        sendTelegramNotification('test2')
    end
end

HavenS

Участник
76
19
Lua:
local sampev = require 'lib.samp.events'

function sampev.onServerMessage(color, text)
    if text:find("test") and box1.v then
        sendTelegramNotification('test')       
    elseif text:find("test1") and box2.v then
        sendTelegramNotification('тест1')
    elseif text:find("test2") and box3.v then
        sendTelegramNotification('test2')
    end
end
 
  • Нравится
Реакции: plohoy.