Hi, I'm using tfs 0.3.6 and when I try to use a script on my server which should report some possible bugs on the server so I can read them in logs but I got a bug in a console:
and that's a script
Did anyone know to fix that? thanks
Code:
[01/02/2014 00:30:41] [Error - TalkAction Interface]
[01/02/2014 00:30:41] data/talkactions/scripts/bug.lua:onSay
[01/02/2014 00:30:41] Description:
[01/02/2014 00:30:41] data/talkactions/scripts/bug.lua:4: attempt to call global 'checkExhausted' (a nil value)
[01/02/2014 00:30:41] stack traceback:
[01/02/2014 00:30:41] data/talkactions/scripts/bug.lua:4: in function <data/talkactions/scripts/bug.lua:1>
and that's a script
Code:
function onSay(cid, words, param, channel)
if(not checkExhausted(cid, 714, 600)) then
return true
end
if(param == '') then
return true
end
local c = {
name_of_database = getConfigInfo('sqlDatabase'),
check_positions = "yes",
max_reports_per_day = 5,
days_reports_storage = 7326,
every_reports_storage = 7329,
}
local DZIEN = "" .. c.days_reports_storage .. "" ..os.date("%d") .. "" .. os.date("%m") ..""
if getPlayerStorageValue(cid, c.days_reports_storage) == -1 then
setPlayerStorageValue(cid, c.days_reports_storage, 1)
end
if getPlayerStorageValue(cid, c.every_reports_storage) == -1 then
setPlayerStorageValue(cid, c.every_reports_storage, 1)
end
local how_many_reports_send_today = getPlayerStorageValue(cid, c.days_reports_storage)
local every_reports = getPlayerStorageValue(cid, c.every_reports_storage)
local how_many_reports_can_player_send_per_day = getConfigInfo('avivable_reports_per_day') - how_many_reports_send_today
if how_many_reports_send_today < getConfigInfo('avivable_reports_per_day') then
if c.check_positions ~= "no" then
pos = getPlayerPosition(cid)
player_position = " [X: "..pos.x.." | Y: "..pos.y.." | Z: "..pos.z.."] "
else
player_position = "."
end
local what_date_is_today = os.date("%a %b %d %X %Y")
if getConfigValue('where_going_reports') == "db.executeQuery" then
db.executeQuery("INSERT INTO `" .. c.name_of_database .."`.`bugs`(`data` ,`player_name` ,`player_position` ,`report_description`, `status`, `show_on_web`) VALUES ('" .. what_date_is_today .. "', '" .. getPlayerName(cid) .. "', '" .. player_position .. "', '" .. param .. "', 'waiting', 'no');")
how_many_reports_send_todayM = how_many_reports_send_today + 1
setPlayerStorageValue(cid, c.days_reports_storage, how_many_reports_send_today + 1)
setPlayerStorageValue(cid, c.every_reports_storage, every_reports + 1)
elseif getConfigValue('where_going_reports') == "db.query" then
db.query("INSERT INTO `" .. c.name_of_database .."`.`bugs`(`data` ,`player_name` ,`player_position` ,`report_description`, `status`, `show_on_web`) VALUES ('" .. what_date_is_today .. "', '" .. getPlayerName(cid) .. "', '" .. player_position .. "', '" .. param .. "', 'waiting', 'no');")
how_many_reports_send_todayM = how_many_reports_send_today + 1
setPlayerStorageValue(cid, c.days_reports_storage, how_many_reports_send_today + 1)
setPlayerStorageValue(cid, c.every_reports_storage, every_reports + 1)
elseif getConfigValue('where_going_reports') == "log" then
f = assert(io.open("./data/logs/bug.txt", "a+"))
f = io.open("./data/logs/bug.txt", "a+")
f:write("\n " .. what_date_is_today .." [" .. getPlayerName(cid) .. "]" .. player_position .. ": " .. param .. "")
f:close()
how_many_reports_send_todayM = how_many_reports_send_today + 1
setPlayerStorageValue(cid, c.days_reports_storage, how_many_reports_send_today + 1)
setPlayerStorageValue(cid, c.every_reports_storage, every_reports + 1)
end
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your report has been sent to " .. getConfigValue('serverName') .. ". It's your " .. every_reports .. ", and you can sent " .. how_many_reports_can_player_send_per_day .." reports this day.")
doPlayerSendTextMessage(cid, 19,"ZGLOSILES BUGA. DZIEKUJEMY! ZOSTANIE ON ODCZYTANY I POPRAWIONY PRZEZ ADMINISTRATORA SERWERA.")
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You can't report more bugs this day")
end
return true
end
Did anyone know to fix that? thanks