Difference between revisions of "On ban"

From Scriptwiki
Jump to: navigation, search
 
m
 
Line 30: Line 30:
  
 
== See Also ==
 
== See Also ==
Take a look at the [[On_unban|On unban event]] to react on unbans.
+
* [[On_unban|On unban event]] to react on unbans.
  
 
[[Category:Events]]
 
[[Category:Events]]

Latest revision as of 10:50, 2 July 2007

The on BAN event trigger when a user on a channel is banned.

on <level>:BAN:<#[,#]>:<commands>

There are several special identifier connected with this event:

  • $banmask refers to the banmask used to ban the user.
  • $bnick refers to the banned users nickname, however this would actually only be filled if the banmask itself includes a nickname. If the banmask does not include a nickname, $bnick is $null.

Note that $banmask is usually a wildcard string which means that it will be matching wildcard strings in your remote users section.


Example

on *:BAN:#help.script: { echo -a $nick just banned $banmask }

This will just react on every ban in #help.script echoing who banned what mask.

The next example is kind of the same as the one above, but it will additionally echo what nicks are affected:

on *:Ban:#help.script: {
 ; echo the first sentence as above
 echo -a $nick just banned $banmask $+ . This has effect on:
 ; now lets loop through all affected
 var %i = 1
 ; $ialchan($banmask,$chan,0) returns the total number of matched nicks.
 while (%i <= $ialchan($banmask,$chan,0)) {
  ; actually echo the nicks. $ialchan($banmask,$chan,%i) returns the %i's matched nick.
  echo -a $ialchan($banmask,$chan,%i)
  ; increase the looping-variable
  inc %i
 }
}

See Also