PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: -3sixty- on 06 May, 2005, 03:06:58

Title: Multi Time Zone Message
Post by: -3sixty- on 06 May, 2005, 03:06:58
can anyone make me a script that displays the hub time and other timezones ??

e.g.

hub time: 02:06 [gmt]
sweden:  03:06
india     :  06:35
Title:
Post by: Dessamator on 06 May, 2005, 11:09:44
it has been done already, search the forum !!
Title:
Post by: -3sixty- on 06 May, 2005, 20:13:22
i have looked  ?(  where is it please
Title:
Post by: Dessamator on 06 May, 2005, 20:21:31
hmm, sorry i thought it already existed,
hubtime is simple to do, now other timezones that would b a bit challenging, theres quite a lot of countries in the world, even though they all follow a pattern, ud need to have a reference for all of them, or do u just want it for each continent?
Title:
Post by: -3sixty- on 06 May, 2005, 20:25:27
i would only add the timezones of the people in my hub, i only run a small hub for friends, so i would have the swedish time, finnish time, british time, hongkong and india

doesnt sound easy does it
Title:
Post by: Dessamator on 06 May, 2005, 21:48:35
not very hard, btw, can u give me the timezones for each of those, in comparison to gmt ?
Title: Time Zone v1
Post by: Dessamator on 06 May, 2005, 23:52:16
--Timezone script
--Requested by -3sixty-
--By Dessamator
--Cmds : !time & !timezone
-- Config --

urTime="2" -- ur local time in comparison to GMT
bot=frmHub:GetHubBotName() -- ur bot name

--The timezones for each country
tTimeZone = {
["Britain"] = 0,
["Honk Kong"] = 8,
["Sweden"] = 2,
["Finland"] = 3,
["India"] = 3,
["Hub Time"] = urTime,
}
-- Config End--

function ChatArrival(user,data)
local temp,hour ="\r\n\t\t".."Timezones: ".."\r\n".."\t".."Country".."\t\t\t".."Time".."\r\n\t"..string.rep("??",16).."\r\n",(os.date("%H"))
if hour== 0 or 1 then
hour=24-urTime
else
hour=(os.date("%H"))-urTime
end
data=string.sub(data,1,string.len(data)-1)
local s,e,cmd = string.find(data,"%b<>%s+(%S+)")

if cmd =="!time" then
user:SendPM(bot,os.date("The Current time is : %X"))
return 1
elseif cmd=="!timezone" then
for country,time in tTimeZone do
if string.len(country)<=8 then
if hour+time>24 then
temp = temp.."\t"..country.."\t\t\t"..os.date(("24"-hour+time)..":".."%M:%S".."\r\n")
else
temp = temp.."\t"..country.."\t\t\t"..os.date(hour+time..":".."%M:%S".."\r\n")
end
end
if string.len(country)>=8 then
if hour+time>24 then
temp = temp.."\t"..country.."\t\t"..os.date("24"-hour+time..":".."%M:%S".."\r\n")
else
temp = temp.."\t"..country.."\t\t"..os.date(hour+time..":".."%M:%S".."\r\n")
end
end
end
user:SendPM(bot,temp)
return 1
end
end

ToArrival = ChatArrival


Done !!
Title:
Post by: Dessamator on 07 May, 2005, 14:57:40
--Timezone script
--Requested by -3sixty-
--By Dessamator
--modded(Cleaning up) by Jiten
--Cmds : !time & !timezone

-- Config --

uTime="12" -- difference between ur time and GMT
bot = frmHub:GetHubBotName() -- ur bot name

--The timezones for each country
tTimeZone = {
["Britain"] = 0,
["Honk Kong"] = 8,
["Sweden"] = 2,
["Finland"] = 3,
["India"] = 3,
["Hub Time"] = uTime,
}
-- Config End--

function ChatArrival(user,data)
local data=string.sub(data,1,-2)
local s,e,cmd = string.find(data,"%b<>%s+(%S+)")
local temp,GMT = "\r\n\t\t".."Timezones: ".."\r\n".."\t".."Country".."\t\t\t".."Time".."\r\n\t"..string.rep("??",16).."\r\n", (os.date("%H")) - uTime
if GMT < 0 then GMT = 24 - uTime + (os.date("%H")) end
if cmd =="!time" then
user:SendData(bot,os.date("The Current time is : %X"))
return 1
elseif cmd=="!timezone" then
for country,time in tTimeZone do
local tab = "\t\t\t"
if string.len(country) >=8 then tab = "\t\t" end
temp = temp.."\t"..country..tab..os.date(GMT+time..":".."%M:%S".."\r\n")
end
user:SendData(bot,temp)
return 1
end
end

ToArrival = ChatArrival
Title:
Post by: jiten on 07 May, 2005, 18:37:13
Heya Dessamator. Small fix in the code:
if GMT < 0 then GMT = 24 - uTime - 1 end
to
if GMT < 0 then GMT = 24 - uTime + (os.date("%H")) end
Cheers
Title:
Post by: Dessamator on 07 May, 2005, 18:52:20
QuoteOriginally posted by jiten
Heya Dessamator. Small fix in the code:
if GMT < 0 then GMT = 24 - uTime - 1 end
to
if GMT < 0 then GMT = 24 - uTime + (os.date("%H")) end
Cheers

Done !