;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LUSERSEXEC ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;info: ; ; by wiebe @ QuakeNet ; version 1.0 (written and tested on mIRC 6.14) ; ; ; last edit: Sun Jul 04 2004 ; ; ;What does this script do? ; ; gets the info from /LUSERS and returns the info to an alias ; ; just in case, LUSERS is this: ; ; There are 43775 users and 104957 invisible on 39 servers ; 80 operator(s) online ; 15 unknown connection(s) ; 190287 channels formed ; I have 9786 clients and 2 servers ; -port80a.se.quakenet.org- Highest connection count: 27438 (27436 clients) ; ; ;How to use this script? ; ; /lusersexec [-p] [params] ; to request the lusers info and send the info to alias ; ; the -p switch (passive) makes the script not request lusers, but wait for it ; usefull for example when connecting where the server sends LUSERS ; ; the script sends the following things to the alias: ; ; raw251 There are 90853 users and 130160 invisible on 37 servers | raw252 84 operator(s) online | raw253 15 unknown connection(s) | raw254 196838 channels formed | raw255 I have 4469 clients and 1 servers | snotice Highest connection count: 7791 (7790 clients) ; ; each part is seperated with a |, and every 1st word is raw ; for the server notice with the highest connection count this is snotice ; this is done so you can easily find the part that you want to get ; ; the output of /LUSERS can change, not all raw replies have to be there ; you can easily add other raws if needed to the script ; ; the script assumes the server notice with the highest connection count is the last part of it ; should this be different, you have to change the script a bit ; ; WARNING: DO NOT USE HALT IN AN ALIAS, USE RETURN! ; halt also halts the calling alias/event, return only stops the current alias ; and gives control back to the calling alias/event ; using halt in alias'es that are called from this script can cause it not to work 100% ; ; example at end of script ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; add -s for [server] ? ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS LUSERSEXEC ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; /lusersexec [params..] alias lusersexec { var %p = 1 ; switch -p is used and $2 is there, set var, tokenize if ($1 == -p) && ($2) { var %p = 0 tokenize 32 $2- } ; $1 is there, add to hash table if ($1) { hadd -m $+(lusersexec.,$cid) alias $1- ; check var, send LUSERS if (%p) { .quote LUSERS } } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 251 LUSERS INFO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; raw 251 me :There are X users and Y invisible on N servers raw 251:& There are & users and & invisible on & servers:{ ; check hash table, add it if ($hget($+(lusersexec.,$cid),alias)) { hadd $+(lusersexec.,$cid) info $hget($+(lusersexec.,$cid),info) $iif($hget($+(lusersexec.,$cid),info),$chr(124)) $+(raw,$numeric) $2- haltdef } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 252 LUSERS INFO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; raw 252 me X :operator(s) online raw 252:& & operator(s) online:{ ; check hash table, add it if ($hget($+(lusersexec.,$cid),alias)) { hadd $+(lusersexec.,$cid) info $hget($+(lusersexec.,$cid),info) $iif($hget($+(lusersexec.,$cid),info),$chr(124)) $+(raw,$numeric) $2- haltdef } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 253 LUSERS INFO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; raw 253 me X :unknown connection(s) raw 253:& & unknown connection(s):{ ; check hash table, add it if ($hget($+(lusersexec.,$cid),alias)) { hadd $+(lusersexec.,$cid) info $hget($+(lusersexec.,$cid),info) $iif($hget($+(lusersexec.,$cid),info),$chr(124)) $+(raw,$numeric) $2- haltdef } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 254 LUSERS INFO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; raw 254 me X :channels formed raw 254:& & channels formed:{ ; check hash table, add it if ($hget($+(lusersexec.,$cid),alias)) { hadd $+(lusersexec.,$cid) info $hget($+(lusersexec.,$cid),info) $iif($hget($+(lusersexec.,$cid),info),$chr(124)) $+(raw,$numeric) $2- haltdef } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 255 LUSERS INFO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; raw 255 me :I have X clients and Y servers raw 255:& I have & clients and & servers:{ ; check hash table, add it if ($hget($+(lusersexec.,$cid),alias)) { hadd $+(lusersexec.,$cid) info $hget($+(lusersexec.,$cid),info) $iif($hget($+(lusersexec.,$cid),info),$chr(124)) $+(raw,$numeric) $2- haltdef } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 265 LUSERS INFO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; raw 265 me :Current Local Users: X Max: Y raw 265:& Current Local Users* Max*:{ ; check hash table, add it if ($hget($+(lusersexec.,$cid),alias)) { hadd $+(lusersexec.,$cid) info $hget($+(lusersexec.,$cid),info) $iif($hget($+(lusersexec.,$cid),info),$chr(124)) $+(raw,$numeric) $2- haltdef } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 266 LUSERS INFO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; raw 266 me :Current Global Users: X Max: Y raw 266:& Current Global Users* Max*:{ ; check hash table, add it, run the alias with the info, free hash table if ($hget($+(lusersexec.,$cid),alias)) { hadd $+(lusersexec.,$cid) info $hget($+(lusersexec.,$cid),info) $iif($hget($+(lusersexec.,$cid),info),$chr(124)) $+(raw,$numeric) $2- $hget($+(lusersexec.,$cid),alias) $hget($+(lusersexec.,$cid),info) hfree $+(lusersexec.,$cid) haltdef } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SERVER NOTICE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on ^*:snotice:Highest connection count? & & clients):{ ; check hash table, add it, run the alias with the info, free hash table if ($hget($+(lusersexec.,$cid),alias)) { hadd $+(lusersexec.,$cid) info $hget($+(lusersexec.,$cid),info) $iif($hget($+(lusersexec.,$cid),info),$chr(124)) snotice $1- $hget($+(lusersexec.,$cid),alias) $hget($+(lusersexec.,$cid),info) hfree $+(lusersexec.,$cid) haltdef } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EXAMPLE SCRIPT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:text:!lusers:#channel:{ lusersexec luserspub $chan } alias -l luserspub { if ($2) { var %x = 1 while (%x <= $numtok($2-,124)) { var %a = $gettok($2-,%x,124) if ($gettok(%a,1,32) == raw251) { var %a = $gettok(%a,1-8,32) (total $calc($gettok(%a,4,32) + $gettok(%a,7,32)) $+ ) $gettok(%a,9-,32) } var %a = $gettok(%a,2-,32) var %y = $addtok(%y,%a,44) inc %x } msg $1 $replace(%y,$chr(44),$+($chr(44),$chr(32)),I have, My server has) } }