on *:text:!cod*:#: {
if (!%flood.cod) {
set -u3 %flood.cod 1
set %cod.chan $chan
if ($3) { set %cod.search $3 }
sockudp -k cod $cod.ip($2) $str($chr(255),4) $+ getstatus $chr(0)
}
else { halt }
}
alias codpost {
msg %cod.chan **Server:** $rmcode(%ocod.hostname) $chr(124) **Version:** %ocod.version $chr(124) **Players:** $+($calc(%ocod.playercount - 2),/,%ocod.maxc) $chr(124) **Map:** %ocod.map $chr(124) **Gamemode:** %ocod.gametype
unset %cod*
unset %ocod*
}
on *:udpread:cod: {
sockread %cod.tmp
inc %ocod.playercount
if (fs_game isin %cod.tmp) {
if ($regex(%cod.tmp,.*\\(shortversion)\\(.*?)\\.*)) { set %ocod.version $regml(2) }
if ($regex(%cod.tmp,.*\\(sv_maxclients)\\(.*?)\\.*)) { set %ocod.maxc $regml(2) }
if ($regex(%cod.tmp,.*\\(sv_hostname)\\(.*?)\\.*)) { set %ocod.hostname $strip($regml(2)) }
if ($regex(%cod.tmp,.*\\(uptime)\\(.*?)\\.*)) { set %ocod.uptime $regml(2) }
if ($regex(%cod.tmp,.*\\(mapname)\\(.*?)\\.*)) { set %ocod.map $regml(2) }
if ($regex(%cod.tmp,.*\\(g_gametype)\\(.*?)\\.*)) { set %ocod.gametype $replace($regml(2),sd,Search & Destroy,war,Team Deathmatch,dm,Free for all,dom,Domination,koth,Headquarters,sab,Sabotage) }
.timercod 1 1 codpost
}
if (%cod.search isin %cod.tmp) { msg %cod.chan $+(**,$gettok(%cod.tmp,3,32),**) - **Ping:** $gettok(%cod.tmp,2,32) - **Points:** $gettok(%cod.tmp,1,32) }
}
alias -l rmcode { return $remove($1-,^0,^1,^2,^3,^4,^5,^6,^7,8^,9) }
alias -l cod.ip { noop $regex($1,(.*?):(.*)) | return $regml(1) $regml(2) }