mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2005
Posts: 75
C
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
hello again,

i was trying to make a personal bot of my own and i got a little lost.

Code:
on 187:TEXT:$($me $+ *):*: {
  if ($2 == opme) { mode # +o $nick | halt }
  if ($2 == deopme) { mode # -o $nick | halt }
  if ($2 == +o) { mode # +o $3 | halt }
  if ($2 == -o) { mode # -o $3 | halt }
  if ($2 == voiceme) { mode # +v $nick | halt }
  if ($2 == devoiceme) { mode # -v $nick | halt }
  if ($2 == +v) { mode # +v $3 | halt }
  if ($2 == -v) { mode # -v $3 | halt }
  if ($2 == hopme) { mode # +h $nick | halt }
  if ($2 == dehopme) { mode # -h $nick | halt }
  if ($2 == +h) { mode # +h $3 | halt }
  if ($2 == -h) { mode # -h $3 | halt }
  [color:blue]if ($2 == kick) || ($level($3) == 187) { msg # $3 is a Protected User and i will not kick $3 
  kick # $3- | halt }[/color]
  if ($2 == ban) { ban -k # $3- | halt }
  if ($2 == unban) { ban -r # $3 | halt }
}


part highlighted is where i'm having trouble at, what i wanted to do is it to check if nick specified is in level 187 it won't kick the nick and do the msg # if not it'll kick nick specified anyway. can anyone help?

Joined: Jul 2004
Posts: 59
S
Babel fish
Offline
Babel fish
S
Joined: Jul 2004
Posts: 59
What i understood was, you wanted to say the message if the person they request to be kicked is level 187, and kick the person if they aren't level 187....I hope this is correct. I've never used $level before so I don't know much about how it works, but hopefully the code does.

Code:
if ($2 == kick) {
  if ($level($3) == 187) { msg # $3 is a Protected User and i will not kick $3 | halt }
  else { kick # $3- | halt }
}

Last edited by synth7; 31/12/05 03:45 PM.


Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Code:
on 187:TEXT:$($me $+ *):*: {
  if ($2 == opme) { mode # +o $nick }
  else if ($2 == deopme) { mode # -o $nick }
  else if ($2 == +o) { mode # +o $3 }
  else if ($2 == -o) { mode # -o $3 }
  else if ($2 == voiceme) { mode # +v $nick }
  else if ($2 == devoiceme) { mode # -v $nick }
  else if ($2 == +v) { mode # +v $3 }
  else if ($2 == -v) { mode # -v $3 }
  else if ($2 == hopme) { mode # +h $nick }
  else if ($2 == dehopme) { mode # -h $nick }
  else if ($2 == +h) { mode # +h $3 }
  else if ($2 == -h) { mode # -h $3 }
  else if ($2 == kick) {
    if ($level($3) == 187) { msg # $3 is a Protected User and i will not kick $3 }
    else { kick # $3- }
  }
  else if ($2 == ban) { ban -k # $3- }
  else if ($2 == unban) { ban -r # $3 }
}


Adding userlevels according to the nick only isn't very safe as anyone could switch to that nick and be exempt. It's also not going to work for users with certain characters in their nick ( The | for example).

Joined: Oct 2005
Posts: 75
C
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
yours worked thanks much else if don't seem to work for me but yours does i changed ($level($3) to $level($address($3,5)) then it works

Last edited by Confuzzled; 31/12/05 11:21 PM.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
those else if statements should be elseif

Note the lack of space between the 'else' & the 'if'

Joined: Nov 2003
Posts: 227
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Nov 2003
Posts: 227
Both work just fine

else if is more C like

where elseif is more VB like

So I guess what you use is down to taste.


Link Copied to Clipboard