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 

Join message

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Thu Feb 12, 2009 3:41 pm    Post subject: Join message Reply with quote

Hey all

Code:

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:
Quote:
!addmsg NickName Text


So it outputs :
Quote:
[@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 Smile
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Mon Mar 02, 2009 6:13 am    Post subject: Reply with quote

no one ? Very Happy
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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