Hi all, I'm currently working on a simple countdown script that makes use of hash tables. I just want it to take $ctime and then subtract 8 hours (28800 seconds) from it to accommodate the PST timezone.
This is my current script:
on *:text:!setevent*:*:{
if !$ctime($2-) {
say $nick -> Unknown format. Please use this format: January 1 1970 00:00:00
}
elseif $ctime($2-) < ($ctime - 28800) {
say $nick -> Sorry, but $2- is a past date.
}
else {
.hadd -m event $ctime($2-) $2-
say $nick -> Event date: $2- has been set.
}
}
on *:text:!event:*:{
if !$hget(event,1).item {
say $nick -> Sorry, no event date has been set.
}
elseif $hget(event,1).item < ($ctime - - 28800) {
say $nick -> event date has been passed.
}
else {
say $nick -> Next event in: $duration($calc($hget(event,1).item - ($ctime - 28800))) PogChamp
}
}
on *:text:!delevent:*:{
if ($nick isop $chan) {
say $nick -> Countdown has been deleted.
.hdel event $hget(event,1).item
}
else {
say $nick -> You're not a mod.
}
}
on *:start:{
if !$hget(event) { .hmake event 100 }
if $exists(event.hsh) { .hload event event.hsh }
}
If someone could point me in the right direction, that would be most appreciated.