mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2014
Posts: 107
M
Majeye Offline OP
Vogon poet
OP Offline
Vogon poet
M
Joined: Jan 2014
Posts: 107
Greetings, everyone.

I really dislike making new threads when I know this exists already, just having a difficult time finding the thread(s) with this scripting already in them.

I am having a hard time trying to find the script that only allows channel-owners only to make use of commands.

Any help appreciated.

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
You must use 'ISOP' if statement on your event.

Help details: /help isop

i will give you some examples:

e.g:

Code:
ON !*:TEXT:!COMMAND:#MY_CHANNEL: {
  if ($nick isop $chan) { echo -a OK $nick is an channel operator }
  elseif ($nick !isop $chan) { echo -a ERROR $nick is NOT an channel operator }
}



Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jan 2014
Posts: 107
M
Majeye Offline OP
Vogon poet
OP Offline
Vogon poet
M
Joined: Jan 2014
Posts: 107
I thought there was a way to make it so that only the channel owner could do it...

I don't remember the actual scripting off hand (which is the purpose of this thread), but isop makes it so all channel operators (moderators) can use the specified command, instead of just the channel owner (or just 1 specified person)

I do remember you had to put the actual persons username in the script somewhere, just don't remember what the script looked like.

all I remember was something like ( username | anotherusername) or something to that effect.

Last edited by Majeye; 13/10/14 11:09 PM.
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Ah ok if you want this there is an other way, you can create a file on your system e.g: owners.txt and add there the nicks that you want and use this code:

This code stop from any command if the user is NOT on the 'owners.txt' file.

Code:
ON *!:TEXT:!*:#: {
  var %rn = $read(owners.txt,ntw,$nick)
  if (%rn) && (%rn !== $nick) { halt }
}


Example of the 'owners.txt'

nick1
nick2
nick3
...


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
An extension to this, owners are always the same $nick as the #channel name on twitch. Example (nillens and #nillens) So for my own script where I use userlevels I have a check for
Code:
$nick == $mid(#,2)
and from an ini file.

But what I believe Majeye was looking for was a simple if statement like:
Code:
if ($nick != username) return
and I suggest you read the help files regarding these matters.
/help if then else
/help $nick
etc


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Do owners have a different mode prefix?

E.g. some networks use either a '.' or a '~' to signify owners.

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Nope, they do not. They're simply labeled and treated as ops as well from the server.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Jan 2014
Posts: 107
M
Majeye Offline OP
Vogon poet
OP Offline
Vogon poet
M
Joined: Jan 2014
Posts: 107
Originally Posted By: Nillen
An extension to this, owners are always the same $nick as the #channel name on twitch. Example (nillens and #nillens) So for my own script where I use userlevels I have a check for
Code:
$nick == $mid(#,2)
and from an ini file.

But what I believe Majeye was looking for was a simple if statement like:
Code:
if ($nick != username) return
and I suggest you read the help files regarding these matters.
/help if then else
/help $nick
etc


That is exactly what I was seeking.

Unfortunately i'm still having difficulty getting it to work properly.. mind looking over the following code and pointing out where I went wrong?

Code:
on $*:text:/!karma (add|remove)/Si:#thebluemuzzy:{
  if ( $nick == thebluemuzzy ) { return } {
    if ($0 < 3) { msg # Insufficient parameters: Use !karma <add|remove> <user> [number] | return }
    writeini -n Karma.ini $+(#,.,$3) Points $calc($readini(Karma.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    { msg $chan $3 now has $readini(Karma.ini,$+(#,.,$3),Points) total karma. }
  }
  else { msg $chan This command is only available to TheBlueMuzzy. }
}


Nevermind.. fixed it myself with:

Code:
on $*:text:/!karma (add|remove)/Si:#thebluemuzzy:{
  if ( $nick == thebluemuzzy ) { 
    if ($0 < 3) { msg # Insufficient parameters: Use !karma <add|remove> <user> [number] | return }
    writeini -n Karma.ini $+(#,.,$3) Points $calc($readini(Karma.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    { msg $chan $3 now has $readini(Karma.ini,$+(#,.,$3),Points) total karma. }
  }
  else { msg $chan This command is only available to TheBlueMuzzy. }
}

Last edited by Majeye; 14/10/14 10:31 PM.
Joined: Jan 2014
Posts: 107
M
Majeye Offline OP
Vogon poet
OP Offline
Vogon poet
M
Joined: Jan 2014
Posts: 107
Now that I have that fixed.. I'm curious as to how a 2nd name can be added to the command?

I thought it was something like this (but doesn't seem to work):

Code:
on $*:text:/!karma (add|remove)/Si:#thebluemuzzy:{
  if ( $nick == thebluemuzzy | $nick == majeye ) { 
    if ($0 < 3) { msg # Insufficient parameters: Use !karma <add|remove> <user> [number] | return }
    writeini -n Karma.ini $+(#,.,$3) Points $calc($readini(Karma.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    { msg $chan $3 now has $readini(Karma.ini,$+(#,.,$3),Points) total karma. }
  }
  else { msg $chan This command is only available to TheBlueMuzzy & Majeye. }
}

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Originally Posted By: Majeye
Now that I have that fixed.. I'm curious as to how a 2nd name can be added to the command?

I thought it was something like this (but doesn't seem to work):

Code:
on $*:text:/!karma (add|remove)/Si:#thebluemuzzy:{
  if ( $nick == thebluemuzzy | $nick == majeye ) { 
    if ($0 < 3) { msg # Insufficient parameters: Use !karma <add|remove> <user> [number] | return }
    writeini -n Karma.ini $+(#,.,$3) Points $calc($readini(Karma.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    { msg $chan $3 now has $readini(Karma.ini,$+(#,.,$3),Points) total karma. }
  }
  else { msg $chan This command is only available to TheBlueMuzzy & Majeye. }
}


Try use this code:

Code:
on $*:text:/!karma (add|remove)/Si:#thebluemuzzy: {
  var %nicks = thebluemuzzy majeye
  if ($istok(%nicks,$nick,32)) { 
    if ($0 < 3) { msg # Insufficient parameters: Use !karma <add|remove> <user> [number] | return }
    writeini -n Karma.ini $+(#,.,$3) Points $calc($readini(Karma.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    { msg $chan $3 now has $readini(Karma.ini,$+(#,.,$3),Points) total karma. }
  }
  else { msg $chan This command is only available to %nicks nickname(s). }
}


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-

Link Copied to Clipboard