Scripting
Bonjour / Bonsoir,

Bienvenue sur ce forum.

Merci, de vous connectez si vous ne l'êtes pas.

Merci, de vous enregistrez si vous ne l'êtes pas. Ceci prend même pas une minute.

Cordialement,

Dylan

Rejoignez le forum, c’est rapide et facile

Scripting
Bonjour / Bonsoir,

Bienvenue sur ce forum.

Merci, de vous connectez si vous ne l'êtes pas.

Merci, de vous enregistrez si vous ne l'êtes pas. Ceci prend même pas une minute.

Cordialement,

Dylan
Scripting
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
-20%
Le deal à ne pas rater :
-200€ Smart TV LG 65″ 4K QNED MiniLED
799 € 999 €
Voir le deal

Paf

Aller en bas

Paf Empty Paf

Message  Dylan Mar 29 Déc - 5:02

Code:
# paf (10/09/2002)                        #
#################################################################################
#    ___          ___          ___          ___          _____          #
#  /  /\        /  /\        /  /\        /  /\        /  /::\        #
#  /  /:/      /  /::\      /  /::\      /  /::\      /  /:/\:\        #
# /__/::\      /  /:/\:\    /  /:/\:\    /  /:/\:\    /  /:/  \:\       #
# \__\/\:\    /  /:/~/::\  /  /:/~/:/    /  /:/  \:\  /__/:/ \__\:|      #
#    \  \:\  /__/:/ /:/\:\ /__/:/ /:/___ /__/:/ \__\:\ \  \:\ /  /:/      #
#    \__\:\ \  \:\/:/__\/ \  \:\/:::::/ \  \:\ /  /:/  \  \:\  /:/       #
#    /  /:/  \  \::/      \  \::/~~~~  \  \:\  /:/    \  \:\/:/        #
#    /__/:/    \  \:\        \  \:\        \  \:\/:/      \  \::/        #
#    \__\/      \  \:\        \  \:\        \  \::/        \__\/          #
#                \__\/        \__\/        \__\/                        #
#                              #
#                              #
#                ___               #
#               ___        /  /\                           #
#               /  /\      /  /:/                           #
#             /  /:/    /  /:/      ___    ___          #
#             /  /:/    /  /:/  ___  /__/\  /  /\         #
#            /  /::\    /__/:/  /  /\ \  \:\ /  /:/         #
#          /__/:/\:\  \  \:\ /  /:/  \  \:\  /:/          #
#          \__\/  \:\  \  \:\  /:/    \  \:\/:/           #
#              \  \:\  \  \:\/:/      \  \::/           #
#                \__\/    \  \::/        \__\/             #
#                          \__\/                           #
#                              #
#                              #
#               web  : http://tcl.lagon-bleu.org   #
#               mail : jarod_angel@yahoo.fr      #
#               IRC  : Jarod_@IRCNet #buffy      #
#                     Asco@UNDERNet #tyranz      #
#                              #
#################################################################################
#                              #
# paf.tcl permet de kicker/bannir quelqu'un rapidement.            #
# Commandes :                           #
# .pif <nick> [raison]      ==>    kick la personne         #
# .paf <nick> [raison]      ==>   kick + ban d'1 minute         #
# .pouf <nick> [raison]      ==>   kick + ban d'1 heure         #
#                              #
# A noter la possibilité de remplacer le <nick> par le caractère *, cela   #
# enclenchera un kick/ban de toutes les   personnes n'étant pas voice ou op !!   #
#                              #
# A noter aussi qu'il faut etre identifier pour utiliser ces commandes.      #
#                              #
# /!\ Ce TCL requiert AUTH.TCL !                  #
#                              #
#################################################################################


##### CONFIGURATION #####

### Les personnes qui auront les flags ci-dessous ne pourront pas etre kické (sauf par un autre master du bot)
set paf_no_kick_flags "nm"

### Indiquer le nom et le repertoire de auth.tcl (par défaut le fichier "auth.tcl" est mis dans le repertoire "scripts")
set loadauth "scripts/auth.tcl"

##### FIN DE LA CONFIGURATION #####




##### DEBUT DU PROGRAMME #####

