local config = { -- hour 0-23 localtime
time_start = 16,
time_end = 17
}
function onStepIn(player, item, position, fromPos)
if isPlayer(player) then
local current_hour = os.date('*t', os.time()).hour
if current_hour >= config.time_start and current_hour <= config.time_end then
doPlayerSendTextMessage(player, MESSAGE_EVENT_DEFAULT, 'Welcomen.')
return true
end
doPlayerSendTextMessage(player, MESSAGE_EVENT_DEFAULT, 'Sorry, not posible.')
doTeleportThing(player, fromPos)
doSendMagicEffect(fromPos, CONST_ME_TELEPORT)
end
return true
end
nice indendationLUA:local config = { -- hour 0-23 localtime time_start = 16, time_end = 17 } function onStepIn(player, item, position, fromPos) if isPlayer(player) then local current_hour = os.date('*t', os.time()).hour if current_hour >= config.time_start and current_hour <= config.time_end then doPlayerSendTextMessage(player, MESSAGE_EVENT_DEFAULT, 'Welcomen.') return true end doPlayerSendTextMessage(player, MESSAGE_EVENT_DEFAULT, 'Sorry, not posible.') doTeleportThing(player, fromPos) doSendMagicEffect(fromPos, CONST_ME_TELEPORT) end return true end
LUA:local config = { -- hour 0-23 localtime time_start = 16, time_end = 17 } function onStepIn(player, item, position, fromPos) if isPlayer(player) then local current_hour = os.date('*t', os.time()).hour if current_hour >= config.time_start and current_hour <= config.time_end then doPlayerSendTextMessage(player, MESSAGE_EVENT_DEFAULT, 'Welcomen.') return true end doPlayerSendTextMessage(player, MESSAGE_EVENT_DEFAULT, 'Sorry, not posible.') doTeleportThing(player, fromPos) doSendMagicEffect(fromPos, CONST_ME_TELEPORT) end return true end
The code uses the local time of your computer, you do not have to put labels of regions to him or anything like thatWhich tag should I use? I am a "layman" in the scripts area
-- script global events
function onTime(interval)
broadcastMessage("Teleport time zone is active.", MESSAGE_STATUS_WARNING)
return true
end
<globalevent name="Broadcast_timezone" time="16:00:00" script="myscript.lua" />