mIRC Home    About    Download    Register    News    Help

Print Thread
#158999 12/09/06 03:22 PM
Joined: Aug 2006
Posts: 44
X
Xtibian Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
Joined: Aug 2006
Posts: 44
Everything in this works but the !add. I was wondering if any of you would be able to fix this for me.

Thank you.

Code:
on me:*:join:#:{

  if $hget(Blacklist,$+($network,.,$chan)) == $null {

    .hadd -m Blacklist $+($network,.,$chan) 3

    .hadd -m Blacklist $network $addtok($hget(Blacklist,$network),$chan,44)

  }

  elseif $hget(Blacklist,$+($network,.,$chan)) < 1 {

    .msg $chan 4This channel has been blacklisted. If you wish to get off the black list message 6Xtibian4.

    .part $chan

  }

  else {

    .msg $chan 6There are4 $hget(Blacklist,$+($network,.,$chan)) kicks 6of me left before this channel is 4blacklisted6.

  }

}



on *:kick:#:{

  if $knick == $me {

    .hdec -m Blacklist $+($network,.,$chan) 1

    if $hget(Blacklist,$+($network,.,$chan)) {

      .join $chan

    }

  }

}



on *:start:{

  if !$hget(Blacklist) { .hmake Blacklist 10 }

  if $exists(Blacklist.hsh) { .hload Blacklist Blacklist.hsh }

}



on *:exit:{

  .hsave -o Blacklist Blacklist.hsh

}



on *:disconnect:{

  .hsave -o Blacklist Blacklist.hsh

}



on *:connect:{

  if $hget(Blacklist,$network) {

    .join $hget(Blacklist,$network)

  }

} 



on *:text:!remove*:*:{

  if ($nick == Xtibian) {

    if !$2 {

      .notice $nick 6No network or channel specified.

    }

    elseif !$3 {

      if $hfind(Blacklist,$+($2,.,*),0,w) {

        .hdel +w Blacklist $+($2,.,*)

        .notice $nick 6Network4 $2 6removed from 4blacklist6.

      }

      elseif $hfind(Blacklist,$+(*,.,$2),0,w) {

        .hdel +w Blacklist $+(*,.,$2)

        .notice $nick 6Channel4 $2 6removed from all networks on 4blacklist6.

      }

      else {

        .notice $nick $2 not found in blacklist.

      }

    }

    elseif $hfind(Blacklist,$+($2,.,$3),0) {

      .hdel Blacklist $+($2,.,$3)

      .notice $nick Channel $3 on network $2 removed from blacklist.

    }

    else {

      .hsave -o Blacklist Blacklist.hsh | .hload Blacklist Blacklist.hsh 

      .notice $nick Channel $3 on network $2 not found on blacklist.

    }

  }

  else {

    .notice $nick Channel $3 on network $2 not found on blacklist.

  }

}  

on *:text:!add*:*:{

  if ($nick == Xtibian) {

    if !$2 {

      .notice $nick 6No network or channel specified.

    }

    elseif !$3 {

      .hadd -m Blacklist $+($network,.,$2)

      .hadd -m Blacklist $network $addtok($hget(Blacklist,$network),$2,44)

      .notice $nick Channel $2 added for Network $network

    }

    else {

      .hadd -m Blacklist $+($2,.,$3)

      .hadd -m Blacklist $2 $addtok($hget(Blacklist,$2),$3,44)

      .notice $nick Channel $2 added for Network $3

    }

  }

  .hsave -o Blacklist Blacklist.hsh | .hload Blacklist Blacklist.hsh 

}


Newbie Scripter. Learning pretty fast...lol :P
#159000 12/09/06 03:30 PM
Joined: Dec 2005
Posts: 58
S
Babel fish
Offline
Babel fish
S
Joined: Dec 2005
Posts: 58
Use One Text Event Like this ;

