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.

Invite script

Old posts that have not been replied to for several years.
Locked
F
FiskerEnDK
Voice
Posts: 17
Joined: Thu Jan 16, 2003 7:18 am

Invite script

Post by FiskerEnDK »

Hi
i have made this script with a friend...
its made to make an invite list..
add/del/invite command
from a database named site_invite.db

but it dosent work.. and we have spend about 24 hours just to try to debug
can anybody help me getting this to work..

best regards
Thomas

<code>
set active "#channel"
set db scripts/site_invite.db

bind msg - @user user
bind msg - @invite invite

putlog "Script loaded: invite"

proc user {nick uhost hand chan args} {
global active db
if {$active != $chan} { return 0 }
set args [split [cleanarg $args]]
set what [lindex $args 0]
if { $what == $add } {
db_load
set user [lindex $args 1]
set pass [lindex $args 2]
if { $user == "" || $pass == "" } {
putserv "NOTICE $nick :Error no username or password set"
putserv "NOTICE $nick :Usage: @user add <username> <password>"
return 0
}
if ([db_search $user]==-1) {
lappend info [list $user $pass]
db_save
putserv "PRIVMSG $chan :\0034=¤ INVITE ¤=\003\ $user is added to userlist by $nick"
return 0
}
}
if { $what == del } {
db_load
set user [lindex $arg 1]
if ([db_search $nom]!=-1) {
db_del [db_search $user]
db_save
putserv "PRIVMSG $chan :\0034=¤ INVITE ¤=\003\ $user is deletede from userlist by $nick."
return 0
}
putserv "NOTICE $nick : $user was not found in the database. Use \"@user list\" to list all users."
return 0
}
if { $what == list } {
db_load
set j 0
set listusers ""
for { set i 0 } { $i<[llength $info] } { incr i } {
lappend listusers [lindex [lindex $info $i] 0]
incr j
}
putserv "NOTICE $nick : $listusers "
return 0
}
}

proc invite { nick uhost hand chan arg } {
global active db
if {$active != $chan} { return 0 }
db_load
set user [lindex $arg 0]
set pass [lindex $arg 1]
if ([sites_search $user]!=-1) {
if (($user == [lindex $info 0]) && ($pass == [lindex $info 1])) {
putserv "PRIVMSG $chan :\0034=¤ INVITE ¤=\003\ invited: $nick from account $user"
putserv "invite $nick $chan"
}
return 0
}
if ([sites_search $user]!=-1) {
if (($user != [lindex $info 0]) || ($pass != [lindex $info 1])) {
putserv "NOTICE $nick :\0034=¤ INVITE ¤=\003\ Wrong username or password !!!!"
putserv "PRIVMSG $chan :\0034=¤ INVITE ¤=\003\ $nick tried to join #Chan"
}
return 0
}
if ([sites_search $user]==-1) {
putserv "NOTICE $nick :\0034=¤ INVITE ¤=\003\ Wrong username or password !!!!"
putserv "PRIVMSG $chan :\0034=¤ INVITE ¤=\003\ $nick tried to join #Chan"
}
}

proc db_save { } {
global db info
set fichier [open $db w]
puts $fichier $info
close $fichier
}

proc db_del { index } {
global db info
set info [lreplace $db $index $index]
}

proc db_load { } {
global db
set fichier [open $db r]
gets $fichier info
close $fichier
}

proc db_search { user pass } {
global info
for { set i 0 } { $i<[llength $info] } { incr i } {
if ![string compare [string tolower [lindex [lindex $info $i] 0]] [string tolower $user]] {
return $i
}
}
return -1
}
</code>
Locked