### Verifie la presence de auth.tcl
if {![file exists $loadauth]} {
   putlog "\002 \037/!\\ ATTENTION VOUS N'AVEZ PAS AUTH.TCL ! CE SCRIPT NE POURRA DONC PAS MARCHER CORRECTEMENT !! /!\\ \002"
}

bind pub o|o .pif pub_pif

### .pif <nick> [raison]

proc pub_pif {nick host hand chan arg} {
   set arg [charfilter $arg]
   global botnick paf_no_kick_flags
   if {![check $hand $nick $host]} {
      puthelp "NOTICE $nick :Tu as besoin d'être identifié pour utiliser cette fonction. Tape .identhelp en partyline pour plus d'infos...: \002/msg $botnick auth <password>\002"
      return 0
   }
   if {$arg == ""} {
      puthelp "NOTICE $nick :\002Usage:\002 .pif <nick> \[reason\]"
      return 0
   }
   set who [lindex $arg 0]
   set reason [lrange $arg 1 end]
   if {$reason == ""} {
   set reason "\002 RAGHHHHHHHHHHH !!! \002"
   set raison 1 }
   if {![botisop $chan]} {
      puthelp "NOTICE $nick :Désolé, je ne suis pas opérateur sur $chan."
      return 0
   }
   if {[string first "*" $who] != -1} {
      if {$raison == 1} {set reason "MassPif: PIF PAF POUF "}
      if {![matchattr $hand o|o $chan]} {
         puthelp "NOTICE $nick :Tu as besoin d'être +o pour utiliser le mass kick."
         return 0
      }
      set who [strlwr $who]
      set kickcount 0
      set flags "-$paf_no_kick_flags&-$paf_no_kick_flags"
      if {$paf_no_kick_flags == ""} {
         set list [strlwr [chanlist $chan]]
      } {
         set list [strlwr [chanlist $chan $flags]]
      }
      foreach chanuser $list {
         if {[string match $who $chanuser] && $chanuser != [strlwr $botnick] && $chanuser != [strlwr $nick] && ![isop $chanuser $chan] && ![isvoice $chanuser $chan]} {
            putserv "KICK $chan $chanuser : $reason"
         }
      }
      } {
      if {![onchan $who $chan]} {
         puthelp "NOTICE $nick :Désolé, mais je ne trouve pas $who sur $chan."
         return 0
      }
      if {[strlwr $who] == [strlwr $botnick]} {
         puthelp "NOTICE $nick : arf c moi ke tu veux piffer ???!!! "
         return 0
      }
      if {[nick2hand $who $chan] != "*"} {
         if {$hand != [nick2hand $who $chan]} {
            if {([matchattr [nick2hand $who $chan] o|o $chan] && ![matchattr $hand o|o $chan])} {
               puthelp "NOTICE $nick :désolé mais tu dois etre +o pour kicker un op."
               return 0
            }
            if {(([matchattr [nick2hand $who $chan] m|m $chan] || [matchattr [nick2hand $who $chan] b]) && ![matchattr $hand m|m $chan])} {
               puthelp "NOTICE $nick :Désolé mais tu dois etre un master pour kicker un master ou un bot ! "
               return 0
            }
         }
      }
      putserv "KICK $chan $who : $reason"
      putlog "#PAF# (PIF $hand) $chan -> $who (raison : $reason)"
      return 0
   }
}

bind pub o|o .paf pub_paf

### .paf <nick> [raison]

