on *:text:!uptime*:#:{
set %target $iif($2,$2,$mid(#,2-))
set %channel #
uptime
}
alias uptime {
sockclose uptime
sockopen uptime nightdev.com 80
}
on *:sockopen:uptime:{
if ($sockerr) { sockclose $sockname | halt }
sockwrite -n $sockname GET /hosted/uptime.php?channel= $+ %target HTTP/1.1
sockwrite -n $sockname Host: www.nightdev.com
sockwrite -n $sockname $crlf
}
on *:sockread:uptime:{
if ($sockerr) { sockclose $sockname | halt }
var %data
sockread %data
tokenize 32 %data
if ($1 isnum) && ($2) { msg %channel %target has been online for $1- }
elseif (%data == The channel is not live.) msg %channel %target is currently not online.
}
on *:sockclose:uptime:{
unset %channel
unset %target
}
Tested and working.
If you wanna set a timer to update an ini file, you can do that as well, writeini uptime.ini uptime %target %data
Hey,
I have two questions about your uptime script.
1.Is there a way of making so that I can have:
{ msg %channel @ $+ $nick %target has been online for $1- }
So that I first tag the person who writes the command, and then says how long the channel has been live for? I tried doing like I wrote in the code, but then it just tags myself, and not the writer.
2.Is there a way making so that instead of showing:
has been online for 4 hours, 39 minutes
It will show like
has been online for 4h, 39m and *s
Best Regards
Artiiz