• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Script for the day and time

Bufo

-.-'
Joined
Jul 30, 2010
Messages
134
Reaction score
12
Location
P(R)OLAND
Hello I need a script which will be started at a given date and time. I tried to create something like that, but unfortunately, a naught effect and naught errors in console.

Lua:
goodConfig = {
	days = {['Monday'] = {'16:00:20'}, 
		['Tuesday'] = {'16:00:20'}, 
		['Wednesday'] = {'16:00:20'}, 
		['Thursday'] = {'16:00:20'}, 
		['Friday'] = {'16:00:20'}, 
		['Saturday'] = {'16:00:20'}, 
		['Sunday'] = {'12:35:00'}
		}
}
	local daysOpen = {}
			
function onThink(cid, interval)
	for k, v in pairs(goodConfig.days) do
		table.insert(daysOpen, k)
	end

		if isInArray(daysOpen, os.date("%A")) then
			if isInArray(goodConfig.days[os.date("%A")], os.date("%X", os.time())) then
				doBroadcastMessage("Start function script.")
			end
		end
	return TRUE
end

Somebody can help me ?
 
Last edited:
Hmm, not sure if this will work, but try:

Lua:
local t = {
	["monday"] = {12:00}
}

function onThink(cid, interval)
	local k = t[os.date("%A")]
	if(k and os.time() == k[1]) then
		-- do something
	else
		-- do something else
	end
	return true
end
I'm pretty sure you can designate specific times in the XML file to - globalevents.xml. ;)
 
Hmm ... Response for this:
Lua:
local t = {
	["Sunday"] = {'15:43:00'}
}
 
function onThink(cid, interval)
	local k = t[os.date("%A")]
	if(k and os.time() == k[1]) then
		doBroadcastMessage("nothing")
	end
	return true
end

0 errors in console :/

And you think about
<globalevent name="good" time="18:00:00" ...
<globalevent name="good" time="19:00:00" ...
etc. ?

Or the script in globalevents ?


Knowing what happens and the errors might be helpful..
The best part is that there are no errors in the console :/
 
Last edited:
Back
Top