Исходник Софт [ImGui] Global notification

wD.D159

Известный
Друг
446
479
Не выводит инфу в уведомления, пишет nil


Lua:
require 'lib.moonloader'
local SE = require 'lib.samp.events'
local notf = import 'imgui_notf.lua'

activ = 0
aotv = 0
sled = 0

function SE.onServerMessage(color, text)
    if text:find('%*%* Жалоба от .+%(%d+%) на .+%(%d+%): .+') then
        ID1, ID3, ID2, text = text:match('%*%* Жалоба от .+%((%d+)%) на (.+%)((%d+)%): (.+)')
        notf.addNotification(string.format("Жалоба:\n\n\nИгрок: %s \n\nКомментарий: %s", ID3, text), 15)
        activ = 1
        aotv = 1
    end
    if text:find('Ошибка') and text:find('За игроком уже следят') then
        sled = 1
    end
end

function main()
(-1)
end
 

AnWu

Guardian of Order
Автор темы
Всефорумный модератор
4,687
5,164
Не выводит инфу в уведомления, пишет nil


Lua:
require 'lib.moonloader'
local SE = require 'lib.samp.events'
local notf = import 'imgui_notf.lua'

activ = 0
aotv = 0
sled = 0

function SE.onServerMessage(color, text)
    if text:find('%*%* Жалоба от .+%(%d+%) на .+%(%d+%): .+') then
        ID1, ID3, ID2, text = text:match('%*%* Жалоба от .+%((%d+)%) на (.+%)((%d+)%): (.+)')
        notf.addNotification(string.format("Жалоба:\n\n\nИгрок: %s \n\nКомментарий: %s", ID3, text), 15)
        activ = 1
        aotv = 1
    end
    if text:find('Ошибка') and text:find('За игроком уже следят') then
        sled = 1
    end
end

function main()
(-1)
end
очевидно же что проблема в регулярке. строку из чат лога и что нужно тянуть дай
 

AnWu

Guardian of Order
Автор темы
Всефорумный модератор
4,687
5,164
УПД: Это не обновление. Видео никак не связано с этим дерьмом что тут! Моя цель обеспечить связь скриптов и сделать единый центр скриптов!
 

SanyaVersus

Участник
65
1
Нужен хелп
Как убрать иероглифы?
XIZIs7C.png



require "lib.moonloader"
local notf = import 'imgui_notf.lua'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

function main()
while not isSampAvailable() do wait(0) end
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while true do
wait(0)

if not sampIsChatInputActive() then
if not sampIsDialogActive() then
if isKeyJustPressed(VK_R) then
sampSendChat("/healme")
notf.addNotification(string.format("Уведомление\n\nВы использовали аптечку"), 5)
end
end
end
end
end


P.S Не ебу в скриптинге от слова совсем
 
Последнее редактирование:

Oreshka23

Известный
338
164
Нужен хелп
Как убрать иероглифы?
XIZIs7C.png



require "lib.moonloader"
local notf = import 'imgui_notf.lua'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

function main()
while not isSampAvailable() do wait(0) end
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while true do
wait(0)

if not sampIsChatInputActive() then
if not sampIsDialogActive() then
if isKeyJustPressed(VK_R) then
sampSendChat("/healme")
notf.addNotification(string.format("Уведомление\n\nВы использовали аптечку"), 5)
end
end
end
end
end


P.S Не ебу в скриптинге от слова совсем

notf.addNotification(u8("Уведомление\n\nВы использовали аптечку"), 5)
 

SanyaVersus

Участник
65
1
Не работает(

require "lib.moonloader"
local notf = import 'imgui_notf.lua'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

function main()
while not isSampAvailable() do wait(0) end
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while true do
wait(0)

if not sampIsChatInputActive() then
if not sampIsDialogActive() then
if isKeyJustPressed(VK_R) then
sampSendChat("/healme")
notf.addNotification(u8("Уведомление\n\nВы использовали аптечку"), 5)
end
end
end
end
end
какие-то иероглифы
можете сами чекнуть
нужен испрвленный скрипт, там где нет этой хни
 

trefa

Известный
Всефорумный модератор
2,097
1,230
Не работает(

require "lib.moonloader"
local notf = import 'imgui_notf.lua'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

function main()
while not isSampAvailable() do wait(0) end
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while true do
wait(0)

if not sampIsChatInputActive() then
if not sampIsDialogActive() then
if isKeyJustPressed(VK_R) then
sampSendChat("/healme")
notf.addNotification(u8("Уведомление\n\nВы использовали аптечку"), 5)
end
end
end
end
end
какие-то иероглифы
можете сами чекнуть
нужен испрвленный скрипт, там где нет этой хни
Кодировка какая стоит?
 

AnWu

Guardian of Order
Автор темы
Всефорумный модератор
4,687
5,164
сам файл не той кодировки. Нужна Windows-1251
 

atizoff

приобретаю кашель за деньги
Проверенный
1,295
1,178
сам файл не той кодировки. Нужна Windows-1251
то же самое

Lua:
local notf = import 'imgui_notf.lua'
require 'lib.moonloader'
local imgui = require 'imgui'
local encoding = require 'encoding' -- загружаем библиотеку
local sampev = require 'samp.events'
encoding.default = 'CP1251' -- указываем кодировку по умолчанию, она должна совпадать с кодировкой файла. CP1251 - это Windows-1251
u8 = encoding.UTF8 -- и создаём короткий псевдоним для кодировщика UTF-8
--
--
function sampev.onServerMessage(clr, txt)
    if txt:find("Администратор") then
        notf.addNotification(u8("Уведомление\n\nВам написал администратор."), 5)
    end
end
 

AnWu

Guardian of Order
Автор темы
Всефорумный модератор
4,687
5,164
то же самое

Lua:
local notf = import 'imgui_notf.lua'
require 'lib.moonloader'
local imgui = require 'imgui'
local encoding = require 'encoding' -- загружаем библиотеку
local sampev = require 'samp.events'
encoding.default = 'CP1251' -- указываем кодировку по умолчанию, она должна совпадать с кодировкой файла. CP1251 - это Windows-1251
u8 = encoding.UTF8 -- и создаём короткий псевдоним для кодировщика UTF-8
--
--
function sampev.onServerMessage(clr, txt)
    if txt:find("Администратор") then
        notf.addNotification(u8("Уведомление\n\nВам написал администратор."), 5)
    end
end
upload_2018-10-31_0-57-58.png

в редакторе выбери
 

SanyaVersus

Участник
65
1
Ааа, спс. Я думал из-за вот этой encoding.default = 'CP1251', автоматом стояло Windows 1251