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.

Counter strike server look up..

Support & discussion of released scripts, and announcements of new releases.
Post Reply
M
Maiki
Voice
Posts: 28
Joined: Sun May 20, 2007 4:58 pm

Counter strike server look up..

Post by Maiki »

I made this script because i used to play alot of counter strike source in the days.. This script simply looks up the IP adress you give of you're server.
Suggestions / Ideas are welcome!!

Code: Select all

# Script to get some extra information about the IP-Adress of your Counter-Strike Source server
# Script made by Mookie@Efnet Contact me for more information
# Suggestions are always welcome, post them on the forum on egghelp.or
# Make sure you load http.tcl


# Settings

# Bind key? Default: !ip
set game(trigger) "!ip"

# Get-url timeout. Recommed to keep this as default
set game(timeout) "60000"


#########################################################
## Don't edit below unless you know what you're doing. ##
#########################################################

bind msg n !lasterror showlasterror
proc showlasterror {n u h t} {
   foreach line [split $::errorInfo \n] { putserv "PRIVMSG $n :$line" }
}

bind pub - $::game(trigger) lookup


proc lookup {nick uhost hand chan arg} {
   global game
   # Check if $arg exists
   if {![regexp -- {^(.+?):(.+?)$} $arg]} { putmsg $chan "Right format is: $::game(trigger) IP"; return }
   # Set formdata
   set formdata [http::formatQuery search $arg type server game cstrike2]
   # Going to url
   catch {set tok [http::geturl http://game-monitor.com/search.php?$formdata -timeout $::game(timeout)]} error
   if {[string match -nocase "*couldn't open socket*" $error]} {
      putlog "Error trying connect to url."
      return
   }
   # Went to url, setting data
   set data [http::data $tok]
   # Cleaning
   http::cleanup $tok
   # Regex time
   regexp -- {<b>Total Players/Max</b>(.+?)$} $data -> players
   if {![regexp -nocase {<a href="/GameServer/(.+?)">(.+?)</a></div></td></tr>} $data -> url title]} { putmsg $chan "Could not find someting for \"$arg\""; return }
   regsub -all {<.*?>|&nbsp} $title {} title
   regexp -- {<td><a href="/MapSearch/cstrike2/.*?/">(.*?)</a>} $data -> map
   # Shout the result
   putmsg $chan "Title: $title Map: $map Players$players"
}
putlog "CSS Game-monitor script loaded by Mookie" 
s
spijon
Voice
Posts: 33
Joined: Sun Aug 27, 2006 9:55 pm

Post by spijon »

Does the tcl need http module?

I getting the error :
"cl error [lookup]: invalid command name "http::formatQuery""
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

I would assume such from reading the comments in the beginning of the script:
# Script to get some extra information about the IP-Adress of your Counter-Strike Source server
# Script made by Mookie@Efnet Contact me for more information
# Suggestions are always welcome, post them on the forum on egghelp.or
# Make sure you load http.tcl
However, the proper way would be to use "package require http" within the script, as the location of the http-package is system-dependant...
NML_375
s
spijon
Voice
Posts: 33
Joined: Sun Aug 27, 2006 9:55 pm

Post by spijon »

My bad .. need sleep :)
Thanks
s
spijon
Voice
Posts: 33
Joined: Sun Aug 27, 2006 9:55 pm

Post by spijon »

Doesnt work :/
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

I think the author was referring to http.tcl script by perpleXa
s
spijon
Voice
Posts: 33
Joined: Sun Aug 27, 2006 9:55 pm

Post by spijon »

Yeah i know but it still doesnt work with the http.tcl - think they made site php different or something
Post Reply