; /query_game <ip> <port>
alias query_game {
; connection info
var %ip = $1, %port = $2, %sock = query_ $+ $rand(1,999)
; set this tot he query string.
/bset &buffer 1 98 0 0
; send outgoing query packet
/sockudp -k %sock %ip %port &buffer
; Here i set the ticks count as a mark on the socket so I can get ping time
/sockmark %sock %chan $ticks
; set a timeout
.timer $+ %sock 1 3 /query_kill %sock
}
alias query_kill {
var %sock = $1
/echo -s Could not query server.
/sockclose %sock
}
on *:SOCKOPEN:query_*: {
if ($sockerr) /echo -s $sockname Failed: $sock($sockname).wserr
}
on *:UDPREAD:query_*: {
; shut off the timeout check
.timer $+ $sockname off
; read the packet
/sockread &data
;
; parse it here....
;
}