mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2008
Posts: 167
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
Sorry, I don't know what I am doing wrong...
Code:
on *:TEXT:*:#: {
  if ($me == no-nick) && ($me isop $chan) {
    if ($1 == +v) && ( $nick isop $chan || $nick ishop $chan ) && ($2 ison $chan) { /set %com +v $2 | /set %mes $2 should now be voiced. }
    elseif ($1 == -v) && ( $nick isop $chan || $nick ishop $chan ) && ($2 ison $chan) { /set %com -v $2 | /set %mes $2 should now have no voice. }
    elseif ($1 == +h) && ( $nick isop $chan ) && ($2 ison $chan) { /set %com +h $2 | /set %mes $2 should now have halfop status. }
    elseif ($1 == -h) && ( $nick isop $chan ) && ($2 ison $chan) { /set %com -h $2 | /set %mes $2 should now not have halfop status. }
    elseif ($1 == +o) && ( $nick isop $chan ) && ($2 ison $chan) { /set %com +o $2 | /set %mes $2 should now have operator status. }
    elseif ($1 == -o) && ( $nick isop $chan ) && ($2 ison $chan) { /set %com -o $2 | /set %mes $2 should now not have operator status. }
    elseif ($1 == +m) && ( $nick isop $chan || $nick ishop $chan ) { /set %com +m | /set %mes $nick set "moderation" on $chan }
    elseif ($1 == -m) && ( $nick isop $chan || $nick ishop $chan ) { /set %com -m | /set %mes $nick unset "moderation" on $chan }
    elseif ($1 == +i) && ( $nick isop $chan || $nick ishop $chan ) { /set %com +i | /set %mes $nick made the channel "invite only"... Type "!inv <nick>" to invite someone to the channel. }
    elseif ($1 == -i) && ( $nick isop $chan || $nick ishop $chan ) { /set %com -i | /set %mes $nick made the channel open to everyone. }
    if ($1 == +v || -v || +h || -h || +o || -o || +m || -m || +i || -i) { /mode $chan %com | /msg $chan %mes
    }
  }
}


When anyone says anything when no-nick (the bot) is +o this happens:
Quote:
[17:31] <~seanturner70> test
[17:31] <&no-nick> seanturner70 made the channel open to everyone.
[17:31] <~seanturner70> smirk
[17:31] <&no-nick> seanturner70 made the channel open to everyone.


Last edited by seanturner70; 09/12/08 05:45 PM.
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Code:
if ($1 == +v || -v || +h || -h || +o || -o || +m || -m || +i || -i)
This line is wrong, if you want to compare $1 with all of this, use either:
Quote:
if ($1 == +v) || ($1 == -v) || (...) { }
or $istok :
Code:
if ($istok(+v -v +h -h ...,$1,32)) { }


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2008
Posts: 167
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
ok, thanks smile

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
I'd consider using a goto for this.

Code:
{
elseif ($1 == +h) && ( $nick isop $chan ) && ($2 ison $chan) { /set %com +h $2 | /set %mes $2 should now have halfop status. | goto end }

:end { mode $chan %com | msg $chan %mes }

}


Also, every line of this script checks if $nick isop $chan. What you should do is only check this once at the beginning. Or use $istok to consolidate the desired modes into one comparison, then halt if $nick !isop $chan. Also, if ($1 == +h), then you can /set %com $1.

This logic allows you to write one line to handle most events.

if ($istok($1,+q.-q.+o.-o.+h.-h,46)) { mode $chan $1 $nick }

This is just an example of what I'm talking about.

Good luck!


Link Copied to Clipboard