This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Warn Action

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

Just thought i'd make the script "fancier"

Code: Select all

###########################################################################
# xAction.tcl 
###############################################
# Author    ComputerTech, caesar, Spike^^
# Version   0.1 (BETA)
# Released  12/03/2021
# GitHub    https://github.com/computertech312
###############################################
# Description:
#
#               Action punishment script.
#
#               Use .chanset #channel +xaction   to enable per channel
#
# History:
#
#               - 0.1: First release. 
#
###########################################################################
# Start of configuration #
##########################
################
# Flags for usage and protection.
####
set warn(flag) "ofmn"

################
# Punishment's
####
# w  = warning
# k  = kick
# b  = ban
# kb = kickban
####
set warn(max) "w:w:k:kb"

################
# X time before timer warning total is reduced by one (in seconds).
####
set warn(time) "120"

################
# Warning Message.
####
set warn(wreason) "Warning! Avoid using /me please"

################
# Kick Reason.
####
set warn(kreason) "Usage of /me"

################
# Ban Time.
####
# m  = minutes
# h  = hours
# d  = days
####
set warn(btime) "60m"

################
# Ban hostmask Type.
####
# 0 *!user@host
# 1 *!*user@host
# 2 *!*@host
# 3 *!*user@*.host
# 4 *!*@*.host
# 5 nick!user@host
# 6 nick!*user@host
# 7 nick!*@host
# 8 nick!*user@*.host
# 9 nick!*@*.host
####
set warn(btype) "2"

##########################
#  End of configuration  #
###########################################################################

bind CTCP - ACTION action:avoid

setudef flag xaction

proc action:avoid {nick host hand chan key text} {
   global warn
if {![channel get $chan xaction]} {return 0}
  if {[isbotnick $nick] || ![botisop $chan]} {return 0}
    if {[matchattr $hand $warn(flag) $chan]} {return 0}
       if {[isop $nick $chan]} {return 0}
     incr warn($host) +1
     set warn(host) [maskhost $nick![getchanhost $nick $chan] $warn(btype)]
            if {![info exists output1]} {
        switch -- [string tolower $warn(btime)] {
            d {set output1 [expr {$warn(btime) * 1440}]}
            h {set output1 [expr {$warn(btime) * 60}]}
            m {set output1 $warn(btime)}
         }
      }
      if {![info exists end5]} {
      set end5 [lindex [split $warn(max) :] end]
      }
   switch -- [lindex $warn(max) [incr warn($host) 1]] {
    "w" {putkick $chan $nick $warn(wreason)
             set blah($host) "w"}
    "k" {putkick $chan $nick $warn(kreason)
             set blah($host) "k"}
    "b" {newchanban "$chan" "$warn(host)" "$::botnick" "$warn(kreason)" $output1 
             set blah($host) "b"}
    "kb" {newchanban "$chan" "$warn(host)" "$::botnick" "$warn(kreason)" $output1
           putkick $chan $nick $warn(kreason) 
             set blah($host) "kb"}
   }
    if {[string match $blah($host) $end5]} {
    unset warn($host) ; unset blah($host)
    }
      utimer $warn(time) [list action:reset $host]
}
proc action:reset {host} {
   global warn 
   if {[array names warn] != {}} {
      if {[lsearch -nocase [array names warn] $host] > -1} {
         if {$warn($host) > 1} {
            incr warn($host) -1
         } else {
            unset warn($host)
         }
      }
   }
}
###########################################################################
As version suggests, its in (BETA) and i haven't had time yet to test it personally :wink:

Anyway, any tests is appreciated or even suggestions gor that matter, although my above post's code also works, but this will hopefully be more easier to set punishments :P
ComputerTech
Post Reply