local on = require "lib.samp.events"
local inicfg = require 'inicfg'
script_name("брух") -- устанавливает имя скрипта, отображаемое, например, в логе
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,
['times'] = -1,
}
}
)
sms('New file',-1)
anotherIni.sett.day = os.date(arr.day)
anotherIni.sett.times = os.date('%H:%M:%S')
--print(anotherIni.sett.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..'\nВремя: '..anotherIni.sett.times, 10, 550, 0xFFFFFFFF) end
zae()
times()
end
end
function zae()
if tonumber(anotherIni.sett.day) ~= tonumber(os.date(arr.day)) then print(anotherIni.sett.day,os.date(arr.day))
--anotherIni.sett.otv = 0
anotherIni.sett.day = os.date(arr.day)
inicfg.save(anotherIni,'adm')
end
end
function times()
if tonumber(anotherIni.sett.time) ~= tonumber(os.date('%H:%M:%S')) then print(anotherIni.sett.time,os.date('%H:%M:%S'))
--anotherIni.sett.otv = 0
anotherIni.sett.time = os.date('%H:%M:%S')
inicfg.save(anotherIni,'adm')
end
end
function on.onServerMessage(color, text)
if text:find(sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)))..'%[%d+] ответил (%w+_%w+)%[%d+]:') then
anotherIni.sett.otv = anotherIni.sett.otv + 1
inicfg.save(anotherIni, 'adm')
end
end