Code:
on *:text:*:*:{
  if ($1 == !remove) {  
    if ($nick == Xtibian) {
      if !$2 {
        .notice $nick 6No network or channel specified.
      }
      elseif !$3 {
        if $hfind(Blacklist,$+($2,.,*),0,w) {
          .hdel +w Blacklist $+($2,.,*)
          .notice $nick 6Network4 $2 6removed from 4blacklist6.
        }
        elseif $hfind(Blacklist,$+(*,.,$2),0,w) {
          .hdel +w Blacklist $+(*,.,$2)
          .notice $nick 6Channel4 $2 6removed from all networks on 4blacklist6.
        }
        else {
          .notice $nick $2 not found in blacklist.
        }
      }
      elseif $hfind(Blacklist,$+($2,.,$3),0) {
        .hdel Blacklist $+($2,.,$3)
        .notice $nick Channel $3 on network $2 removed from blacklist.
      }
      else {
        .hsave -o Blacklist Blacklist.hsh | .hload Blacklist Blacklist.hsh 
        .notice $nick Channel $3 on network $2 not found on blacklist.
      }
    }
    else {
      .notice $nick Channel $3 on network $2 not found on blacklist.
    }
  } 
  if ($1 == !add) {
    if ($nick == Xtibian) {
      if !$2 {
        .notice $nick 6No network or channel specified.
      }
      elseif !$3 {
        .hadd -m Blacklist $+($network,.,$2)
        .hadd -m Blacklist $network $addtok($hget(Blacklist,$network),$2,44)
        .notice $nick Channel $2 added for Network $network
      }
      else {
        .hadd -m Blacklist $+($2,.,$3)
        .hadd -m Blacklist $2 $addtok($hget(Blacklist,$2),$3,44)
        .notice $nick Channel $2 added for Network $3
      }
    }
    .hsave -o Blacklist Blacklist.hsh | .hload Blacklist Blacklist.hsh 
  }
}


tags there -> if ($1 == !remove) & if ($1 == !add)


i like that
#159001 12/09/06 04:05 PM
Joined: Aug 2006
Posts: 44
X
Xtibian Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
Joined: Aug 2006
Posts: 44
Thank you, but the !add still doesn't work right. :S


Newbie Scripter. Learning pretty fast...lol :P
#159002 12/09/06 04:24 PM
Joined: Jul 2006
Posts: 26
I
Ameglian cow
Offline
Ameglian cow
I
Joined: Jul 2006
Posts: 26
Don't you just hate it when a command doesn't work properly? :P

Btw, Xtibian, I sent you a PM.


Very new to mIRC, don't know much.
#159003 12/09/06 09:54 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
For a single on text event, he'd be better using
Code:
 on *:text:*:*:{
  if ($nick == Xtibian) {
    if !$2 {
      .notice $nick 6No network or channel specified.
    }
    elseif ($1 == !remove) {  
      if !$3 {
        if $hfind(Blacklist,$+($2,.,*),0,w) {
          .hdel +w Blacklist $+($2,.,*)
          .notice $nick 6Network4 $2 6removed from 4blacklist6.
        }
        elseif $hfind(Blacklist,$+(*,.,$2),0,w) {
          .hdel +w Blacklist $+(*,.,$2)
          .notice $nick 6Channel4 $2 6removed from all networks on 4blacklist6.
        }
        else {
          .notice $nick $2 not found in blacklist.
        }
      }
      elseif $hfind(Blacklist,$+($2,.,$3),0) {
        .hdel Blacklist $+($2,.,$3)
        .notice $nick Channel $3 on network $2 removed from blacklist.
      }
      else {
        .hsave -o Blacklist Blacklist.hsh | .hload Blacklist Blacklist.hsh 
        .notice $nick Channel $3 on network $2 not found on blacklist.
      }
      else {
        .notice $nick Channel $3 on network $2 not found on blacklist.
      }
    }
    elseif ($1 == !add) {
      if !$3 {
        .hadd -m Blacklist $+($network,.,$2)
        .hadd -m Blacklist $network $addtok($hget(Blacklist,$network),$2,44)
        .notice $nick Channel $2 added for Network $network
      }
      else {
        .hadd -m Blacklist $+($2,.,$3)
        .hadd -m Blacklist $2 $addtok($hget(Blacklist,$2),$3,44)
        .notice $nick Channel $2 added for Network $3
      }
    }
    .hsave -o Blacklist Blacklist.hsh | .hload Blacklist Blacklist.hsh 
  }
}
 

That way the conditions that were repeated in your code are only executed once.

#159004 14/09/06 04:13 AM
Joined: Aug 2006
Posts: 44
X
Xtibian Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
Joined: Aug 2006
Posts: 44
Ok, but none of these solve my problem.


Newbie Scripter. Learning pretty fast...lol :P

Link Copied to Clipboard