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.

Banning the user who last left

Old posts that have not been replied to for several years.
Locked
User avatar
Aron
Halfop
Posts: 86
Joined: Sat Mar 15, 2003 8:35 am

Banning the user who last left

Post by Aron »

I searched for script that do this, but coulnd find one.
The banning part shouldnt be a problem, but i dont have a clue how to check if a user has left.
Any help would be greatly appreciated :)
The best way to start learning is to start helping.
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

i'd imagine that the "part" bind is perfect for this.

better have a look at good ol' tcl-commands.doc
photon?
User avatar
Aron
Halfop
Posts: 86
Joined: Sat Mar 15, 2003 8:35 am

Post by Aron »

k, thanks for that :)

I tried to make something, but im a real tcl noob, so it didnt actually work (although not crashing my bot is a whole prestige for me)

Here it is..:

Code: Select all

bind part -|- *!*@* lastban_check
bind pub o|o !lastban lastban_do

proc lastban_check {nick uhost hand chan msg } {
  set lastleft_nick $nick
  set lastleft_host $uhost
}

proc lastban_do {nick uhost hand chan arg } {
  global lastleft_nick lastleft_host
  newchanban $chan $lastleft_nick!$lastleft_host $nick $arg
}
It says the variable lastleft_host doesnt exist...

I know, this script would still suck IF it would work, since it would not have multiple channel support, so if anyone knows a way around this too... *hint* :)

Thanks.
The best way to start learning is to start helping.
User avatar
Aron
Halfop
Posts: 86
Joined: Sat Mar 15, 2003 8:35 am

Post by Aron »

* bump *
The best way to start learning is to start helping.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Can we ask you not to bump threads.

On forums where you expect all the help you can get, without contributing yourself, you will find that the more you bump it, the less chance you have of obtaining help.

People will help you when they are good and ready.

If you feel I am incorrect in saying this, can I ask you where in the registration document it said we will help you in under 24 hours (your bump threads came in less than that).
User avatar
Aron
Halfop
Posts: 86
Joined: Sat Mar 15, 2003 8:35 am

Post by Aron »

Yeah, i guess you're right.

Sorry for bumping, it will be the last time it happened.
The best way to start learning is to start helping.
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

a few modifications (so it will work, and work in all channels):

Code: Select all

bind part - "*" part:msg
bind pub o|o !lastban pub:lastban 

proc part:msg { nick uhost hand chan msg } {
  global lastleft
  set lastleft(nick) $nick
  set lastleft(host) $uhost
}

proc pub:lastban { nick uhost hand chan text } {
  global lastleft
  newchanban $chan $lastleft(nick)!$lastleft(host) $nick $text 
}
just barely tested it so if anything [censored] up just drop a line
photon?
User avatar
Aron
Halfop
Posts: 86
Joined: Sat Mar 15, 2003 8:35 am

heh

Post by Aron »

thanks anyways, but i already fixed it after a phew hours :)
I also added a undo command to unban the last banned user.

Code: Select all


bind sign - * banquit
bind part - * banquit
bind mode - * lastban_check


bind pub o|o banlast banlast
bind pub o|o undo ban_undo

set lastbanned($chan) ""

proc lastban_check {nick uhost hand chan mode victim } {
 global lastbanned
  if {[lindex $mode 0] == "+b"} {
   set lastbanned($chan) $victim
   }  
}


proc ban_undo {nick uhost hand chan arg} {
 global lastbanned
 pushmode $chan -b $lastbanned($chan) 
 killchanban $chan $lastbanned($chan)
}
  

proc banquit {nick uhost hand chan reason} {
   global mask
   set mask($chan) "*!*@[lindex [split $uhost @] 1]" 
}

proc banlast {nick uhost hand chan arg} {
  global mask
  if {![botisop $chan]} { return }
  if {[lindex $arg 0] == ""} { set arg "60" }
  if {![info exists mask($chan)]} { 
    puthelp "NOTICE $nick :No user has left the channel"
    return
  }
  newchanban $chan $mask($chan) "\002$arg\002 minutes ban" $arg
  pushmode $chan +b $mask($chan) 
}

putlog "lastban.tcl by AsoAron loaded.."

:)
The best way to start learning is to start helping.
Locked