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.

Blacklist Script

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

TRY!!

Code: Select all

bind pub o|o .ban pub:ban
bind pub o|o .unban pub:ub

proc pub:ban {nick uhost hand chan text} {
  if {[botisop $chan] == 0} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[onchan $tnick $chan]} {
        if {[string length [lindex $text 1]] == 0} { set reason banned } else { set reason [lrange $text 1 end] }
      	set maska *!*@[lindex [split [getchanhost $tnick $chan] @] 1]
        putserv "PRIVMSG X :ban $chan $maska 1 100 $reason"
        newchanban $chan *!*@[lindex [split [getchanhost $tnick $chan] @] 1] $nick $reason 0
      } else { puthelp "notice $nick :no such nick on channel!" }
    } else { puthelp "NOTICE $nick :usage .ban <nick> reason" }
  } else { puthelp "NOTICE $nick :algo falla" }
}


proc pub:ub {nick uhost hand chan text} {
  if {[botisop $chan] == 0} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
		putserv "PRIVMSG X :unban $chan $tnick"
      if {[ischanban $tnick $chan]} { killchanban $chan $tnick } else { puthelp "NOTICE $nick :no such ban on $chan" }
    } else { puthelp "NOTICE $nick :usa .ub <nick!user@host>" }
  } else { puthelp "NOTICE $nick :Quitame el @" }
}
D
Danik
Halfop
Posts: 49
Joined: Sun Jun 15, 2008 12:59 pm
Location: Moldova
Contact:

Post by Danik »

Nor7on wrote:TRY!!

Code: Select all

bind pub o|o .ban pub:ban
bind pub o|o .unban pub:ub

proc pub:ban {nick uhost hand chan text} {
  if {[botisop $chan] == 0} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[onchan $tnick $chan]} {
        if {[string length [lindex $text 1]] == 0} { set reason banned } else { set reason [lrange $text 1 end] }
      	set maska *!*@[lindex [split [getchanhost $tnick $chan] @] 1]
        putserv "PRIVMSG X :ban $chan $maska 1 100 $reason"
        newchanban $chan *!*@[lindex [split [getchanhost $tnick $chan] @] 1] $nick $reason 0
      } else { puthelp "notice $nick :no such nick on channel!" }
    } else { puthelp "NOTICE $nick :usage .ban <nick> reason" }
  } else { puthelp "NOTICE $nick :algo falla" }
}


proc pub:ub {nick uhost hand chan text} {
  if {[botisop $chan] == 0} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
		putserv "PRIVMSG X :unban $chan $tnick"
      if {[ischanban $tnick $chan]} { killchanban $chan $tnick } else { puthelp "NOTICE $nick :no such ban on $chan" }
    } else { puthelp "NOTICE $nick :usa .ub <nick!user@host>" }
  } else { puthelp "NOTICE $nick :Quitame el @" }
}
I t doesn't work

[15:10:16] <user> .ban user test
[15:10:18] -botnick- algo falla
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

bind pub o|o .ban pub:ban
bind pub o|o .unban pub:ub

proc pub:ban {nick uhost hand chan text} {
   if {[string length $text] > 0} {
      set tnick [lindex [split $text] 0]
      if {[onchan $tnick $chan]} {
         if {[llength [split $text]] == 1} { set reason banned } else { set reason [join [lrange [split $text] 1 end]] }
         putserv "privmsg x :ban $chan $tnick 1 100 $reason"
      } else { puthelp "notice $nick :I cannot ask X to ban $tnick. They are not on $chan." }
   } else { puthelp "notice $nick :Please use proper format. Usage .ban <nick> \[<reason>\]" }
}


proc pub:ub {nick uhost hand chan text} {
   if {[string length $text] > 0} {
      set tnick [lindex [split $text] 0]
      putserv "privmsg x :unban $chan $tnick"
   } else { puthelp "notice $nick :Please use proper format. Usage .ban <nick> \[<reason>\]" }
}
Norton goofed, he has it check ( if [botisop $chan] == 0 ) and then perform the banning or unbanning. Problem is, that equation will only be true when the bot is NOT opped, and will cry to X to do the banning when it isn't opped. If the bot is opped, this script will do absolutely nothing (except message you "algo falla" (aka, something went wrong)), not quite what you had in mind. This check is NOT necessary since using X the bot can be opped or unopped and it will work. This is how the code above is written, without needless checks. Also corrected norton's flawed string/list manipulations which will cause problems for you with nicknames/reasons containing special characters. This is a very simple script, I've removed the part where eggdrop tries to add bans to it's internal ban list and have it only set these via X (so if opped your eggdrop won't fight with X to kick/ban people). You might have a problem when removing bans, because the script doesn't check just asks X to remove the ban. There are better X manipulation scripts available, this is just something to show you how to fish correctly. You can give a man a fish, and feed him for a day. Or you can teach a man to fish, and feed him for a lifetime. Tcl is alot like fishing to me...The forum is akin to a very big lake filled with vast varieties of fish. This attracts many talented fisherman. The advice given by these fisherman is second to none, there is much you can learn from them. A script is a fish. Anyone can ask for a fish, it takes a true talented fisherman to bring one safely onto the shore without hooking it through the eye, or the gills or any other mangling of the fish.

Keep in mind to use this, you bot must have access level high enough to ban and be known and identified through X.
Post Reply