bind pub - !q3hi q3hi_fnc bind pub - !q3bye q3bye_fnc bind pub - !qkill qkill_fnc bind pub - !qhelp q3help_fnc bind pub - !q3help q3help_fnc bind pub - !q3stats q3astats_fnc bind pub - !q3frags q3afrags_fnc bind pub - !q3infos q3ainfos_fnc bind pub - !rainfos qrainfos_fnc bind pub - !rafrags qrafrags_fnc bind pub - !rastats qrastats_fnc bind pub - !defrag q3adefrag_fnc bind pub - !humiliate q3humiliate_fnc # # show quake3-server stats for various mods # nostromo, Mon Aug 25 21:18:03 2003 # proc q3adefrag_fnc {nick uhost hand channel arg} { if { ($channel != "#idling-for-world-peace") && ($channel != "#hgb.lnx") && ($channel != "#engel") } { return } set player_check [get_players_de] if { $player_check <= 16 } { putchan $channel "Sorry $nick, no trainees are on the server right now :(" return } set qdefragees [get_qdefrags] set qdefragee_arr [split $qdefragees "\n"] set str $qdefragee_arr set i 2 set place_c 1 putchan $channel "$nick, these are the trainees currently on the server: " while {$i < [llength $qdefragee_arr]} { set bla [llength $qdefragee_arr] regexp {[:blank:]*(\d+?) frags.*ms +([^ ]*?)} [lindex $qdefragee_arr $i] dummy frags_c fplayer putchan $channel "$fplayer, " incr i incr place_c } putchan $channel "..." } proc q3humiliate_fnc {nick uhost hand channel arg} { set arg [string trimright $arg] if {[onchan $arg $channel]} { set req_arg [lindex $arg 0] if { ($req_arg == "nostromo") } { set req_string "uh! no way, %nick. %arg is too cautious..." regsub -all "%nick" $req_string "$nick" req_string regsub -all "%arg" $req_string "$arg" req_string } else { set req_string "ok %nick, %arg now really feels humiliated..." regsub -all "%nick" $req_string "$nick" req_string regsub -all "%arg" $req_string "$arg" req_string # string trim $hum_req # string trimright $arg } putchan $channel "$req_string" } else { putchan $channel "There is no player named '$arg'." } } proc qkill_fnc {nick uhost hand channel arg} { set arg [string trimright $arg] if { ($channel != "#idling-for-world-peace") } { return } if { ($nick == "akondra") } { putchan $channel "Make love not war!" return } set hurts_others 0 if {[onchan $arg $channel]} { if { [rand 2] >= 1 || $uhost == "nostromo@leo.risc.uni-linz.ac.at"} { set quote { "%arg was pummeled by %nick." "%arg was killed by %nick." "%arg was machinegunned by %nick." "%arg was gunned down by %nick." "%arg ate %nick's rocket." "%arg almost dogded %nick's rocket." "%arg was railed by %nick." "%arg was melted by %nick's plasmagun." "%arg was blasted by %nick's BFG." } set hurts_others 1 } else { set quote { "%nick does a back flip into the lava." "%nick was in the wrong place." "%nick blew himself up." "%nick killed himself." "%nick melted himself." "%nick timed out." "%nick cratered." } } set rand_string [lindex $quote [rand [llength $quote]]] regsub -all "%nick" $rand_string "$nick" rand_string regsub -all "%arg" $rand_string "$arg" rand_string putchan $channel "$rand_string" if { [rand 7] == 3 && $hurts_others == 1} { putchan $channel "$nick hit the fraglimit." } } else { putchan $channel "There is no player named '$arg'." putchan $channel "Waiting for other players." } } proc q3hi_fnc {nick uhost hand channel arg} { if { $uhost != "~nostromo@leo.risc.uni-linz.ac.at" || $uhost != "^nostromo@leo.risc.uni-linz.ac.at" || $uhost != "nostromo@leo.risc.uni-linz.ac.at" } { return } putchan $channel "$nick, prepare to fight!" } proc q3bye_fnc {nick uhost hand channel arg} { if { $uhost != "~nostromo@leo.risc.uni-linz.ac.at" || $uhost != "^nostromo@leo.risc.uni-linz.ac.at" || $uhost != "nostromo@leo.risc.uni-linz.ac.at" } { return } putchan $channel "$nick, you have taken the lead!" } proc q3help_fnc {nick uhost hand channel arg} { if { ($channel != "#idling-for-world-peace") && ($channel != "#hgb.lnx") && ($channel != "#engel") } { return } putchan $channel "$nick, try one of the following..." putchan $channel "!q3stats: to get a short info of the server" putchan $channel "!q3frags: to get a rank-list of the current frags" putchan $channel "!q3infos: to get current server rules" putchan $channel "!rastats: to get a short info of the RA-server" putchan $channel "!rafrags: to get a rank-list of the current frags on RA" putchan $channel "!defrag: to get a list of trainees on the defrag-server" putchan $channel "!qhelp/!q3help: to get this help messages" } proc qrainfos_fnc {nick uhost hand channel arg} { if { ($channel != "#idling-for-world-peace") } { return } set qrinfos_tammura [get_qrainfos] set qrinfos_arr [split $qrinfos_tammura "\n"] set str $qrinfos_arr putchan $channel "$nick, here are the current rulez for the QRA_server:" regexp {(\d+\.\d+\.\d+\.\d+):(\d+?) +(\d+?)\/( ??\d+?) +([^ ]+)} [lindex $qrinfos_arr 1] dummy ip port players pl_max cu_map regexp {,protocol=(\d+),} [lindex $qrinfos_arr 2] dummy prtcol regexp {,capturelimit=(\d+),} [lindex $qrinfos_arr 2] dummy capt_l regexp {,timelimit=(\d+),} [lindex $qrinfos_arr 2] dummy time_l regexp {,fraglimit=(\d+),} [lindex $qrinfos_arr 2] dummy frag_l regexp {,pure=(\d+),} [lindex $qrinfos_arr 2] dummy pure_s regexp {,version=Q3\ (\d+\.\d+.)b } [lindex $qrinfos_arr 2] dummy s_vers # regexp {,Administrator=(.+?),} [lindex $qrinfos_arr 2] dummy s_admn regexp {,Clan=(.+?),} [lindex $qrinfos_arr 2] dummy s_clan regexp {,g_gametype=(\d+),} [lindex $qrinfos_arr 2] dummy game_t if { $game_t == 0 } then { set game_t "FFA" } if { $game_t == 1 } then { set game_t "TRN" } if { $game_t == 2 } then { set game_t "FFA" } if { $game_t == 3 } then { set game_t "TDM" } if { $game_t == 4 } then { set game_t "CTF" } if { $game_t >= 5 } then { set game_t "RA3" } putchan $channel "* Map: $cu_map\t* Fraglimit: $frag_l" putchan $channel "* Capturelimit: $capt_l\t\t* Timelimit: $time_l" putchan $channel "* Gametype: $game_t\t\t* Protocol: $prtcol" putchan $channel "* S_Version: $s_vers\t\t* S_Admin: $s_admn" putchan $channel "* S_Pure: $pure_s\t\t* S_MaxPlayers: $pl_max" putchan $channel "* Clan: $s_clan" } proc q3ainfos_fnc {nick uhost hand channel arg} { if { ($channel != "#idling-for-world-peace") } { return } set qinfos_tammura [get_q3ainfos] set qinfos_arr [split $qinfos_tammura "\n"] set qinfos_arr # set $s_vers "none" # set $s_admn "none" # set $s_clan "none" putchan $channel "$nick, here are the current rulez for the Q3A_server:" regexp {(\d+\.\d+\.\d+\.\d+)(:\d*?) +(\d+?)\/( ??\d+?) +([^ ]*?)} [lindex $qinfos_arr 1] dummy ip port players pl_max cu_map regexp {,protocol=(\d+)} [lindex $qinfos_arr 2] dummy prtcol regexp {,capturelimit=(\d+)} [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 {,fraglimit=(\d+)} [lindex $qinfos_arr 2] dummy frag_l regexp {,pure=(\d+)} [lindex $qinfos_arr 2] dummy pure_s regexp {,version=.+?(\d\.\d+.)} [lindex $qinfos_arr 2] dummy s_vers # regexp {,Administrator=(.+?),} [lindex $qinfos_arr 2] dummy s_admn # regexp {,Clan=(.+?),} [lindex $qinfos_arr 2] dummy s_clan regexp {,g_gametype=(\d+)} [lindex $qinfos_arr 2] dummy game_t if { $game_t == 0 } then { set game_t "FFA" } if { $game_t == 1 } then { set game_t "TRN" } if { $game_t == 2 } then { set game_t "FFA" } if { $game_t == 3 } then { set game_t "TDM" } if { $game_t == 4 } then { set game_t "CTF" } if { $game_t == 5 } then { set game_t "RA3" } putchan $channel "* Map: $cu_map\t* Fraglimit: $frag_l" putchan $channel "* Capturelimit: $capt_l\t\t* Timelimit: $time_l" putchan $channel "* Gametype: $game_t\t* Protocol: $prtcol" putchan $channel "* S_Version: $s_vers\t* S_Pure: $pure_s" putchan $channel "* S_MaxPlayers: $pl_max\t\t* Name: $s_host" } proc q3afrags_fnc {nick uhost hand channel arg} { if { ($channel != "#idling-for-world-peace") } { return } set player_check [get_players] if { $player_check <= 16 } { putchan $channel "Sorry $nick, no one is on the Q3A_server right now :(" return } set qfrags_tammura [get_q3afrags] set qfrags_arr [split $qfrags_tammura "\n"] set str $qfrags_arr set i 2 set place_c 1 putchan $channel "$nick, here are the results of your request:" while {$i < [llength $qfrags_arr]} { set bla [llength $qfrags_arr] regexp {[:blank:]*(\d+?) frags.*ms +([^ ]*?)} [lindex $qfrags_arr $i] dummy frags_c fplayer putchan $channel "$place_c. place: $fplayer with $frags_c frags." incr i incr place_c } } proc qrafrags_fnc {nick uhost hand channel arg} { if { ($channel != "#idling-for-world-peace") } { return } set player_check [get_players_ra] if { $player_check <= 16 } { putchan $channel "Sorry $nick, no one is on the QRA_server right now :(" return } set qfrags_tammura [get_qrafrags] set qfrags_arr [split $qfrags_tammura "\n"] set str $qfrags_arr set i 2 set place_c 1 putchan $channel "$nick, here are the results of your request:" while {$i < [llength $qfrags_arr]} { set bla [llength $qfrags_arr] regexp {[:blank:]*(\d+?) frags.*ms +([^ ]*?)} [lindex $qfrags_arr $i] dummy frags_c fplayer putchan $channel "$place_c. place: $fplayer with $frags_c frags." incr i incr place_c } } proc q3astats_fnc {nick uhost hand channel arg} { if { $channel != "#idling-for-world-peace" } { return } set qstats_tammura [get_q3astats] set qstats_arr [split $qstats_tammura "\n"] set str $qstats_arr set found 0 regexp {(\d+\.\d+\.\d+\.\d+:\d+) +(\d+?)\/( ??\d+?) +([^ ]+)} [lindex $qstats_arr 1] dummy ip players players_max map 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 Q3A_server right now :(" } } proc qrastats_fnc {nick uhost hand channel arg} { if { ($channel != "#idling-for-world-peace") } { return } set qstats_tammura [get_qrastats] set qstats_arr [split $qstats_tammura "\n"] set str $qstats_arr set found 0 regexp {(\d+\.\d+\.\d+\.\d+):\d+? +(\d+?)\/( ??\d+?) +([^ ]+)} [lindex $qstats_arr 1] dummy ip players players_max map 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 QRA_server right now :(" } } proc get_players {} { return [llength [exec /usr/local/bin/qstat -sort F -P -q3s 193.170.32.26:27690]] } proc get_q3ainfos {} { return [exec /usr/local/bin/qstat -R -q3s 193.170.32.26:27960] } proc get_q3afrags {} { return [exec /usr/local/bin/qstat -sort F -P -q3s 193.170.32.26:27960] } proc get_q3astats {} { return [exec /usr/local/bin/qstat -sort F -P -q3s 193.170.32.26:27960] } proc get_players_ra {} { return [llength [exec /usr/local/bin/qstat -sort F -P -q3s 193.170.32.26:27961]] } proc get_qrainfos {} { return [exec /usr/local/bin/qstat -R -q3s 193.170.32.26:27961] } proc get_qrafrags {} { return [exec /usr/local/bin/qstat -sort F -P -q3s 193.170.32.26:27961] } proc get_qrastats {} { return [exec /usr/local/bin/qstat -sort F -P -q3s 193.170.32.26:27961] } proc get_players_de {} { return [llength [exec /usr/local/bin/qstat -sort F -P -q3s 193.170.32.26:27962]] } proc get_qdefrags {} { return [exec /usr/local/bin/qstat -sort F -P -q3s 193.170.32.26:27962] } putlog "\002Q3Stats\002 by nostromo loaded..."