proc pub_paf {nick host hand chan arg} {
   set arg [charfilter $arg]
   global botnick paf_no_kick_flags
   if {![check $hand $nick $host]} {
      puthelp "NOTICE $nick :Tu as besoin d'être identifié pour utiliser cette fonction. Tape .identhelp en partyline pour plus d'infos...: \002/msg $botnick auth <password>\002"
      return 0
   }
   if {$arg == ""} {
      puthelp "NOTICE $nick :\002Usage:\002 .paf <nick> \[reason\]"
      return 0
   }
   set who [lindex $arg 0]
   set reason [lrange $arg 1 end]
   if {$reason == ""} {
   set reason "\002 PAAAAAAAAAAFFFFFFFFFFFFFFF !!! \002"
   set raison 1 }
   if {![botisop $chan]} {
      puthelp "NOTICE $nick :Désolé, je ne suis pas opérateur sur $chan."
      return 0
   }
   if {[string first "*" $who] != -1} {
      if {$raison == 1} {set reason "MassPaf: PIF PAF POUF "}
      if {![matchattr $hand o|o $chan]} {
         puthelp "NOTICE $nick :Tu as besoin d'être +o pour utiliser le mass kick."
         return 0
      }
      set who [strlwr $who]
      set kickcount 0
      set flags "-$paf_no_kick_flags&-$paf_no_kick_flags"
      if {$paf_no_kick_flags == ""} {
         set list [strlwr [chanlist $chan]]
      } {
         set list [strlwr [chanlist $chan $flags]]
      }
      foreach chanuser $list {
         if {[string match $who $chanuser] && $chanuser != [strlwr $botnick] && $chanuser != [strlwr $nick] && ![isop $chanuser $chan] && ![isvoice $chanuser $chan]} {
            set ipmask [lindex [split [maskhost $who![getchanhost $who $chan]] "@"] 1]
            set userm [lindex [split [getchanhost $who $chan] "@"] 0]
            set userm [string trimleft $userm ~]
            if {[string length $userm] > 9} {
               set userm [string range $userm 1 9]
            }
            set banmask *!*$userm@$ipmask
            putserv "KICK $chan $who : \002 $reason \002"
            newchanban $chan $banmask $nick $reason 1
            putserv "KICK $chan $who : \002 $reason \002"
         }
      }
      } {
      if {![onchan $who $chan]} {
         puthelp "NOTICE $nick :Désolé, mais je ne trouve pas $who sur $chan."
         return 0
      }
      if {[strlwr $who] == [strlwr $botnick]} {
         puthelp "NOTICE $nick : arf c moi ke tu veux paffer ???!!! "
         return 0
      }
      if {[nick2hand $who $chan] != "*"} {
         if {$hand != [nick2hand $who $chan]} {
            if {([matchattr [nick2hand $who $chan] o|o $chan] && ![matchattr $hand o|o $chan])} {
               puthelp "NOTICE $nick :désolé mais tu dois etre +o pour kicker un op."
               return 0
            }
            if {(([matchattr [nick2hand $who $chan] m|m $chan] || [matchattr [nick2hand $who $chan] b]) && ![matchattr $hand m|m $chan])} {
               puthelp "NOTICE $nick :Désolé mais tu dois etre un master pour kicker un master ou un bot ! "
               return 0
            }
         }
      }
      set ipmask [lindex [split [maskhost $who![getchanhost $who $chan]] "@"] 1]
      set userm [lindex [split [getchanhost $who $chan] "@"] 0]
      set userm [string trimleft $userm ~]
      if {[string length $userm] > 9} {
         set userm [string range $userm 1 9]
      }
      set banmask *!*$userm@$ipmask
      newchanban $chan $banmask $nick $reason 1
      putserv "KICK $chan $who : \002 $reason \002"
      putlog "#PAF# (PAF $hand) $chan -> $who (raison : $reason)"
      return 0
   }
}

bind pub - .pouf pub_pouf

### .pouf <nick> [raison]

