mIRC Home    About    Download    Register    News    Help

Print Thread
#210088 04/03/09 01:45 PM
Joined: Dec 2008
Posts: 1,513
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,513
hi,

i want an alias when i use for example: /aban <nick>,<host>
to mode in all my currently channels a mode with +b <nick>,<host>
have anyone any idea's ?


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #210104 04/03/09 08:08 PM
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
;1= Nick 2= Kick & Reason

/aban $nick JoinFlood
:will ban $address($nick,5) and kick with reason JoinFlood

/aban $nick
:will ban by $address($nick,5)

Code:
alias aban {
  ;1= Nick 2= Kick & Reason
  if (!$1) { echo -a aBan error: Insufficient Paramters | return }
  var %ab_c = $chan(0), %ab_ = $address($1,5), %ab_m
  while (%ab_c) {
    %ab_m = $chan(%ab_c)
    if ($me isop %ab_m) {
      mode %ab_m +b $1
      if ($2) && ($1 ison %ab_m) kick %ab_m $1 $2-
    }
    dec %ab_c
  }
}

westor #210106 04/03/09 08:52 PM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Code:
alias aban {
  if (!$1) { echo 4 -a * Error: Insufficient Paramters e.g. /aban <nick> or /aban <nick> <reason> }  
  var %x = 1, %y = $comchan($1,0) | while (%x <= %y) { 
    if ($me isop $comchan($1,%x)) { ban -k $comchan($1,%x) $1 5 $2- }
    inc %x
  }
}

