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 

unban help... [solved]

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
mavericku
Halfop


Joined: 12 Jun 2005
Posts: 62
Location: somewhere in the world

PostPosted: Thu Dec 07, 2006 6:44 pm    Post subject: unban help... [solved] Reply with quote

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:

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 ...
_________________
mavericku


Last edited by mavericku on Fri Dec 08, 2006 3:08 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Thu Dec 07, 2006 6:51 pm    Post subject: Reply with quote

put another test in there like:
Code:

if {[isban $tnick]} {killban $tnick}
Back to top
View user's profile Send private message
mavericku
Halfop


Joined: 12 Jun 2005
Posts: 62
Location: somewhere in the world

PostPosted: Fri Dec 08, 2006 2:41 pm    Post subject: Reply with quote

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:

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


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Dec 08, 2006 2:51 pm    Post subject: Reply with quote

[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.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
mavericku
Halfop


Joined: 12 Jun 2005
Posts: 62
Location: somewhere in the world

PostPosted: Fri Dec 08, 2006 3:07 pm    Post subject: Reply with quote

Thanks guys .. it works ... Very Happy
_________________
mavericku
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Fri Dec 08, 2006 3:28 pm    Post subject: Reply with quote

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

if {$foo == "bar"} {
         dosomething
         dosomething else
         if {$whatever == "foo"} {
               more junk
               blah blah
         }
}

instead of like you had:
Code:

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:

if {$blah} {
  if {$foo} {
  } else {
  if {$biz} {
}

Just some suggestions, it would make your script writing/debugging easier for you (and us! Smile
Back to top
View user's profile Send private message
mavericku
Halfop


Joined: 12 Jun 2005
Posts: 62
Location: somewhere in the world

PostPosted: Fri Dec 08, 2006 6:05 pm    Post subject: Reply with quote

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. Smile
_________________
mavericku
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
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