proc pub_pouf {nick host hand chan arg} {
   set arg [charfilter $arg]
   global botnick paf_no_kick_flags
   if {![check $hand $nick $host]} {
      puthelp "NOTICE $nick :Tu as besoin d'être identifié pour utiliser cette fonction. Tape .identhelp en partyline pour plus d'infos...: \002/msg $botnick auth <password>\002"
      return 0
   }
   if {$arg == ""} {
      puthelp "NOTICE $nick :\002Usage:\002 .pouf <nick> \[reason\]"
      return 0
   }
   set who [lindex $arg 0]
   set reason [lrange $arg 1 end]
   if {$reason == ""} {
   set reason "\002 POUF !!! \002"
   set raison 1 }
   if {![botisop $chan]} {
      puthelp "NOTICE $nick :Désolé, je ne suis pas opérateur sur $chan."
      return 0
   }
   if {[string first "*" $who] != -1} {
      if {$raison == 1} {set reason "MassPouf: PIF PAF POUF "}
      if {![matchattr $hand o|o $chan]} {
         puthelp "NOTICE $nick :Tu as besoin d'être +o pour utiliser le mass kick."
         return 0
      }
      set who [strlwr $who]
      set kickcount 0
      set flags "-$paf_no_kick_flags&-$paf_no_kick_flags"
      if {$paf_no_kick_flags == ""} {
         set list [strlwr [chanlist $chan]]
      } {
         set list [strlwr [chanlist $chan $flags]]
      }
      foreach chanuser $list {
         if {[string match $who $chanuser] && $chanuser != [strlwr $botnick] && $chanuser != [strlwr $nick] && ![isop $chanuser $chan] && ![isvoice $chanuser $chan]} {
            set ipmask [lindex [split [maskhost $who![getchanhost $who $chan]] "@"] 1]
            set userm [lindex [split [getchanhost $who $chan] "@"] 0]
            set userm [string trimleft $userm ~]
            if {[string length $userm] > 9} {
               set userm [string range $userm 1 9]
            }            
            set banmask *!*$userm@$ipmask
            putserv "KICK $chan $who : \002 $reason \002"
            newchanban $chan $banmask $nick $reason 60
            putserv "KICK $chan $who : \002 $reason \002"
         }
      }
      } {
      if {![onchan $who $chan]} {
         puthelp "NOTICE $nick :Désolé, mais je ne trouve pas $who sur $chan."
         return 0
      }
      if {[strlwr $who] == [strlwr $botnick]} {
         puthelp "NOTICE $nick : arf c moi ke tu veux pouffer ???!!! "
         return 0
      }
      if {[nick2hand $who $chan] != "*"} {
         if {$hand != [nick2hand $who $chan]} {
            if {([matchattr [nick2hand $who $chan] o|o $chan] && ![matchattr $hand o|o $chan])} {
               puthelp "NOTICE $nick :désolé mais tu dois etre +o pour kicker un op."
               return 0
            }
            if {(([matchattr [nick2hand $who $chan] m|m $chan] || [matchattr [nick2hand $who $chan] b]) && ![matchattr $hand m|m $chan])} {
               puthelp "NOTICE $nick :Désolé mais tu dois etre un master pour kicker un master ou un bot ! "
               return 0
            }
         }
      }
      set ipmask [lindex [split [maskhost $who![getchanhost $who $chan]] "@"] 1]
      set userm [lindex [split [getchanhost $who $chan] "@"] 0]
      set userm [string trimleft $userm ~]
      if {[string length $userm] > 9} {
         set userm [string range $userm 1 9]
      }
      set banmask *!*$userm@$ipmask
      newchanban $chan $banmask $nick $reason 60
      putserv "KICK $chan $who : \002 $reason \002"
      putlog "#PAF# (POUF $hand) $chan -> $who (raison : $reason)"
      return 0
   }
}

###OUTILS :
proc charfilter {x {y ""} } {
   for {set i 0} {$i < [string length $x]} {incr i} {
      switch -- [string index $x $i] {
         "\"" {append y "\\\""}
         "\\" {append y "\\\\"}
         "\[" {append y "\\\["}
         "\]" {append y "\\\]"}
         "\} " {append y "\\\} "}
         "\{" {append y "\\\{"}
         default {append y [string index $x $i]}
      }
   }
   return $y
}

proc strlwr {string} {
   return [string tolower $string]
}

proc check {hand nick host} {
   if {[getuser $hand xtra auth] != "DEAD"} {
      set perm_host [getuser $hand xtra permident]
      if {[string match [strlwr $perm_host] [strlwr $nick!$host]]} {
         return 1
      }
   }
   set host [lindex [split $host "@"] 1]
   if {[getuser $hand xtra auth] == 1} {
      if {[getuser $hand xtra authnick] == $nick} {
         return 1
      }
   }
   return 0
}

putlog "\0032PAF.TCL\003 (\0031310/09/2002\003) par Jarod_"
Dylan
Dylan
Administrateur

Messages : 221
Date d'inscription : 23/11/2009
Age : 29
Localisation : Chez moi ...

https://scripting.forumactif.com

Revenir en haut Aller en bas

Revenir en haut


 
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum