12-23-2014, 07:38 PM
(12-23-2014, 07:06 PM)STR_Warrior Wrote: The cWorld:ScheduleTask only schedules a function once. You have to reschedule it every time.Well, i've only the Hook Option with HOOK_WORLD_TICK?
http://mc-server.xoft.cz/LuaAPI/OnWorldTick.html
Here my Example Code:
Code:
function Initialize(Plugin)
Plugin:SetName("MyPlugin")
Plugin:SetVersion(1)
cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick)
return true
end
function TaskFunction(World)
LOG(World:GetName())
end
function OnTick(Time)
local World = cRoot:Get():GetDefaultWorld()
World:ScheduleTask(10,
function()
LOG("Execute")
end
)
end