Не работает скрипт

Vladimir_Barsamov

Новичок
Автор темы
11
1
Версия MoonLoader
.026-beta
Приветствую. Скачал скрипт один, раньше работал, щас перестал что-то, помогите пожалуйста (Вот код:
Code:
local on = require "lib.samp.events"
local inicfg = require 'inicfg'
script_name("������� ���������� ans") -- ������������� ��� �������, ������������, ��������, � ����
script_authors("������� ��� ��������! ����� - Ryan_Xstyle")
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
  }
})
sms('New file',-1)
anotherIni.sett.day = os.date(arr.day)
--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, 1205, 725, 0xFFFFFFFF) end
    zae()

    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 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

Вот отрывок по этому скрипту из moonloader.log
Log:
[09:46:47.805162] (system)    Loading script 'C:\summer gta samp by harnelo\moonloader\ans (1).lua'...
[09:46:47.805162] (debug)    New script: 01B429C4
[09:46:47.818164] (error)    ������� ���������� ans: opcode '0AF8' call caused an unhandled exception
stack traceback:
    [C]: in function 'sms'
    C:\summer gta samp by harnelo\moonloader\ans (1).lua:20: in main chunk
[09:46:47.818164] (error)    ������� ���������� ans: Script died due to an error. (01B429C4)
 

Vladimir_Barsamov

Новичок
Автор темы
11
1
code:
local on = require "lib.samp.events"
local inicfg = require 'inicfg'
script_name("Подсчёт отвеченных ans") -- устанавливает имя скрипта, отображаемое, например, в логе
script_authors("Подсчёт анс Загружен! Автор - Ryan_Xstyle")
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
  }
})
sms('New file',-1)
anotherIni.sett.day = os.date(arr.day)
--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, 1205, 725, 0xFFFFFFFF) end
    zae()

    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 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
log:
[19:06:06.128623] (system)    Loading script 'C:\summer gta samp by harnelo\moonloader\ans (1).lua'...
[19:06:06.128623] (debug)    New script: 01C3576C
[19:06:06.134622] (error)    Подсчёт отвеченных ans: opcode '0AF8' call caused an unhandled exception
stack traceback:
    [C]: in function 'sms'
    C:\summer gta samp by harnelo\moonloader\ans (1).lua:20: in main chunk
[19:06:06.134622] (error)    Подсчёт отвеченных ans: Script died due to an error. (01C3576C)
Кодировку на Windows 1251 меняй, и будет счастье