http://www.roystonvasey.eu/forum/viewto ... 0179#20179
hlserver.mrc (original author: Dennis "ParaSite" Hellewegen)
Queries Goldsource (e.g. TFC) and Source (e.g. TF2) servers.
Usage: !hlserver ip:port
Note: Fixed to be compatible with mIRC v7 (Unicode).
Version with time.dll (more precise, but requires said dll file)
Code: Select all
alias hlserver {
if ($1 == $null) halt
set %hlserver.ip $1
set %hlserver.spitchan $iif($2,$2,$active)
if (%hlserver.spitchan == Status Window) {
echo -s You are not on a channel
halt
}
var %char = $left($1,1)
if (((%char >= A) && (%char <= Z)) || ((%char >= a) && (%char <= z))) {
set %hlserver.no-ip 0
dns $gettok($1,1,58)
}
else {
dll time.dll GetTime .
bset &query 1 255
bset &query 2 255
bset &query 3 255
bset &query 4 255
bset -t &query 5 TSource Engine Query
bset &query 25 0
sockudp -nk hlchanserver $gettok($1,1,58) $iif($gettok($1,2,58),$ifmatch,27015) &query
set %hlserver.time $dll(time.dll,GetTime,.)
timertimeout 1 3 hlserver.timeout
}
}
on *:DNS:{
if (%hlserver.ip) {
if ($dns(0) == 0) {
msg %hlserver.spitchan This domain name couldn't be resolved.
unset %hlserver.*
halt
}
set %hlserver.ip $dns(1).ip $+ $iif($gettok(%hlserver.ip,2,58),: $+ $ifmatch)
dll time.dll GetTime .
bset &query 1 255
bset &query 2 255
bset &query 3 255
bset &query 4 255
bset -t &query 5 TSource Engine Query
bset &query 25 0
var %port = $iif($gettok(%hlserver.ip,2,58),$ifmatch,27015)
sockudp -nk hlchanserver $raddress %port &query
set %hlserver.time $dll(time.dll,GetTime,.)
timertimeout 1 3 hlserver.timeout
; msg %players.spitchan Server IP = $raddress $+ $chr(58) $+ %port
}
}
alias hlserver.timeout {
sockclose hlchanserver
msg %hlserver.spitchan No response
unset %hlserver.*
}
alias hlserver.usage {
if ($1 == $me) {
echo -a Usage:
echo -a !s ip[:port]
echo -a !s domain[:port]
echo -a !s fm / rv / 1v1 / dust
echo -a !fm / !rv / !1v1 / !dust
}
else {
notice $1 Usage:
notice $1 !s ip[:port]
notice $1 !s domain[:port]
notice $1 !s fm / rv / 1v1 / dust
notice $1 !fm / !rv / !1v1 / !dust
}
}
on *:input:#:{
set %hlserver.no-ip 0
if (($1 == !s) || ($1 == !hlserver)) {
if ($2 == $null) { msg # $1 | hlserver.usage $me | halt }
elseif ($2 == rv) { hlserver 37.122.208.248 $chan }
elseif ($2 == 1v1) { hlserver 37.122.208.248:27025 $chan }
elseif ($2 == fm) { hlserver 37.122.208.248:27017 $chan }
elseif ($2 == dust) { hlserver 87.98.219.139:27030 $chan }
else { set %hlserver.no-ip 1 | hlserver $2 $chan }
}
elseif ($1- == !rv) { hlserver 37.122.208.248 $chan }
elseif ($1- == !1v1) { hlserver 37.122.208.248:27025 $chan }
elseif ($1- == !fm) { hlserver 37.122.208.248:27017 $chan }
elseif ($1- == !dust) { hlserver 87.98.219.139:27030 $chan }
}
on *:text:!s:#:hlserver.usage $nick
on *:text:!hlserver:#:hlserver.usage $nick
on *:text:!s *:#:{
set %hlserver.no-ip 0
if ($2 == rv) { hlserver 37.122.208.248 $chan }
elseif ($2 == 1v1) { hlserver 37.122.208.248:27025 $chan }
elseif ($2 == fm) { hlserver 37.122.208.248:27017 $chan }
elseif ($2 == dust) { hlserver 87.98.219.139:27030 $chan }
else { set %hlserver.no-ip 1 | hlserver $$2 $chan }
}
on *:text:!hlserver *:#:{
set %hlserver.no-ip 0
if ($2 == rv) { hlserver 37.122.208.248 $chan }
elseif ($2 == 1v1) { hlserver 37.122.208.248:27025 $chan }
elseif ($2 == fm) { hlserver 37.122.208.248:27017 $chan }
elseif ($2 == dust) { hlserver 87.98.219.139:27030 $chan }
else { set %hlserver.no-ip 1 | hlserver $$2 $chan }
}
on *:text:!rv:#:set %hlserver.no-ip 0 | hlserver 37.122.208.248 $chan
on *:text:!1v1:#:set %hlserver.no-ip 0 | hlserver 37.122.208.248:27025 $chan
on *:text:!fm:#:set %hlserver.no-ip 0 | hlserver 37.122.208.248:27017 $chan
on *:text:!dust:#:set %hlserver.no-ip 0 | hlserver 87.98.219.139:27030 $chan
on *:udpread:hlchanserver:{
timertimeout off
var %hlserver.ping = $dll(time.dll,GetTime,.) - %hlserver.time
sockread &temp
sockclose hlchanserver
if ($bvar(&temp,5) == 73) {
var %hlserver.source 1
var %i = 7
; msg %hlserver.spitchan Reply format: Source
}
elseif ($bvar(&temp,5) == 109) {
var %i = $bfind(&temp,6,0) + 1
; msg %hlserver.spitchan Reply format: GoldSource (obsolete)
}
else {
sockclose hlchanserver
msg %hlserver.spitchan Unknown reply format
unset %hlserver.*
halt
}
var %hlserver.name = $bvar(&temp,%i,100).text
inc %i $len(%hlserver.name)
inc %i
var %hlserver.debug = $bvar(&temp,%i,1)
if (%hlserver.debug == 0) inc %i
var %hlserver.map = $bvar(&temp,%i,100).text
inc %i $len(%hlserver.map)
inc %i
var %hlserver.shortmod = $bvar(&temp,%i,100).text
inc %i $len(%hlserver.shortmod)
inc %i
var %hlserver.mod = $bvar(&temp,%i,100).text
inc %i $len(%hlserver.mod)
if (%hlserver.mod == Counter-Strike) var %hlserver.mod = CS
elseif (%hlserver.mod == Day of Defeat) var %hlserver.mod = DoD
elseif (%hlserver.mod == Team Fortress Classic) var %hlserver.mod = TFC
elseif (%hlserver.mod == Counter-Strike: Global Offensive) var %hlserver.mod = CS:GO
elseif (%hlserver.mod == Counter-Strike: Source) var %hlserver.mod = CS:S
elseif (%hlserver.mod == Day of Defeat: Source) var %hlserver.mod = DoD:S
elseif (%hlserver.mod == Team Fortress) var %hlserver.mod = TF2
inc %i $iif(%hlserver.source,3,1)
var %hlserver.numplayers = $bvar(&temp,%i,1)
inc %i
var %hlserver.maxplayers = $bvar(&temp,%i,1)
if (%hlserver.source) var %hlserver.bots = $bvar(&temp,$calc(%i + 1),1)
inc %i 4
var %hlserver.password = $bvar(&temp,%i,1)
if (%hlserver.source) inc %i
else {
inc %i 2
%i = $bfind(&temp,%i,0) + 1
%i = $bfind(&temp,%i,0) + 1
%i = $bfind(&temp,%i,0) + 11
}
var %hlserver.vac = $bvar(&temp,%i,1)
if (%hlserver.source != 1) {
if (%hlserver.mod == HLTV) var %hlserver.bots = 0
else var %hlserver.bots = $bvar(&temp,$calc(%i + 1),1)
}
var %hlserver.humans = $calc(%hlserver.numplayers - %hlserver.bots)
msg %hlserver.spitchan $iif(%hlserver.password == 1,Password $chr(124)) $&
$iif(%hlserver.bots > 0,%hlserver.bots bots $chr(124)) $&
$iif(%hlserver.vac == 1,VAC $chr(124)) $&
%hlserver.name $chr(124) $&
$iif(%hlserver.no-ip != 1,%hlserver.ip $chr(124)) $&
%hlserver.mod $chr(124) $&
$iif(%hlserver.bots > 0,%hlserver.humans humans,%hlserver.humans $+ / $+ %hlserver.maxplayers) $chr(124) $&
%hlserver.map $chr(124) $&
%hlserver.ping $+ ms
unset %hlserver.*
}
Code: Select all
Remove the line
dll time.dll GetTime .
Replace all two occurrences of
$dll(time.dll,GetTime,.)
with
$ticks