mIRC Home    About    Download    Register    News    Help

Print Thread
op immune to script? #222517
21/06/10 02:36 PM
21/06/10 02:36 PM
Joined: Jun 2004
Posts: 124
S
sigbin Offline OP
Vogon poet
sigbin  Offline OP
Vogon poet
S

Joined: Jun 2004
Posts: 124
how can i make OP immune to this scripts its a anti-swear script? anyone?
Code:
alias swear {
  return swear1 swear2 swear3
}

On *:Text:*:#channel: {
  if (!$hget(swear)) hmake swear 10
  var %swr = 1
  while ($gettok($swear,%swr,32)) {
    if ($+(*,$gettok($swear,%swr,32),*) iswm $1-) {
      hinc swear $nick
      var %swear = $gettok($swear,%swr,32)
      if ($hget(swear,$nick) == 1) do something here
      if ($hget(swear,$nick) == 3) .do something here
    }
    inc %swr
  }
}


On *:Action:*:#channel: {
  if (!$hget(swear)) hmake swear 10
  var %swr = 1
  while ($gettok($swear,%swr,32)) {
    if ($+(*,$gettok($swear,%swr,32),*) iswm $1-) {
      hinc swear $nick
      var %swear = $gettok($swear,%swr,32)
      if ($hget(swear,$nick) == 1) do something here
      if ($hget(swear,$nick) == 3) do something here
    }
    inc %swr
  }
}

Re: op immune to script? [Re: sigbin] #222519
21/06/10 02:50 PM
21/06/10 02:50 PM
Joined: Jan 2010
Posts: 6
Australia, Victoria
Dan01 Offline
Nutrimatic drinks dispenser
Dan01  Offline
Nutrimatic drinks dispenser

Joined: Jan 2010
Posts: 6
Australia, Victoria
Hey there,

To make your code immune to OPs and yourself... Here is one way you can do it smile

Code:
alias swear {
  return swear1 swear2 swear3
}

On !*:Text:*:#channel: {
if ($nick !isop #) {
  if (!$hget(swear)) hmake swear 10
  var %swr = 1
  while ($gettok($swear,%swr,32)) {
    if ($+(*,$gettok($swear,%swr,32),*) iswm $1-) {
      hinc swear $nick
      var %swear = $gettok($swear,%swr,32)
      if ($hget(swear,$nick) == 1) do something here
      if ($hget(swear,$nick) == 3) .do something here
    }
    inc %swr
  }
}
}

On !*:Action:*:#channel: {
if ($nick !isop #) {
  if (!$hget(swear)) hmake swear 10
  var %swr = 1
  while ($gettok($swear,%swr,32)) {
    if ($+(*,$gettok($swear,%swr,32),*) iswm $1-) {
      hinc swear $nick
      var %swear = $gettok($swear,%swr,32)
      if ($hget(swear,$nick) == 1) do something here
      if ($hget(swear,$nick) == 3) do something here
    }
    inc %swr
  }
}
}


By adding a ! prefix to your on EVENTs, this halts proceeding with the event if you have triggered it yourself.. So in this case if you have typed a swear word you will be ignored smile

By adding if ($nick !isop #) { }
This says if a $nick is not an op, then proceed with the command... If you remove the ! character from this, it would say if $nick is an op proceed.. Which is not what you want to do in this case..

Hope this helps smile

Kind Regards,
Daniel

Re: op immune to script? [Re: Dan01] #222524
21/06/10 08:04 PM
21/06/10 08:04 PM
Joined: Jul 2007
Posts: 1,129
United States
T
Tomao Offline
Hoopy frood
Tomao  Offline
Hoopy frood
T

Joined: Jul 2007
Posts: 1,129
United States
You can also do
Code:
if ($nick(#,$nick,rv)) {
so that this script only gets triggered for voiced and regular users. If you want to exclude the voiced, just remove the letter v. Then if that's to mainly address the regular user, a positive approach would become: $nick isreg $chan

Anyway, this
Quote:
if ($nick !isop #) {
if (!$hget(swear)) hmake swear 10
Can just be:
Code:
if ($nick !isop #) && (!$hget(swear)) {
 hmake swear 10
saves yourself a if and a bracket.

The whole script, as a matter of fact, can just be:
Code:
On *:Text:*:#channel: { swear $1- }
On *:Action:*:#channel: { swear $1- }
alias -l swear {
  if ($nick !isop #) && (!$hget(swear)) hmake swear 10
  var %swr = 1
  while ($gettok($swear,%swr,32)) {
    if ($+(*,$gettok($swear,%swr,32),*) iswm $strip($1-)) {
      hinc swear $nick
      var %swear = $gettok($swear,%swr,32)
      if ($hget(swear,$nick) == 1) do something here
      if ($hget(swear,$nick) == 3) .do something here
    }
    inc %swr
  }
}

Re: op immune to script? [Re: Tomao] #222526
21/06/10 09:41 PM
21/06/10 09:41 PM
Joined: Sep 2009
Posts: 52
Z
ziv Offline
Babel fish
ziv  Offline
Babel fish
Z

Joined: Sep 2009
Posts: 52
The channel has to be passed to the alias though.
Also, I don't think the table creation has anything to do with the rest of the code, which should execute if it's not an op.

Code:
On *:Text:*:#channel: { swear $chan $1- }
On *:Action:*:#channel: { swear $chan $1- }
alias -l swear {
  if ($nick !isop $1) {
  if (!$hget(swear)) hmake swear 10
  var %swr = 1
  while %swr <= $lines($mircdirswear.txt) {
    if ($+(*,$read($mircdirswear.txt,%swr),*) iswm $strip($2-)) {
      hinc swear $nick
      if ($hget(swear,$nick) == 1) .do something here
      if ($hget(swear,$nick) == 3) .do something here
    }
    inc %swr
  }
}


This should work perfectly fine, you can place cos words in a text file called swear.txt, one on every line.
The file should be placed in your mIRC directory, in Win7 this is C:\Users\YOUR-USER-NAME\App-Data\Roaming\mIRC\

Enjoy,
ziv.

Re: op immune to script? [Re: ziv] #222527
21/06/10 11:09 PM
21/06/10 11:09 PM
Joined: Feb 2009
Posts: 133
Belgique
C
chacha Offline
Vogon poet
chacha  Offline
Vogon poet
C

Joined: Feb 2009
Posts: 133
Belgique
"iswm" isnt a good idea bcz if u say hotel, campus or other thing this will be taken as a swear!!


WorldDMT
Re: op immune to script? [Re: ziv] #222528
22/06/10 01:27 AM
22/06/10 01:27 AM
Joined: Jul 2007
Posts: 1,129
United States
T
Tomao Offline
Hoopy frood
Tomao  Offline
Hoopy frood
T

Joined: Jul 2007
Posts: 1,129
United States
ziv, you don't need to pass it. The $chan or # will work. Why go the extra mile for when you can just do swear $1- ? Try it for yourself. Yes, I agree with chacha. It'd be better to use $istok then:
Code:
On *:Text:*:#: { swear $1- }
On *:Action:*:#: { swear $1- }
alias -l swear {
  if ($nick !isop #) {
    if (!$hget(swear)) hmake swear 10
    var %swr = 1
    while %swr <= $lines($mircdirswear.txt) {
      if ($istok($strip($1-),$read($mircdirswear.txt,%swr),32)) {
        hinc swear $nick
        if ($hget(swear,$nick) == 1) .do something here
        if ($hget(swear,$nick) == 3) .do something here
      }
      inc %swr
    }
  }
}

Re: op immune to script? [Re: Tomao] #222538
22/06/10 02:56 PM
22/06/10 02:56 PM
Joined: Sep 2009
Posts: 52
Z
ziv Offline
Babel fish
ziv  Offline
Babel fish
Z

Joined: Sep 2009
Posts: 52
I stand corrected!...well...seat corrected...
Anyways, thank you.

ziv.