egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Warn Action
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Sat Mar 13, 2021 1:43 am    Post subject: Reply with quote

Just thought i'd make the script "fancier"
Code:

###########################################################################
# 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 Razz
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber