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.

[SOLVED]Join msg

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

[SOLVED]Join msg

Post by Fire-Fox »

hey

i have a problem

Can enyone tell my why it's nor working...

Code: Select all

##################################################
#       Set user defined flag for users          #
##################################################

setudef flag UserSearch
setudef flag AdminSearch

package require mysqltcl

bind join - * join:aliasfm
bind rejn - * join:aliasfm
######################
### URL to the site ###
#######################
set site_add "http://aliasfm.net"
  ##################
### Mysql path ###
##################
# SQL info
set sql(host) "xxxxxxxx"
set sql(user) "xxxxx"
set sql(pass) "xxxx"
set sql(db) "abot"
set sql(port) "3306"

######################
### URL to the site ###
#######################

set site_add "http://aliasfm.net "

##################
### Mysql path ###
##################
if {![info exists db_handle] } {
set db_handle [mysqlconnect -host $sql(host) -user $sql(user) -password $sql(pass) -db $sql(db) -port $sql(port)] 
}

##################################
### Define The Channels On IRC ###
##################################
set chan_(mainchan)     "#aliasfm"

#############################
### Some Global Variables ###
#############################

### Set to 1 if you want the join msg enabled
set globals_(join) "1"

##########################
### Find The UserClass ###
##########################
proc bt.class { class id } {

switch $class {

		    #"0"         {set class "0User" }
                  "5"        {set class "4Live DJ" }
                  "10"        {set class "4Chat Chef" }
                  "default"   {set class "Not Found" }
          }

return $class
}


###########################################
### Greeting MSG When User Join channel ###
###########################################
proc bt.join.class { chan nick class} {

switch $class {

   ### The number is the number of the class on the site
   ### "return 0" means no msg for that class
   #"0"        {putserv "PRIVMSG $chan :10Velkommen Til 7:::9 $nick 7:::9 10Vores Outlaw" }
   "5"       {putserv "PRIVMSG $chan :10Velkommen Til 7:::9 $nick 7:::9 10Vores Live Dj" }
   "default"  {set class "Not Found" }
 }
}
#################
### Join Proc ###
#################
proc join:aliasfm {nick host hand chan} {
global botnick db_handle globals_ error_ help_ chan_
  
  if {$nick != $botnick} {
  
    set chan [string tolower $chan]
    if {[channel get $chan UserSearch]} { 
    
       if {[mysqlping $db_handle] != 1} { 
             putserv "PRIVMSG $chan : $error_(mysqllost)"
             return 0
       }
       
       set sqlnick "SELECT userid FROM nicks WHERE nick='[mysqlescape $nick]'"
       set resultnick [mysqlquery $db_handle $sqlnick]
             
       set nicki 0
       while {[set record [mysqlnext $resultnick]] != ""} {
         set userid [lindex $record 0]
         incr nicki
       } 
             
       if { $nicki == 0 } { return 0 }
             
       if { $userid == "" } { return 0 }
             
       set sql "SELECT username, class FROM users WHERE id='[mysqlescape $userid]'"
       
       set result [mysqlquery $db_handle $sql]
             
       set i 0
       while {[set record [mysqlnext $result]] != ""} {
                    
         set username [lindex $record 0];
         set class [lindex $record 1];
       }
       
       if { $globals_(help) == 1 } {putserv "notice $nick : $help_(join)"}
       if { $globals_(join) != 1 } { return 0 }
       
       set sql "SELECT username, class FROM users WHERE id='[mysqlescape $userid]'"
       set result [mysqlquery $db_handle $sql]
             
       set i 0
       while {[set record [mysqlnext $result]] != ""} {
                    
         set username [lindex $record 0];
         set class [lindex $record 1];
       }
       mysqlendquery $result
       
       bt.join.class $chan $nick $class

    }
  }
}
Last edited by Fire-Fox on Mon Jun 24, 2013 7:20 am, edited 2 times in total.
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

You do have mysqltcl setup?

Also, have you contacted the author?
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

Alchera wrote:You do have mysqltcl setup?

Also, have you contacted the author?
How can i check the mysqltcl is working....

And the author, is one i know that has setup another bot with the same funktion, but he is to busy to help at the moment :)
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Because the script is not working I'd assume that you do not have mysqltcl installed.

The script looks for that package.

Code: Select all

package require mysqltcl 
Fire-Fox wrote:How can i check the mysqltcl is working....
Your answer is might be here: http://forum.egghelp.org/viewtopic.php? ... ght=#76869
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

Alchera wrote:Because the script is not working I'd assume that you do not have mysqltcl installed.

The script looks for that package.

Code: Select all

package require mysqltcl 
Fire-Fox wrote:How can i check the mysqltcl is working....
Your answer is might be here: http://forum.egghelp.org/viewtopic.php? ... ght=#76869
thanks so fare :)
Okay i'll gtry to look into it... with some root access on the server.... :)

Can i use this one... ?
http://barkerjr.net/irc/eggdrop/modules/
MySQL
This module is really a tool for script developers who want to access a MySQL database without an extra Tcl module. This module may be required by certain scripts. A is also available. For an example script, see MySeen in the scripts section of this site.
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Post Reply