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.

Join message

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Join message

Post by Fire-Fox »

Hey all

Code: Select all

package require mysqltcl
setudef flag joinmsg

bind join - * join:testarea
bind rejn - * join:testarea

##################
### Mysql path ###
##################
# SQL info
set sql(host) "xxxxxxxxxx"
set sql(user) "xxxxxxxxxx"
set sql(pass) "xxxxxxxxxx"
set sql(db) "xxxxxxxxxx"
set sql(port) "xxxx"

##################
### 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)]
}

###########################################
### Greeting MSG When User Join channel ###
###########################################
proc bt.join.class { chan nick class} {
if {[channel get $chan joinmsg]} {
switch $class {

   ### The number is the number of the class on the site
   ### "return 0" means no msg for that class


   "default"   {set class "Not Found" }
  }
 }
}
#################
### Join Proc ###
#################
proc join:testarea {nick host hand chan} {
global botnick db_handle

  if {$nick != $botnick} {
 
       if {[mysqlping $db_handle] != 1} {
           putserv "PRIVMSG $chan : The connection to the mysql server has been lost."
             return 0
       }
       
       set sqlnick "SELECT userid FROM joinmsgnicks 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 joinmsgircuser 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];
       }
       
       set sql "SELECT username, class FROM joinmsgircuser 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

    }
  }
  putlog "Joinmsg"
Could someone make this :

I want to add the user to the database, without going into the database to add the user all the time...

so something like:
!addmsg NickName Text
So it outputs :
[@LillePil] Welcome To ::: NickName::: Text
and recheck if the script if it could be made simply. the script is NOT used on a site more. like it's made :)
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

no one ? :D
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Post Reply