Greeting - Time
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Greeting - Time

Started by Snooze, 08 June, 2007, 20:16:41

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Snooze

By request, a small mod of this script by Mutor..

--[[

	TOD LoginMsg 1.0 LUA 5.0/5.1
	
	By Mutor	05/17/07
	
	Requested by butch
	
	Greets connection by time of day with UTC timezone

	
	Example:
	
	<Mutor's Archive 5.1.1>

	Good Afternoon Mutor 

	Today is Thursday 17 May 2007 and the current time is 17 02 -5 UTC 


	[DXB]: Converted to DiXBoT on request - 7:46 PM 6/8/2007 by Snooze

]]

TimeGreet = {

	["NewUserConnected"] = {
		doTimeGreet = function(user, data)
			local h,g = tonumber(os.date("%H")),""
			local Tab = {
			[1] = {12,"Good Morning"},
			[2] = {18,"Good Afternoon"},
			[3] = {24,"Good Evening"},
		}
			for i,v in ipairs(Tab) do
				if h < v[1] then g = v[2] break end
			end
			local msg = "\r\n\r\n\t"..g.." "..user.sName.."\r\n\r\n"..
			"\tToday is "..os.date("%A %d %B %Y").." and the current time is "..
			os.date("%H %M").." "..TimeGreet.Func.doTimeZone().."\r\n\r\n"
			user:SendData(frmHub:GetHubName(),msg)
		end,
	},
	["OpConnected"] = {
		doTimeGreet = function(user, data)
			local h,g = tonumber(os.date("%H")),""
			local Tab = {
			[1] = {12,"Good Morning"},
			[2] = {18,"Good Afternoon"},
			[3] = {24,"Good Evening"},
		}
			for i,v in ipairs(Tab) do
				if h < v[1] then g = v[2] break end
			end
			local msg = "\r\n\r\n\t"..g.." "..user.sName.."\r\n\r\n"..
			"\tToday is "..os.date("%A %d %B %Y").." and the current time is "..
			os.date("%H %M").." "..TimeGreet.Func.doTimeZone().."\r\n\r\n"
			user:SendData(frmHub:GetHubName(),msg)
		end,
	},

	["Func"] = {	
		doTimeZone = function()
			--TimeGreet.Func.doTimeZone = function()
			local h,m = math.modf((os.time()-os.time(os.date"!*t"))/ 3600)
			return string.format("%+d UTC",(h + (60 * m)))
		end,
	},
}
DxbModule = TimeGreet


Simply copy to a textfile --> save as TimeGreet.lua  --> copy to the "scripts/DiXBoT/CoreSystem/" folder and restart scripts (a guide will be displayed in mainchat on how to activate this module)


All credits goes to Mutor for this script..

Can be downloaded from the DiXBoT Download Section - MODs.]DiXBoT Download Section - MODs.

-Snooze

SMF spam blocked by CleanTalk