mIRC Home    About    Download    Register    News    Help

Print Thread
#256682 09/02/16 08:00 AM
Joined: Dec 2015
Posts: 9
L
lance22 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Dec 2015
Posts: 9
ive been trying to get this code to work last few hrs please help me

on *:text:*:#: {
if ($nick isreg $chan) && ($me isop $chan) {
var %Time = 60
var %Repeats = 3
var %BanTime = 5
if (!%Repeat. [ $+ [ $nick ] ]) {
inc $+(-u,%Time) $+(%,Repeat.,$nick)
set $+(%,Repeat.,$nick,.1) $hash($strip($1-),32)
}
elseif ($($+(%,Repeat.,$nick,.,1),2) = $hash($strip($1-),32)) {
inc $+(-u,%Time) $+(%,Repeat.,$nick)
var %y = $($+(%,Repeat.,$nick),2)
set $+(-u,%Time) $+(%,Repeat.,$nick,.,%y) $hash($strip($1-),32)
if ($($+(%,Repeat.,$nick),2) >= %Repeats) {
ban $+(-ku,$calc(%BanTime * 60)) $chan $nick 2 $+($chr(91),%BanTime,min tempban,$chr(93)) %Repeats repeats in less then %Time seconds
unset $+(%,Repeat.,$nick,*)
elseif (%Repeat. [ $+ [ $nick ] ]) {
inc $+(-u,%Time) $+(%,Repeat.,$nick)
set $+(%,Repeat.,$nick,.1) $hash($strip($1-),32)
unset $+(%,Repeat.,$nick,*)
set -u3600 %rpt. [ $+ [ $address($nick,2) ] ] $calc( %rpt. [ $+ [ $address($nick,2) ] ] + 1)
if (%rpt. [ $+ [ $address($nick,2) ] ] == 1) {
ban -u60 $chan $nick 2 | .notice $nick You have been silenced for 1 minute for repeating, please choose to follow our rules during your stay here.
}
if (%rpt. [ $+ [ $address($nick,2) ] ] == 2) {
ban -u60 $chan $address($nick,2) | kick $chan $nick You were warned. You repeated %count times. This is unacceptable. 1 minute ban
}
if (%rpt. [ $+ [ $address($nick,2) ] ] >= 3) {
ban -u3600 $chan $address($nick,2) | kick $chan $nick You were warned. You repeated %count times. This is unacceptable. 1 hour ban | unset %rpt.*
}
}
}
}
}
}

lance22 #256685 09/02/16 02:01 PM
Joined: Dec 2015
Posts: 148
Vogon poet
Offline
Vogon poet
Joined: Dec 2015
Posts: 148
It would help if you told us what it's supposed to do. Obviously you want it to kick people who repeat lines, but a little bit more specific info would have been useful.

Code:
;Unsets the variables on connect.
on *:connect:unset %repeat.*

;Text event!
on *:text:*:#: {

  ;Checks if you're an operator on the channel and if the user is regular.
  if ($me isop #) && ($nick isreg #) {

    ;Set MD5 hash of the user's nick, channel and text to %h variable.
    var %h = $md5($nick # $strip($1-),0)

    ;Increases the user specific variable by one. (-u60 keeps it for 60 seconds, -e unset when you exit mIRC and -k doesn't reset the unset time when the value is changed.)
    inc -eku60 %repeat. $+ %h

    ;Checks if the user specific variable is 3 or higher.
    if (%repeat. [ $+ [ %h ] ] >= 3) {

      ;Unsets the user specific variable.
      unset %repeat. [ $+ [ %h ] ]

      ;Sets the MD5 hash of the channel and user's address to %h variable.
      var %h = $md5(# $address($nick,2),0)

      ;Increases user specific variable by one. (-u3600 keeps it for 3600 seconds, -e unset when you exit mIRC and -k doesn't reset the unset time when the value is changed.)
      inc -eku3600 %repeat. $+ %h

      ;Tokenizes the user specific variable. ($1 = how many times they've hit the limit.)
      tokenize 32 %repeat. [ $+ [ %h ] ]

      ;If it's the first offence, the script bans the user for 60 seconds and sends a notice to them.
      if ($1 == 1) { ban -u60 # $nick 2 | .notice $nick You have been silenced for 1 minute for repeating, please follow our rules during your stay here. }

      ;If it's the second offence, the script bans the user for 60 seconds and kicks them from the channel
      elseif ($1 == 2) { ban -u60 # $nick 2 | kick # $nick You were warned, you repeated $1 times. This is unacceptable. (1 minute ban) }

      ;If it's none of the above, the script bans the user for 3600 seconds, kicks the user from the channel and unsets the user specific variable.
      else { ban -u3600 # $nick 2 | kick # $nick You were warned, you repeated $1 times. This is unacceptable. (1 hour ban) | unset %repeat. [ $+ [ %h ] ] }
    }
  }
}


Link Copied to Clipboard