mIRC Home    About    Download    Register    News    Help

Print Thread
#255496 29/10/15 06:07 PM
Joined: Oct 2015
Posts: 3
M
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Oct 2015
Posts: 3
Hi guys,

Been playing around with IRC Scripting for the first time really and getting stuck into it. What I'd like to do is a command that will only be run by OPS or a specific user.

I've got the if ($nick !isop #) bit, but I'm not sure how I can do an "or" statement so it would be like

if ($nick !isop #) OR if ($nick == UserHere)

Any ideas?

Thanks!

Joined: Oct 2014
Posts: 35
M
Ameglian cow
Offline
Ameglian cow
M
Joined: Oct 2014
Posts: 35
if ($nick !isop #) || if ($nick == UserHere)


Matti
Joined: Oct 2015
Posts: 3
M
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Oct 2015
Posts: 3
Originally Posted By: MattiSony
if ($nick !isop #) || if ($nick == UserHere)


Hmm, I did try this earlier but for some strange reason it just stopped working all together, non-ops could run the command without any issue.


The code I'm trying is:

Code:
on *:text:!setnumber *:#: {
  if ($nick !isop #) return {
    set %setnumbernum $2
    msg $chan %setnumbernum set
  }
}


When I try

Code:
on *:text:!setnumber *:#: {
  if ($nick !isop #) || if ($nick == numsetter) {
    set %setnumbernum $2
    msg $chan %setnumbernum set
  }
}


It just doesn't seem to like it, maybe I'm putting it in wrong?

I also get an error "Invalid Closing brave, no opening brace found" in mSLDev

Last edited by Mattch23; 29/10/15 08:10 PM.
Joined: Oct 2014
Posts: 35
M
Ameglian cow
Offline
Ameglian cow
M
Joined: Oct 2014
Posts: 35
I just copied what you typed and replaced OR with || :P you're not supposed to have the ! in
Code:
if ($nick !isop #)


! makes it check if the nick is not OPed.


Matti
Joined: Oct 2014
Posts: 35
M
Ameglian cow
Offline
Ameglian cow
M
Joined: Oct 2014
Posts: 35
My bad, we don't need the second IF. This should work:

Code:
on *:text:!setnumber *:#: {
  if ($nick isop #) || ($nick == numsetter) {
    set %setnumbernum $2
    msg $chan %setnumbernum set
  }
}


Matti
Joined: Oct 2015
Posts: 3
M
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Oct 2015
Posts: 3
Originally Posted By: MattiSony
My bad, we don't need the second IF. This should work:

Code:
on *:text:!setnumber *:#: {
  if ($nick isop #) || ($nick == numsetter) {
    set %setnumbernum $2
    msg $chan %setnumbernum set
  }
}


Ahhh okay, I'll give it a try now smile

Edit: It works fine laugh thanks!!!!

Last edited by Mattch23; 30/10/15 12:22 PM.
Joined: May 2015
Posts: 133
K
Vogon poet
Offline
Vogon poet
K
Joined: May 2015
Posts: 133
Keep in mind "!" means not, so to make your original code work it would look like this:

Code:
on *:text:!setnumber *:#: {
if (($nick !isop #) || ($nick != UserHere)) {return}
  set %setnumbernum $2
  msg $chan %setnumbernum set
}

Last edited by keyeslol; 02/11/15 08:02 PM.

twitter @keyeslol

Link Copied to Clipboard