egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Counter strike server look up..

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
Maiki
Voice


Joined: 20 May 2007
Posts: 28

PostPosted: Wed Aug 22, 2007 12:51 pm    Post subject: Counter strike server look up.. Reply with quote

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:

# 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"
Back to top
View user's profile Send private message
spijon
Voice


Joined: 27 Aug 2006
Posts: 33

PostPosted: Sun Sep 02, 2007 8:00 pm    Post subject: Reply with quote

Does the tcl need http module?

I getting the error :
"cl error [lookup]: invalid command name "http::formatQuery""
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Sep 02, 2007 8:10 pm    Post subject: Reply with quote

I would assume such from reading the comments in the beginning of the script:
Quote:
# 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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
spijon
Voice


Joined: 27 Aug 2006
Posts: 33

PostPosted: Sun Sep 02, 2007 9:02 pm    Post subject: Reply with quote

My bad .. need sleep Smile
Thanks
Back to top
View user's profile Send private message
spijon
Voice


Joined: 27 Aug 2006
Posts: 33

PostPosted: Wed Sep 12, 2007 7:35 pm    Post subject: Reply with quote

Doesnt work :/
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Thu Sep 13, 2007 12:54 am    Post subject: Reply with quote

I think the author was referring to http.tcl script by perpleXa
Back to top
View user's profile Send private message
spijon
Voice


Joined: 27 Aug 2006
Posts: 33

PostPosted: Fri Sep 14, 2007 7:36 pm    Post subject: Reply with quote

Yeah i know but it still doesnt work with the http.tcl - think they made site php different or something
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber