egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Blacklist Script
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Fri Jun 27, 2008 5:57 pm    Post subject: Reply with quote

TRY!!

Code:

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 @" }
}
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
Danik
Halfop


Joined: 15 Jun 2008
Posts: 49
Location: Moldova

PostPosted: Sat Jun 28, 2008 8:11 am    Post subject: Reply with quote

Nor7on wrote:
TRY!!

Code:

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
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sat Jun 28, 2008 9:54 am    Post subject: Reply with quote

Code:
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.
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber