bind pub - !etstats etstats_fnc bind pub - !etinfos etinfos_fnc bind pub - !ethelp ethelp_fnc # # show et-server stats # nostromo, Mon Aug 25 21:18:03 2003 # proc ethelp_fnc {nick uhost hand channel arg} { putchan $channel "!etstats (server-index): to get a short info of the server" putchan $channel "!etinfos (server-index): to get current server rules" putchan $channel "server-index: 1. 62.99.220.203 et.sonntagmorgen.at" putchan $channel " 2. 217.196.80.30 kopfnuss" putchan $channel " 3. 217.196.72.168 -eXes-" putchan $channel " 4. 193.225.224.199 N/A" } proc etstats_fnc {nick uhost hand channel arg} { if {(![regexp \[0-9\] $arg])} then { putchan $channel "invalid server-index. try \"!ethelp\" for help..." return 0 } else { if { $arg == 1 } then { set et_server "62.99.220.203" } elseif { $arg == 2 } then { set et_server "217.196.80.30" } elseif { $arg == 3 } then { set et_server "217.196.72.168" } elseif { $arg == 4 } then { set et_server "193.225.224.199" } else { putchan $channel "invalid server-index. try \"!ethelp\" for help..." return 0 } } set qstats_server [get_etstats $et_server] set qstats_arr [split $qstats_server "\n"] set str $qstats_arr set found 0 set players none regexp {(\d+\.\d+\.\d+\.\d+) +(\d+?)\/( ??\d+?) +([^ ]+)} [lindex $qstats_arr 1] dummy ip players players_max map if {$players == "none"} { putchan $channel "Oohm, $et_server seems to be down $nick :(" return 0 } if {$players > 0} then { if {$players == 1} then { putchan $channel "$nick, there is $players (of $players_max max) player" putchan $channel "on $ip playing map $map." } else { putchan $channel "$nick, there are $players (of $players_max max) players" putchan $channel "on $ip playing map $map." } } else { putchan $channel "Oohm, $nick, no one is on the ET_server right now :(" } } proc etinfos_fnc {nick uhost hand channel arg} { if {(![regexp \[0-9\] $arg])} then { putchan $channel "invalid server-index. try \"!ethelp\" for help..." return 0 } else { if { $arg == 1 } then { set et_server "62.99.220.203" } elseif { $arg == 2 } then { set et_server "217.196.80.30" } elseif { $arg == 3 } then { set et_server "217.196.72.168" } elseif { $arg == 4 } then { set et_server "193.225.224.199" } else { putchan $channel "invalid server-index. try \"!ethelp\" for help..." return 0 } } set qinfos_server [get_etinfos $et_server] set qinfos_arr [split $qinfos_server "\n"] set qinfos_arr set players none regexp {(\d+\.\d+\.\d+\.\d+) +(\d+?)\/( ??\d+?) +([^ ]*?)} [lindex $qinfos_arr 1] dummy ip players pl_max cu_map if {$players == "none"} { putchan $channel "Oohm, $et_server seems to be down $nick :(" return 0 } putchan $channel "$nick, here are the current rulez for the ET_server ($et_server):" regexp {protocol=(\d+),} [lindex $qinfos_arr 2] dummy prtcol regexp {,game=(\+?)} [lindex $qinfos_arr 2] dummy capt_l regexp {,timelimit=(\d+)} [lindex $qinfos_arr 2] dummy time_l regexp {,sv_hostname=(.+?),} [lindex $qinfos_arr 2] dummy s_host regexp {,pure=(\d+)} [lindex $qinfos_arr 2] dummy pure_s regexp {,version=.+?(\d\.\d+.)} [lindex $qinfos_arr 2] dummy s_vers regexp {,g_gametype=(\d+)} [lindex $qinfos_arr 2] dummy game_t if { $game_t == 0 } then { set game_t "N/A" } if { $game_t == 1 } then { set game_t "N/A" } if { $game_t == 2 } then { set game_t "single map" } if { $game_t == 3 } then { set game_t "stopwatch" } if { $game_t == 4 } then { set game_t "campaign" } if { $game_t == 5 } then { set game_t "N/A" } regsub -all {\^\d} $s_host {} s_host regsub -all {\^\?} $s_host {} s_host putchan $channel "* Map: $cu_map\t* Timelimit: $time_l" putchan $channel "* Gametype: $game_t\t* Protocol: $prtcol" putchan $channel "* S_Version: $s_vers\t\t* S_MaxPlayers: $pl_max" putchan $channel "* Name: $s_host" } proc get_etstats { et_server } { return [exec /home/nostromo/bin/qstat -rws $et_server] } proc get_etinfos { et_server } { return [exec /home/nostromo/bin/qstat -R -rws $et_server] } putlog "\002ET-Stats\002 by nostromo loaded... (c) 2004"