Tomao #210148 06/03/09 05:36 PM
Joined: Dec 2008
Posts: 1,513
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,513
i don't want use the /BAN command , i want to put a mode in all my currenly channels for e.g: #chan,#chan2,#chan3,#chan4,#chan5
(and if me is on these chan's)
with an alias i put an example with /ABAN alias!

e.g: /aban +b test!*@* (setting the mode +b test!*@* in all my chans) , or /aban +m (setting moderate into all my chans)

thanks

Last edited by westor; 06/03/09 05:37 PM.

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #210149 06/03/09 08:01 PM
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Ahh well, let this be a lesson for you in communication. smile

Im sure you can adjust my script easily to make it change any mode.

westor #210152 06/03/09 08:43 PM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Same syntax: /aban <nick> to set a +b on someone in all the channels where you are with the nick.
Code:
alias aban {
  if (!$1) { echo 4 -a * Error: Insufficient Paramters e.g. /aban <nick> or /aban <nick> <reason> }  
  var %x = 1, %y = $comchan($1,0) | while (%x <= %y) { 
    if ($me isop $comchan($1,%x)) { mode $comchan($1,%x) +b $1 $+ !*@* $2- }
    inc %x
  }
}

The syntax of the code below is /abanm It will pop a little input window to ask you for +m or -m all the channels where you are:
Code:
alias abanm {
  if ($me isop $chan) {  
    var %x = 1
    while (%x <= $chan(0)) {
      var %y = %y $chan(%x)
      inc %x
    }
    tokenize 32 %y
    mode $* $?="Enter +m or -m to set the mode to all channels you are in:"
  }
}

Tomao #210156 06/03/09 10:47 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Hm, I assumed the OP wants to use one command for all (valid) chanmodes, and +ban/-ban (where you can put a nick instead of a banmask) as well. This required some extra considerations (valid modes, required parameters, masks out of the ial/ibl ...). Hence, bit by bit, the code got quite bloated frown

Code:
/*
amode - set/remove modes on all channels.

Syntax: 
/amode +/-<mode> [mode parameters]
/amode +/-ban <nick> [kickreason]

Examples:
/amode -i                      will try to remove invite mode on all channels
/amode +m                      will try to set all channels moderated 
/amode +l 15                   will try to set limit 15 on all channels
/amode +b *some*!*mask@*       will try to ban this mask on all channels
/amode +ban <nick> [reason]    will try to ban <nick> with the default banmask on all channels. 
                               if <nick> is on a channel, it will try to kick <nick> with reason [reason]
/amode -b *!*somemask*@*       will try to remove this banmask on all channels
/amode -ban <nick>             will try to remove ALL bans affecting <nick> on all channels

Notes: 
1) You cannot set multiple modes at once, like /amode +mi
2) There's no check for "is this or that mode already set?"
3) The script won't try to set modes on channels where you don't have any status.
   But there's no check for "do I have the required status?" The status required varies from mode to mode, IRCd to IRCd
4) There's no check for "is a *valid* parameter provided? (e.g. a digit for mode +l, or a valid banmask for +/-b and +/-ban)
5) There's no "flood protection" for "/amode -ban <nick>":
   Because a single user many be affected by several bans on several channels, you *might* flood yourself off the server.
   The script tries to set as many mode -bbbb as allowed per line, it *may* issue too many mode commands at once none the less.
*/

alias amode {
  if ($1) {
    ; ### default bantype for "/amode +ban <nick> [reason] ###
    var %bantype = 5

    var %n = 1, %char = $left($1,1), %mode = $mid($1,2-), %mask, %echo = ECHO -agc info * /amode:
    ; valid mode prefix
    if (%char isin +-) {

      ;  mode is "ban" - separate routine, as /ban is no mode but a mIRC command  
      if (%mode == ban) { 
        ; nick/mask given
        if ($2) { 
          ; parameter is a nick in the internal address list
          if ((!$count($2,!,@,?,*)) && ($ial($2))) { var %mask = $v1 }

          ; parameter is a user in the internal address list
          if (%mask) {
            ; loop channels
            while ($chan(%n)) {
              ; you're not a regular user in this chan
              if ($me !isreg $v1) {
                var %chan = $v2
                ; +ban
                if (%char == +) {
                  ; try to set a ban on this user (defined bantype).
                  ; if a kick reason is given and the iser is in the channel: try to kick the user 
                  if ($2 ison %chan) { BAN -k %chan $2 %bantype $3- }
                  else { MODE %chan +b $mask(%mask,%bantype) }
                }
                ; -ban
                else {
                  ; try to remove all bans affecting this user
                  var %b = 1, %bstring
                  while ($ibl(%chan,%b)) {
                    if ($v1 iswm %mask) {
                      var %bstring = %bstring $v1
                      if ($numtok(%bstring,32) == $modespl) {
                        MODE %chan $+(-,$str(b,$v1)) %bstring
                        var %bstring
                      }
                    }
                    inc %b
                  }
                  if (%bstring) { MODE %chan $+(-,$str(b,$numtok($v1,32))) $v1 }
                }
              }
              inc %n
            }
          }
          ; parameter is no user in the internal address list: treat parameter as banmask instead
          else {
            ; loop channels
            while ($chan(%n)) {
              ; you're not a regular user in this chan
              if ($me !isreg $v1) { MODE $v2 %char $+ b $2 }
              inc %n
            }
          }
        }
        ; no nick/mask given
        else { %echo Parameter missing. Use: /amode +/-ban <nick> [reason] }
      }

      ;  valid channel mode 
      elseif ($left(%mode,1) isincs $remove($chanmodes,$chr(44))) {
        var %mode = $v1, %type = $findtokcs($chanmodes,$matchtokcs($chanmodes,%mode,1,44),1,44)
        ; no mode parameter given, but mode parameter required
        if (((%type isnum 1-2) && (!$2)) || ((%type == 3) && (%char == +) && (!$2))) {
          %echo Mode %char $+ %mode requires a parameter.
        }
        ; required mode parameter given, or no mode parameter required
        else {
          ; loop channels
          while ($chan(%n)) {
            ; you're not a regular user in this chan
            if ($me !isreg $v1) {
              ; try to set mode in this chan
              MODE $v2 %char $+ %mode $iif(((%type isnum 1-2) || ((%type == 3) && (%char == +))),$2-)
            }
            inc %n
          } 
        }
      }

      ; invalid mode
      else { %echo No or invalid mode. Use: /amode $+(+/-,$chr(2),<chanmode>,$chr(15)) [mode parameter] }
    }
    ; invalid mode prefix
    else { %echo No or invalid mode prefix. Use: /amode $+($chr(2),+/-,$chr(15),<chanmode>) [mode parameter] }
  }
  ; invalid syntax
  else { %echo Syntax is: amode +/-<chanmode> [mode parameter] }
}

Horstl #210159 07/03/09 12:11 AM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Thanks, Horstl, for your time.
Quote:
or /aban +m (setting moderate into all my chans)
I thought that was optional. I made the second one as an extra so the op can choose whichever that fits?

Tomao #210200 08/03/09 01:16 PM
Joined: Dec 2008
Posts: 1,513
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,513
hmm i tried and saw that the /amode is that i want ,

thanks for help , and thanks for your time laugh

Last edited by westor; 08/03/09 01:17 PM.

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-

Link Copied to Clipboard