Id: 7882; Nick: Dor; Timestamp: 2008-03-26 17:50:09; Pasted as: mIRC
Description: Clear Chanlev Script by Dor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
;Hello, and thank you for using the Chanlev Clear system.
;Once you preform the command /clearchanlev do nothing at quakenet, as it may cause you to disconnect.
;
;Use /clearchanlev #channel to remove everyone but yourself
;Use /clearchanlev -r #channel to remove everyone, thus removing Q from the channel. 
;Use the d switch (-d or -rd) to show debug messages.
;
;For the command to succeed, you must:
;--Be on the channel.
;--Have Q on the channel
;--Have owner status (+n) on the channel
 
 
alias -l cc.playdelay {
  ;This is the delay (in miliseconds) between each request to remove a user. 2500 will be fine in most cases.
  return 2500
}
alias clearchanlev {
  if ($network !=== QuakeNet) { echo -atgce info * /clearchanlev: Invalid network. | halt }
  if (!$1) || ((-* iswm $1) && (!$2)) { echo -agtce info * /clearchanlev: Insufficient parameters. | halt }
  if (-* !iswm $1) && (#* !iswm $1) { echo -atgce info * /clearchanlev: Invalid parameters. | halt }
  set %cc.chan $iif(-* iswm $1,$2,$1)
  if (Q !ison %cc.chan) { echo -atgce info * /clearchanlev: No Q detected on $v2 $+ . | unset %cc.* | halt }
  if (-* iswm $1) {
    if (- == $1) { echo -atgce info * /clearchanlev: Invalid parameters. | halt }
    if (r isin $1) {
      if ($input(WARNING! This action is about to remove Q from your channel. $crlf $+ This action is irreversible. $crlf $crlf $+ Are you sure you want to continue?,ywd,WARNING - Are You Sure?) == $true) { set %cc.remove 1 }
      else { halt }
    }
    if (d isin $1) { 
      set %cc.debug 1
      echo -atgce info * /clearchanlev: Debug mode: ON.
    }
  }
  if ($exist(clearchanlev.txt)) { .remove clearchanlev.txt }
  .disable #clearchanlev*
  echo -atgce info * /clearchanlev: Initiating Clear Chanlev.
  who $me n%na
  if (%cc.debug) { echo -atgce info * /clearchanlev: Recieving own auth... }
  .enable #clearchanlev.who
}
 
#clearchanlev.who off
raw 354:*:set %cc.myqacc $3 | halt
raw 315:*:{
  .timer 1 0 .disable #clearchanlev.who 
  if (%cc.debug) { echo -atgce info * /clearchanlev: Own auth recieved. %cc.myqacc }
  .msg Q chanlev %cc.chan
  .enable #clearchanlev
  halt
}
#clearchanlev.who end
 
#clearchanlev off
on ^*:notice:*:?:{
  if ($network == Quakenet) && ($nick == Q) {
    haltdef
    if (Known users on* iswm $1-) { halt }
    if (Username*Flags*Last join*Last changed iswm $1-) {
      set %cc.write 1 
      if (%cc.debug) { echo -atgce info * /clearchanlev: Recieving user list into clearchanlev.txt... }
      halt 
    }
    if (End of list. == $1-) { halt }
    if (Done. == $1) { halt }
    if (You do not have sufficient access on* iswm $1-) { unset %cc.* | .timer 1 0 .disable #cc.* #clearchanlev | echo -atgce info * /clearchanlev: Action stopped due to insufficient access. }
    if (Total:* iswm $1-) { 
      if (%cc.write) {
        if (%cc.debug) { echo -atgce info * /clearchanlev: User list recieved. beginning to remove users. }
        cc.finish 
      }
      else { .remove clearchanlev.txt | unset %cc.* | .timer 1 0 .disable #cc.* #clearchanlev | echo -atgce info * /clearchanlev: Action stopped due to insufficient access. }
      halt 
    }
    if ($1 == %cc.myqacc) {
      if  (n !isin $2) { unset %cc.write | echo -atgce info * /clearchanlev: You don't have the required access level on %cc.chan $+ . | halt }
      if (%cc.remove) && (%cc.write) {
        if (%cc.debug) { echo -atgce info * /clearchanlev: Writing to file: %cc.myqacc }
        write clearchanlev.txt %cc.myacc 
      }
    }
    if (%cc.write) && ($1 != %cc.myqacc) {
      if (%cc.debug) { echo -atgce info * /clearchanlev: Writing to file: $1 }
      write clearchanlev.txt $1
    }
  }
}
#clearchanlev end
alias -l cc.finish {
  play -a cc.removeuser %cc.chan clearchanlev.txt $cc.playdelay
}
alias -l cc.removeuser {
  .msg Q removeuser $1 #$2
  if (%cc.debug) { echo -atgce info * /clearchanlev: Removing user: $2 }
}
on *:playend:{ if ($nopath($filename) == clearchanlev.txt) { echo -atgce info * /clearchanlev: Successfuly removed $lines($v1) users on %cc.chan $+ . | .remove $v1 | unset %cc.* | .disable #clearchanlev* } }
 
Parsed for bracket errors and indented:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
;Hello, and thank you for using the Chanlev Clear system.
;Once you preform the command /clearchanlev do nothing at quakenet, as it may cause you to disconnect.
;
;Use /clearchanlev #channel to remove everyone but yourself
;Use /clearchanlev -r #channel to remove everyone, thus removing Q from the channel.
;Use the d switch (-d or -rd) to show debug messages.
;
;For the command to succeed, you must:
;--Be on the channel.
;--Have Q on the channel
;--Have owner status (+n) on the channel
 
 
alias -l cc.playdelay {
  ;This is the delay (in miliseconds) between each request to remove a user. 2500 will be fine in most cases.
  return 2500
}
alias clearchanlev {
  if ($network !=== QuakeNet) { echo -atgce info * /clearchanlev: Invalid network. | halt }
  if (!$1) || ((-* iswm $1) && (!$2)) { echo -agtce info * /clearchanlev: Insufficient parameters. | halt }
  if (-* !iswm $1) && (#* !iswm $1) { echo -atgce info * /clearchanlev: Invalid parameters. | halt }
  set %cc.chan $iif(-* iswm $1,$2,$1)
  if (Q !ison %cc.chan) { echo -atgce info * /clearchanlev: No Q detected on $v2 $+ . | unset %cc.* | halt }
  if (-* iswm $1) {
    if (- == $1) { echo -atgce info * /clearchanlev: Invalid parameters. | halt }
    if (r isin $1) {
      if ($input(WARNING! This action is about to remove Q from your channel. $crlf $+ This action is irreversible. $crlf $crlf $+ Are you sure you want to continue?,ywd,WARNING - Are You Sure?) == $true) { set %cc.remove 1 }
      else { halt }
    }
    if (d isin $1) {
      set %cc.debug 1
      echo -atgce info * /clearchanlev: Debug mode: ON.
    }
  }
  if ($exist(clearchanlev.txt)) { .remove clearchanlev.txt }
  .disable #clearchanlev*
  echo -atgce info * /clearchanlev: Initiating Clear Chanlev.
  who $me n%na
  if (%cc.debug) { echo -atgce info * /clearchanlev: Recieving own auth... }
  .enable #clearchanlev.who
}
 
#clearchanlev.who off
raw 354:*:set %cc.myqacc $3 | halt
raw 315:*:{
  .timer 1 0 .disable #clearchanlev.who
  if (%cc.debug) { echo -atgce info * /clearchanlev: Own auth recieved. %cc.myqacc }
  .msg Q chanlev %cc.chan
  .enable #clearchanlev
  halt
}
#clearchanlev.who end
 
#clearchanlev off
on ^*:notice:*:?:{
  if ($network == Quakenet) && ($nick == Q) {
    haltdef
    if (Known users on* iswm $1-) { halt }
    if (Username*Flags*Last join*Last changed iswm $1-) {
      set %cc.write 1
      if (%cc.debug) { echo -atgce info * /clearchanlev: Recieving user list into clearchanlev.txt... }
      halt
    }
    if (End of list. == $1-) { halt }
    if (Done. == $1) { halt }
    if (You do not have sufficient access on* iswm $1-) { unset %cc.* | .timer 1 0 .disable #cc.* #clearchanlev | echo -atgce info * /clearchanlev: Action stopped due to insufficient access. }
    if (Total:* iswm $1-) {
      if (%cc.write) {
        if (%cc.debug) { echo -atgce info * /clearchanlev: User list recieved. beginning to remove users. }
        cc.finish
      }
      else { .remove clearchanlev.txt | unset %cc.* | .timer 1 0 .disable #cc.* #clearchanlev | echo -atgce info * /clearchanlev: Action stopped due to insufficient access. }
      halt
    }
    if ($1 == %cc.myqacc) {
      if  (n !isin $2) { unset %cc.write | echo -atgce info * /clearchanlev: You don't have the required access level on %cc.chan $+ . | halt }
      if (%cc.remove) && (%cc.write) {
        if (%cc.debug) { echo -atgce info * /clearchanlev: Writing to file: %cc.myqacc }
        write clearchanlev.txt %cc.myacc
      }
    }
    if (%cc.write) && ($1 != %cc.myqacc) {
      if (%cc.debug) { echo -atgce info * /clearchanlev: Writing to file: $1 }
      write clearchanlev.txt $1
    }
  }
}
#clearchanlev end
alias -l cc.finish {
  play -a cc.removeuser %cc.chan clearchanlev.txt $cc.playdelay
}
alias -l cc.removeuser {
  .msg Q removeuser $1 #$2
  if (%cc.debug) { echo -atgce info * /clearchanlev: Removing user: $2 }
}
on *:playend:{ if ($nopath($filename) == clearchanlev.txt) { echo -atgce info * /clearchanlev: Successfuly removed $lines($v1) users on %cc.chan $+ . | .remove $v1 | unset %cc.* | .disable #clearchanlev* } }
 
Options: New, Download,
, mIRC Parser;
Copyright © 2006 by Zyberdog - Some rights reserved. (Browse/Disclaimer/Stats/About)