This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

it just doesn't work...

Old posts that have not been replied to for several years.
Locked
s
sir
Voice
Posts: 21
Joined: Sat Aug 28, 2004 10:57 pm

it just doesn't work...

Post by sir »

ok, I'm not sure why, but it doesnt work.
it loads correctly (log is inserted), but other than that, there is absolutely no response from the bot in public channels.

Code: Select all

# Maximum Number of Results
set maxresults 3

# setting up the way our output looks
set start ""
set end ""
set delim ":"

# Binds!
# bind pub - .find gametiger_query


##
# The following function is used to query the gametiger database in order to 
# search for online players or servers, also forwards steamid requests to the steamid function
## set game "cstrike" o "all" 

proc gametiger_query { nick host hand chan text } {
	global start end delim maxresults
	set buffer ""
	set sname ""
	set result "results"
	set type ""
	set game "all"
	set results 0
	set valid 1
	set first [expr {[string first " " $text]} + 1]
	set query [string range "$text" $first end]

	switch -glob $text {
		"player *" {
			set type "player"
			set stype "player"
			set iname 2
			set ihost 6
			set iip 12
			set imap 18
			set icurrmax 22
		}

		"server *" {
			set type "server"
			set stype "server"
			set ihost 3
			set iip 9
			set imap 15
			set icurrmax 19
		}

		"map *" {
			set type "map"
			set stype "map"
			set ihost 3
			set iip 9
			set imap 15
			set icurrmax 19
		}

		"steamid*" { steam_query $nick $host $hand $chan $query }

		default {
			set valid 0
			puthelp "NOTICE $nick :Usage: .find <server|map|player> <hostname|mapname|playername>" 
		}
	}

	if { $valid == 1 && ![string equal $query ""] } {
		regsub -all " " $query "+" query
		set host "www.gametiger.net"
		set url "/search?$type=$query&game=$game"

		set FD [socket $host 80]

		# setup single line buffering
		fconfigure $FD -buffering line -buffersize 1024

		# yay HTTP/1.1 standards!
		puts $FD "GET $url HTTP/1.1"
		puts $FD "Host: $host"
		puts $FD "Connection: close"
		puts $FD ""

		while { ![eof $FD] && ![string equal $buffer "<!-- cstiger results -->"] } { gets $FD buffer }
		gets $FD buffer
		gets $FD buffer
		while { ![eof $FD] && $results < $maxresults && ![string equal "</table>" $buffer] && ![string match "*no such $type online*" $buffer] } {
			regsub -all ">" $buffer "\t" buffer
			regsub -all "</" $buffer "\t" buffer
			regsub -all "<" $buffer "<" buffer
			regsub -all ">" $buffer ">" buffer
			set line [split $buffer "\t"]
			set hostname [lindex $line $ihost]
			set ip [lindex $line $iip]
			set map [lindex $line $imap]
			set currmax [lindex $line $icurrmax]

			if { [string equal $type "player"] } {
				set name [lindex $line $iname]
				set sname "Name$delim $name"
			}

			set shostname "Hostname$delim $hostname"
			set sip "IP$delim $ip"
			set smap "Map$delim $map"
			set scurrmax "Players$delim $currmax"

			set outtxt "$sname  $shostname  $sip  $smap  $scurrmax"
			putserv "NOTICE $nick :$outtxt"
			incr results
			gets $FD buffer
		}

		if { $results == 1 } {
			set result "result"
		}
			putserv "NOTICE $nick :Search Results: (Found $results (of a maximum $maxresults $sytpe $result)
			putserv "NOTICE $nick :Powered by $host."
		close $FD
	} 
}
putlog "game-server-query written/modified by brian -blaze947- kelly"
Locked