Счетчик репортов, проблема

Farshmak_Savage

Новичок
Автор темы
25
1
Версия MoonLoader
.027.0-preview
в общем, у меня есть такой код
Код:
require("lib.moonloader")
local imgui = require 'imgui'
local sampev = require 'lib.samp.events'

local testw = imgui.ImBool(false)
local rcount = imgui.ImInt(0)

function sampev.onServerMessage(color, text)
    _, myID = sampGetPlayerIdByCharHandle(PLAYER_PED)
    myname = sampGetPlayerNickname(myID)
    if text:find('.+%[%w+]:%s'..tostring(myname)..'[%d+] ответил %w+_%w+%[%d+]:.+') then
        rcount.v = rcount.v + 1
    end
end

function imgui.OnDrawFrame()
    if testw.v then
        imgui.SetNextWindowPos(imgui.ImVec2(300, 300), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(482, 295), imgui.Cond.FirstUseEver)
        imgui.Begin('STATS', testw)
        imgui.Text('repcount: '..rcount.v)
        imgui.End()
    end
end

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('rctest', function() testw.v = not testw.v end)
    while true do
        imgui.ShowCursor = rcount.v
        imgui.Process = rcount.v
        wait(0)
    end
end
по идее, он должен считать сообщения по форме *[R]: Nick_Name[37] ответил Nick_Name[84]: русский текст, только с моим ником, но он не считает, в чем проблема?
 
Решение
Хмм... Я знакомому делал счетчик репортов, хз может пойдет тебе
Lua:
local on = require "lib.samp.events"
local inicfg = require 'inicfg'

local arr = os.date("*t")
local sms = sampAddChatMessage

local font_flag = require('moonloader').font_flag
local my_font = renderCreateFont('Verdana', 12, font_flag.BOLD + font_flag.SHADOW + font_flag.BORDER)

local anotherIni = inicfg.load(nil, "adm")
if anotherIni == nil then
local anotherIni = inicfg.load({
    sett =
    {
        ['otv'] = 0,
        ['day'] = -1
    }
})
anotherIni.sett.day = os.date(arr.day)
inicfg.save(anotherIni,'adm')
sms('Перезагрузите скрипты',-1)
end

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do...

qdIbp

Автор темы
Проверенный
1,387
1,141
Хмм... Я знакомому делал счетчик репортов, хз может пойдет тебе
Lua:
local on = require "lib.samp.events"
local inicfg = require 'inicfg'

local arr = os.date("*t")
local sms = sampAddChatMessage

local font_flag = require('moonloader').font_flag
local my_font = renderCreateFont('Verdana', 12, font_flag.BOLD + font_flag.SHADOW + font_flag.BORDER)

local anotherIni = inicfg.load(nil, "adm")
if anotherIni == nil then
local anotherIni = inicfg.load({
    sett =
    {
        ['otv'] = 0,
        ['day'] = -1
    }
})
anotherIni.sett.day = os.date(arr.day)
inicfg.save(anotherIni,'adm')
sms('Перезагрузите скрипты',-1)
end

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    while true do wait(0)
    if anotherIni ~= nil then renderFontDrawText(my_font,'Oтветов: '..anotherIni.sett.otv..'\nДень: '..anotherIni.sett.day, 10, 400, 0xFFFFFFFF) end
    if tonumber(os.date(arr.day)) ~= tonumber(anotherIni.sett.day) then
        anotherIni.sett.otv = 0
        anotherIni.sett.day = os.date(arr.day)
        inicfg.save(anotherIni,'adm')
    end

    end
end

function on.onServerMessage(color, text)
    if text:find(sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)))..'%[%d+] ответил (%w+_%w+)%[%d+]:') then
        sms('FistingAnal круче',-1)
        anotherIni.sett.otv = anotherIni.sett.otv + 1
        inicfg.save(anotherIni, 'adm')
    end
end
 

Farshmak_Savage

Новичок
Автор темы
25
1
Хмм... Я знакомому делал счетчик репортов, хз может пойдет тебе
Lua:
local on = require "lib.samp.events"
local inicfg = require 'inicfg'

local arr = os.date("*t")
local sms = sampAddChatMessage

local font_flag = require('moonloader').font_flag
local my_font = renderCreateFont('Verdana', 12, font_flag.BOLD + font_flag.SHADOW + font_flag.BORDER)

local anotherIni = inicfg.load(nil, "adm")
if anotherIni == nil then
local anotherIni = inicfg.load({
    sett =
    {
        ['otv'] = 0,
        ['day'] = -1
    }
})
anotherIni.sett.day = os.date(arr.day)
inicfg.save(anotherIni,'adm')
sms('Перезагрузите скрипты',-1)
end

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    while true do wait(0)
    if anotherIni ~= nil then renderFontDrawText(my_font,'Oтветов: '..anotherIni.sett.otv..'\nДень: '..anotherIni.sett.day, 10, 400, 0xFFFFFFFF) end
    if tonumber(os.date(arr.day)) ~= tonumber(anotherIni.sett.day) then
        anotherIni.sett.otv = 0
        anotherIni.sett.day = os.date(arr.day)
        inicfg.save(anotherIni,'adm')
    end

    end
end

function on.onServerMessage(color, text)
    if text:find(sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)))..'%[%d+] ответил (%w+_%w+)%[%d+]:') then
        sms('FistingAnal круче',-1)
        anotherIni.sett.otv = anotherIni.sett.otv + 1
        inicfg.save(anotherIni, 'adm')
    end
end
сейчас чекну, спасибо

Хмм... Я знакомому делал счетчик репортов, хз может пойдет тебе
Lua:
local on = require "lib.samp.events"
local inicfg = require 'inicfg'

local arr = os.date("*t")
local sms = sampAddChatMessage

local font_flag = require('moonloader').font_flag
local my_font = renderCreateFont('Verdana', 12, font_flag.BOLD + font_flag.SHADOW + font_flag.BORDER)

local anotherIni = inicfg.load(nil, "adm")
if anotherIni == nil then
local anotherIni = inicfg.load({
    sett =
    {
        ['otv'] = 0,
        ['day'] = -1
    }
})
anotherIni.sett.day = os.date(arr.day)
inicfg.save(anotherIni,'adm')
sms('Перезагрузите скрипты',-1)
end

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    while true do wait(0)
    if anotherIni ~= nil then renderFontDrawText(my_font,'Oтветов: '..anotherIni.sett.otv..'\nДень: '..anotherIni.sett.day, 10, 400, 0xFFFFFFFF) end
    if tonumber(os.date(arr.day)) ~= tonumber(anotherIni.sett.day) then
        anotherIni.sett.otv = 0
        anotherIni.sett.day = os.date(arr.day)
        inicfg.save(anotherIni,'adm')
    end

    end
end

function on.onServerMessage(color, text)
    if text:find(sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)))..'%[%d+] ответил (%w+_%w+)%[%d+]:') then
        sms('FistingAnal круче',-1)
        anotherIni.sett.otv = anotherIni.sett.otv + 1
        inicfg.save(anotherIni, 'adm')
    end
end
да, работает, спасибо