PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Janhouse on 09 May, 2004, 14:21:29

Title: Countdown script
Post by: Janhouse on 09 May, 2004, 14:21:29
Can somebody write script that count down to any date.
like 01.06.2004.
And if user type !countdown then script shows PM like this:

Quote
***********************************
There are 15 days left till end of the month.
***********************************
Title:
Post by: nErBoS on 09 May, 2004, 18:36:09
Hi,

Hope it helps...

--Requested by Janhouse
--Made by nErBoS

sBot = "CountDown"

function Main()
frmHub:RegBot(sBot)
end

function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!countdown") then
DayCounter(user)
return 1
end
end
end

function DayCounter(user)
local sTmp = ""
local day = date("%d")
day = tonumber(day)
local month = date("%m")
month = tonumber(day)
if (month == 1 or month == 3 or month == 5 or month == 7 or month == 8 or month == 10 or month == 12) then
day = 31-day
sTmp = sTmp.."\r\n******************************************************"
sTmp = sTmp.."\r\nThere are "..day.." days left until end of the month."
sTmp = sTmp.."\r\n******************************************************"
user:SendPM(sBot, sTmp)
elseif (month == 2) then
day = 28-day
sTmp = sTmp.."\r\n******************************************************"
sTmp = sTmp.."\r\nThere are "..day.." days left until end of the month."
sTmp = sTmp.."\r\n******************************************************"
user:SendPM(sBot, sTmp)
else
day = 30-day
sTmp = sTmp.."\r\n******************************************************"
sTmp = sTmp.."\r\nThere are "..day.." days left until end of the month."
sTmp = sTmp.."\r\n******************************************************"
user:SendPM(sBot, sTmp)
end
end

Best regards, nErBoS
Title:
Post by: Janhouse on 09 May, 2004, 18:49:13
Is it posible that it is counting down to the curent date? Like 14.07.2005.
Title:
Post by: nErBoS on 09 May, 2004, 18:53:25
Hi,

Not picking your request. You want the script to show the current data ??

Best regards, nErBoS
Title:
Post by: plop on 09 May, 2004, 19:39:52
check my countdown script, you can find it on my website.

plop
Title:
Post by: Janhouse on 10 May, 2004, 22:26:54
Where can I find them?