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.

!sry to unban and reinvite the last banned user

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
b
bro0
Voice
Posts: 10
Joined: Wed Apr 01, 2009 6:02 am

!sry to unban and reinvite the last banned user

Post by bro0 »

hi all (:

it would be great if there is a script which has a function like '!sry'.. if a script of the eggdrop worked wrongly or what ever.. and to reinvite the last kicked user / banned user (and unban him)..
.. in the last 5 minutes (!?)

and the command should be available for voice (and surly opped) users only.. =p


i hope thats a good idea and there is a scripter who also think so :p
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

Code: Select all

##
# SCRIPT
##

proc sorry:kick {nick host handle channel target reason} {
 global sorry
 if {![isbotnick $target]} {
  set target-host "$target![getchanhost $target]"
  set sorry($channel) "kick,$target,${target-host},[clock seconds],$reason"
  set sorry(kick:$channel) "$target,${target-host},[clock seconds],$reason"
  putloglev 1 * "sorry.tcl: added kick on $channel for '${target-host}' ($reason)"
  return
 }
}

proc sorry:mode {nick host handle channel mode target} {
 global sorry
 set target-nick [findnicks "$target" "$channel"]
 if {(${target-nick} != "") && (![isbotnick ${target-nick}])} {
  set target-host "${target-nick}![getchanhost ${target-nick}]"
  set sorry($channel) "ban,{$target-nick},${target-host},$target,[clock seconds],$nick"
  set sorry(ban:$channel) "${target-nick},${target-host},$target,[clock seconds],$nick"
  putloglev 1 * "sorry.tcl: added ban on $channel for '${target-host}' ($target)"
  return
 }
}

proc sorry:raw {from key text} {
 global sorry
 set _target [lindex [split $text] 1]
 if {[info exists sorry(invite:$_target)]} {
  puthelp "PRIVMSG $sorry(invite:$_target) :\001ACTION detected that $_target has left\001"
  putloglev 1 * "sorry.tcl: recived 401 from server, invite of $_target to $sorry(invite:$_target) has failed."
  return
 }
}

proc sorry:pub {nick host handle channel text} {
 global sorry
 if {![info exists sorry($channel)]} {
  puthelp "NOTICE $nick :Sorry, i have not been able to detect any kicks or bans in $channel"
  return 0
 }
 if {[llength $text] == 0} {
  regsub -all "," "$sorry($channel)" " " string
  switch -- [lindex $string 0] {
   "kick" {
           set a [lindex $string 1]; set b [lindex $string 3]; set c [join [lrange $string 4 end]]
           puthelp "NOTICE $nick :inviting $a to $channel after being kicked [duration [expr {[clock seconds]-$b}]] ago for $c"
           set sorry(invite:$a) "$channel"
           puthelp "INVITE $a $channel"
           return 1
          }
   "ban" {
          set a [lindex $string 1]; set b [lindex $string 3]; set c [lindex $string 4]; set d [lindex $string 5]
          puthelp "NOTICE $nick :inviting $a to $channel after being banned by $b [duration [expr {[clock seconds]-$c}]] ago by $d"
          if {[sorryBAN "$b" "$channel"]} {
           set sorry(invite:$a) "$channel"
           putserv "INVITE $a $channel"
           return 1
          } else {
           puthelp "NOTICE $nick :unable to remove the ban $b"
           return 0
          }
         }
  }
 }
 switch -- [lindex $text 0] {
  "-kick" {
           if {[info exists sorry(kick:$channel)]} {
            regsub -all "," "$sorry(kick:$channel)" " " string
            set _nick [lindex $string 0]; set _ktime [lindex $string 2]; set _kwhy [join [lrange $string 3 end]]
            puthelp "NOTICE $nick :Inviting $_nick to $channel after being kicked [duration [expr {[clock seconds]-$_ktime}]] ago for $_kwhy"
            set sorry(invite:$_nick) "$channel"
            putserv "INVITE $_nick $channel"
            return 1
           } else {
            puthelp "NOTICE $nick :I was unable to detect the last kick on $channel, sorry."
            return 0
           }
          }
  "-ban" {
          if {[info exists sorry(ban:$channel)]} {
           regsub -all "," "$sorry(ban:$channel)" " " string
           set _nick [lindex $string 0]; set _btime [lindex $string 3]; set _bmask [lindex $string 2]; set _bby [lindex $string 4]
           puthelp "NOTICE $nick :Inviting $_nick to $channel after they have been banned by $_bmask [duration [expr {[clock seconds]-$_btime}]] ago by $_bby"
           if {[sorryBAN "$_bmask" "$channel"]} {
            set sorry(invite:$_nick) "$channel"
            putserv "INVITE $_nick $channel"
            return 1
           } else {
            puthelp "NOTICE $nick :sorry, i have not been able to remove the ban $_bmask. You try removing it!"
            return 0
           }
          } else {
           puthelp "NOTICE $nick :I was unable to detect the last ban on $channel, sorry."
           return 0
          }
         }
  default {
           puthelp "NOTICE $nick :Syntax: \002!sorry\002 <-kick/-ban>"
           puthelp "NOTICE $nick :Removes the last kick or ban and invites the user to join the channel"
           puthelp "NOTICE $nick :if you use the \002-kick\002 option, only the last user kicked will be invited"
           puthelp "NOTICE $nick :if you use the \002-ban\002 option, only the last user banned will be invited"
           return 1
          }
 }
}

proc sorryBAN {host channel} {
 if {[isban "$host"]} {
  if {[killban "$host"]} {
   return 1
  } else {
   return 0
  }
 } elseif {[isban "$host" "$channel"]} {
  if {[killchanban "$channel" "$host"]} {
   return 1
  } else {
   return 0
  }
 } elseif {[ischanban "$host" "$channel"]} {
  pushmode $channel -b $host
  return 1
 } else {
  # we are just going to assume its been removed by someone else
  return 1
 }
}

 bind pub o|o !sorry sorry:pub
 bind raw - 401 sorry:raw
 bind mode - "*+b*" sorry:mode
 bind kick - "*" sorry:kick
 putlog "loaded sorry.tcl version 1.0(b) by TCL_no_TK"
 return
tested, and it works ok :) could be betta :wink:
b
bro0
Voice
Posts: 10
Joined: Wed Apr 01, 2009 6:02 am

Post by bro0 »

big thanks, great work :)
<3
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

Code: Select all

<Modo> [19:57] Tcl error [sorry:mode]: invalid command name "findnicks"
What is the error?
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

You didn't install MC_8's More Tools TCL Script :!:
Post Reply