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.

SIMPLE kick/ban w/timer

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
g
garfwen
Halfop
Posts: 61
Joined: Wed Mar 12, 2008 5:16 pm

SIMPLE kick/ban w/timer

Post by garfwen »

Hello !

I tryed but no sucess =D

I just want a simple ban/script like

.noflame $nick
+ban $nick
+kick $nick ( NO FLAME !!! )
(after 1 hour)
-ban $nick


Thanks !

GaRfWeN
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

Hopefully, you did not want it to just ban the nickname for the banmask :S
If you did, then let me know so i can change it. Here it is anyway,

Code: Select all

set noflame_access "o|o"            ;# access flags for public command
                                     # "global-flag"|"channel-flag"
set noflame_message "NO FLAME !!!"  ;# kick/ban message
set noflame_time "100"              ;# time to remove ban after this many minets

proc noflame:pub {nick host handle channel text} {
global noflame_message noflame_time
 if {([llength $text] == 0)} {
  puthelp "NOTICE $nick :Syntax: .noflame <nickname>"
  return 0
 }
 set target [lindex [split $text] 0]
 if {(![onchan $target $channel])} {
  puthelp "NOTICE $nick :I dont see $target on this channel."
  return 0
 } else {
  if {([string match "*!~*@*" "$target![getchanhost $target $channel]"])} {set banmask [maskhost [regsub "~" "$target![getchanhost $target $channel]" "*"]]} else {set banmask [mashost "$target![getchanhost $target $channel]"]}
  if {([botisop $channel]) || ([botishalfop $channel])} {
   putserv "KICK $channel $target :$noflame_message"
   putserv "MODE $channel +b $banmask"
   timer $noflame_time [list pushmode $channel -b $banmask]
   return 1
  } else {
   puthelp "NOTICE $nick :unable to kick/ban $target (i'm not oped)"
   return 0
  }
 }
}

proc noflame:checksettings {} {
 global noflame_message noflame_time noflame_access
  if {($noflame_access == "")} {
   putlog "noflame.tcl: invalid access flags set, should be <globalflag>|<channelflag> (setting it to default o|o)"
   set noflame_access o|o
  } else {
   bind pub $noflame_access .noflame noflame:pub
  }
  if {($noflame_time < 0) || ($noflame_time == 999)} {
   putlog "noflame.tcl: invalid ban time, should be above 0 and below 999. (setting it to default 100)"
   set noflame_time 100
  }
  if {($noflame_message == "") || ([llength $noflame_message] > 200)} {
   putlog "noflame.tcl: invalid kick messag. (setting to default \"Please do not flame in this channel\")"
   set noflame_message "Please do not flame in this channel"
  }
   return
}

putlog "loaded noflame.tcl"
return [noflame:checksettings]
haven't had time to test it, sorry. :) least you know where to find me, if it dosen't :D
g
garfwen
Halfop
Posts: 61
Joined: Wed Mar 12, 2008 5:16 pm

Ty.

Post by garfwen »

Hello !
1st ty.

Theres something wrong on the code, because the eggdrop does not kick/ban.

The other commands are working fine.

Guess its something over here:

Code: Select all

 
set target [lindex [split $text] 0]
 if {(![onchan $target $channel])} {
  puthelp "NOTICE $nick :I dont see $target on this channel."
  return 0
 } else {
  if {([string match "*!~*@*" "$target![getchanhost $target $channel]"])} {set banmask [maskhost [regsub "~" "$target![getchanhost $target $channel]" "*"]]} else {set banmask [mashost "$target![getchanhost $target $channel]"]}
  if {([botisop $channel]) || ([botishalfop $channel])} {
   putserv "KICK $channel $target :$noflame_message"
   putserv "MODE $channel +b $banmask"
   timer $noflame_time [list pushmode $channel -b $banmask]
   return 1
  } else {
   puthelp "NOTICE $nick :unable to kick/ban $target (i'm not oped)"
   return 0
  }
 }
}

Cumps,
GaRfWeN
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

Could you give more details please? They only way from that, which the bot couldn't be kicking and banning someone was if they where not A Channel Operator or Channel HalfOp (if supported). :? other than that, it would be becouse the nickname you supplyed wasn't on the bots channel where you used the command.
g
garfwen
Halfop
Posts: 61
Joined: Wed Mar 12, 2008 5:16 pm

Post by garfwen »

Nop, the egg has op (im runnig it on qnet, #cs.gthr.pt)
When i type wrong nick he notices me, and also when i just dont put any nick.
It just doesnt works on the kick/ban acting: he does nothing.
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

Ok after testing the script my self, I've found no problems. The bot seems to be kicking and banning as it should given its a little fast to kick. but not really seeing any problem with that.
[05:30:48] <@Me> .noflame Flamer
[05:30:49] * Flamer was kicked by bot (NO FLAME !!!)
[05:30:50] * bot sets mode: +b *!*noident@*.flame.org
The Bot Not oped on the channel seems to work
[05:31:11] <@ME> .noflame Flamer
[05:31:11] -bot- unable to kick/ban Flamer (i'm not oped)
And when the nickname isn't on the channel it works fine.
[05:31:04] <@Me> .noflame Flamer
[05:31:05] -bot- I dont see Flamer on this channel.
I got the same thing on Quakenet :) so i doubt it was a problem the syntax. :arrow: I'd check out if anything on your bot could be preventing it from kicking and banning :?: or an other script :idea:

Example: do you use some kind of "maskhost fixing script" that could be causing the problem? since the "maskhost" is used in this script.
g
garfwen
Halfop
Posts: 61
Joined: Wed Mar 12, 2008 5:16 pm

Post by garfwen »

hey.

Nop have no idea.

I search a little and i found a script... with some edits:

Code: Select all

bind PUB - .noflame pub:timeban

proc pub:timeban {nickname hostname handle channel arguments} {
  if {[llength [set arguments [split $arguments]]] < 1} {
    putquick "NOTICE $nickname :Usage: !timeban nickname"
  } elseif {![onchan [set nick [lindex $arguments 0]] $channel]} {
    putquick "NOTICE $nickname :I don't see $nick on $channel!"
  } else {
    if {[isop $nickname $channel]} {
    putquick "MODE $channel +b $nick"
    putquick "KICK $channel $nick :\026 Flame não é permitido, ban 60 minutos. Regras: http://gather.dotsi.pt \026"

    timer 60 [list putquick "MODE $channel -b $nick"]
    }
  }
}

This1 is working on my egg.

Ty TCL_no_TK.

GaRfWeN
Post Reply