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.

unban help... [solved]

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
mavericku
Halfop
Posts: 62
Joined: Sun Jun 12, 2005 11:32 pm
Location: somewhere in the world
Contact:

unban help... [solved]

Post by mavericku »

a quick question guys..

i have a script that responds to .ub (host) and unbans the host trough killchanban and privmsg x ..
but it will do it only if the ban is on the channel banlist .. if it isn't it doesn't do nothing ..
can you help me out with this?
i'd like it to remove the ban from its internal banlist even if it is not on the channel banlist.

here is the code.

Code: Select all

bind pub n|o .ub pub:ub

proc pub:ub {nick uhost hand chan text} {
 global botnick drchan drreason opsc
  if {[botisop $drchan]} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[ischanban $tnick $drchan]} { 
      killchanban $drchan $tnick
      putquick "privmsg X :unban $drchan $tnick" 
      putserv "privmsg $opsc :$hand/$nick: Am scos ban-ul \002$tnick\002 de pe $drchan"
      } else { puthelp "prvmsg X :unban $drchan $tnick" }
    } else { puthelp "NOTICE $nick :SYNTAX: .ub <nick!user@host> - unbans an address" }
  } else { puthelp "NOTICE $nick :Pfff n-am op!" }
}
Thanks in advance ...
Last edited by mavericku on Fri Dec 08, 2006 3:08 pm, edited 1 time in total.
mavericku
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

put another test in there like:

Code: Select all

if {[isban $tnick]} {killban $tnick}
User avatar
mavericku
Halfop
Posts: 62
Joined: Sun Jun 12, 2005 11:32 pm
Location: somewhere in the world
Contact:

Post by mavericku »

rosc2112, thanks for your help .. but it doesn't work ..
as i know the "killban" command removes a ban from the GLOBAL banlist .. not from a channel banlist... ( in the bots internal banlist) ...

correct me if i`m wrong ..

New code :

Code: Select all

bind pub n|o .ub pub:ub 

proc pub:ub {nick uhost hand chan text} { 
 global botnick drchan drreason opsc 
  if {[botisop $drchan]} { 
    if {[string length $text] > 0} { 
      set tnick [lindex $text 0] 
      if {[ischanban $tnick $drchan]} { 
      killchanban $drchan $tnick 
      putquick "privmsg X :unban $drchan $tnick" 
      putserv "privmsg $opsc :$hand/$nick: I removed \002$tnick\002 from $drchan" } 
      if {[isban $tnick]} 
      killban $tnick 
      } else { puthelp "NOTICE $nick : I can't see that ban in the channel list" } 
    } else { puthelp "NOTICE $nick :SYNTAX: .ub <nick!user@host> - unbans an address" } 
  } else { puthelp "NOTICE $nick :Pfff n-am op!" } 
} 
Did i do something wrong? ...
Thanks again
mavericku
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

[ischanban] checks if the ban exists in the channel's banlist (not the bot's) so to check if a ban exists in the bot's ban list you need to use [isban] instead, so replacing the command will probably solve your problem.
User avatar
mavericku
Halfop
Posts: 62
Joined: Sun Jun 12, 2005 11:32 pm
Location: somewhere in the world
Contact:

Post by mavericku »

Thanks guys .. it works ... :D
mavericku
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Mav, your code is hard to read, it would be a big help to you (and us! :) if you tabulate correctly and put closing braces below the line that if's and such finish on, like:

Code: Select all

if {$foo == "bar"} {
         dosomething
         dosomething else
         if {$whatever == "foo"} {
               more junk
               blah blah
         }
}
instead of like you had:

Code: Select all

if {[ischanban $tnick $drchan]} {
      stuff
      more stuff
      blah blah stuff } 
Using tabs is, imo, preferable to using spaces, cos it's much easier to see where segments begin and end, compared to:

Code: Select all

if {$blah} {
  if {$foo} {
  } else {
  if {$biz} {
}
Just some suggestions, it would make your script writing/debugging easier for you (and us! :)
User avatar
mavericku
Halfop
Posts: 62
Joined: Sun Jun 12, 2005 11:32 pm
Location: somewhere in the world
Contact:

Post by mavericku »

thank you for your suggestion,i will make it readable as soon as i have some free time on my hands.

The thing is i`m not such a good scripter ... a n00b actualy...
I just realised that .. even if i made it for me (i know where and what does) it needs to be ... readable (for problems like this)

Thank you again. :)
mavericku
Post Reply