jareczekjsp
Member
Hello I use TFS 0.4 and I have problem with timer events script I have Error in console and script not working can anyone help me ?please
my script in globalevents is :
and error in console is :
my script in globalevents is :
Lua:
local EventsListalist = {
{time = "01:00", name = "Snowball Event"},
{time = "02:00", name = "DesertWar Event"},
{time = "03:00", name = "Capture The Flag"},
{time = "04:00", name = "FireStorm Event"},
{time = "09:00", name = "Defend The Tower"},
{time = "10:00", name = "Snowball Event"},
{time = "11:00", name = "DesertWar Event"},
{time = "12:00", name = "Capture The Flag"},
{time = "13:00", name = "FireStorm Event"},
{time = "15:00", name = "Battlefield Event"},
{time = "16:00", name = "Defend The Tower"},
{time = "17:00", name = "Snowball Event"},
{time = "18:00", name = "DesertWar Event",},
{time = "19:00", name = "Capture The Flag",},
{time = "20:00", name = "FireStorm Event"},
{time = "21:00", name = "Real Castle"},
{time = "22:00", name = "Battlefield Event"},
{time = "23:00", name = "Defend The Tower"}
}
local position = {x = 158, y = 49, z = 7}
function onThink(interval, lastExecution)
local people = getPlayersOnline()
if #people == 0 then
return true
end
local Count = 0
for _, t in ipairs(EventsListalist) do
local eventTime = hourToNumber(t.time)
local realTime = hourToNumber(os.date("%H:%M:%S"))
if eventTime >= realTime then
doPlayerSay(people[1], "Próximo evento ŕs {"..t.time.."h} "..t.name..", faltam "..timeString(eventTime - realTime)..".", TALKTYPE_MONSTER_SAY, false, 0, position)
return true
end
Count = Count + 1
end
return true
end
and error in console is :
Code:
[12:3:44] [Error - GlobalEvent Interface]
[12:3:44] data/globalevents/scripts/eventsHenrique.lua:onThink
[12:3:44] Description:
[12:3:44] data/globalevents/scripts/eventsHenrique.lua:37: attempt to call global 'hourToNumber' (a nil value)
[12:3:44] stack traceback:
[12:3:44] data/globalevents/scripts/eventsHenrique.lua:37: in function <data/globalevents/scripts/eventsHenrique.lua:28>
[12:3:44] [Error - GlobalEvents::think] Couldn't execute event: eventos