Jump to content

BlackTools 2.5.3 - One TCL, One Smart EggDrop

BlackTools is the most complete channel management tcl script for eggdrop/windrop who can manage channels from all the IRC networks, although some modules are specifically designed only for Undernet network. Offers everything you need for you to start using your eggdrop by having a lots of commands, protections, modules that make your channel more safe and your life easier.
Download Now

Eggdrop 1.8.4 - Stable Release

Eggdrop is the most advanced, most popular, and best supported IRC bot. If you've never used a bot before, you'll find Eggdrop provides a staggering array of options for channel management, and can easily be expanded further to provide even more functions. It is a feature rich program designed to be easily used and expanded upon (using Tcl scripting) by both novice and advanced IRC users on a variety of hardware and software platforms.
The Eggdrop code is free for anyone to download and use.
Download Now

BlackMeteo 1.2 - Rebuilt in a New Style

Displays real-time weather conditions, days forecast and local time from any city in the world.
Supports US Zipcode, UK Postcode, Canada Postalcode or worldwide city name.
Download Now

BlackIP 1.8 - New System Style.

Returns IP address dns, location and organization informations for a nick/IP/hostname.
Both IPv4 & IPv6 supported.
Download Now

YouTubeTitle 1.7 - Added Lenght Time.

Fetches and displays video information when a YouTube link is posted in channel.
Displays title, date and rating of posted video links.
Supports also HTTPS links.
Download Now
Sign in to follow this  
xpl0ziv

Play with Friends TCL

Rate this topic

Recommended Posts

Hello guys,

Its been a long time since gather-network closed doors but there are a couple of guys out there that are looking for the tcl that they were using on the IRC servers.
I have it and i'll paste it below , maybe some of you will find time to improve it , make it work with blacktools tcl ( when it comes to permisions ) or maybe make a better version of it.
Its wanted i can tell you that much:

bind pub - [string trim $pwf_trigger]addme pwf_addme
bind pub - [string trim $pwf_trigger]add pwf_addme
bind pub - [string trim $pwf_trigger]remove pwf_remove
bind pub - [string trim $pwf_trigger]removeme pwf_remove
bind pub - [string trim $pwf_trigger]addmap pwf_addmap
bind pub - [string trim $pwf_trigger]addtype pwf_addtype
bind pub - [string trim $pwf_trigger]playernumber pwf_playernumber
bind pub - [string trim $pwf_trigger]move pwf_moveplayer
bind pub - [string trim $pwf_trigger]moveplayer pwf_moveplayer
bind pub - [string trim $pwf_trigger]votemap pwf_votemap
bind pub - [string trim $pwf_trigger]topmap pwf_topmaps
bind pub - [string trim $pwf_trigger]topmaps pwf_topmaps
bind pub - [string trim $pwf_trigger]ip pwf_ip
bind pub - [string trim $pwf_trigger]teams pwf_teams
bind pub - [string trim $pwf_trigger]team pwf_teams
bind pub - [string trim $pwf_trigger]help pwf_help
bind pub - [string trim $pwf_trigger]lastgame pwf_lastgame
bind pub - [string trim $pwf_trigger]last pwf_lastgame
bind pub - [string trim $pwf_trigger]addadmin pwf_addadmin
bind pub - [string trim $pwf_trigger]remadmin pwf_removeadmin
bind pub G|G [string trim $pwf_trigger]enable pwf_enable
bind pub G|G [string trim $pwf_trigger]disable pwf_disable
bind pub G|G [string trim $pwf_trigger]shake pwf_shaketeam
bind pub G|G [string trim $pwf_trigger]shaketeam pwf_shaketeam
bind pub G|G [string trim $pwf_trigger]shaketeams pwf_shaketeam
bind msg - [string trim $pwf_trigger]help pwf_msghelp
bind msg - [string trim $pwf_trigger]version pwf_version
bind msg - [string trim $pwf_trigger]admin pwf_auth
bind msg G|G [string trim $pwf_trigger]addgame pwf_addgame
bind msg G|G [string trim $pwf_trigger]endgame pwf_remgame
bind msg G|G [string trim $pwf_trigger]info pwf_info
bind msg G|G [string trim $pwf_trigger]ban pwf_ban
bind msg G|G [string trim $pwf_trigger]baninfo pwf_baninfo
bind msg m|m [string trim $pwf_trigger]enable pwf_msgenable
bind msg m|m [string trim $pwf_trigger]disable pwf_msgdisable
bind msg - [string trim $pwf_trigger]giveadmin pwf_giveadmin
bind dcc m|m addadmin pwf_addadmin2
bind dcc m|m adminstats pwf_adminstats
bind nick - * pwf_nickchange
bind part - * pwf_playerquit
bind kick - * pwf_playerkicked
bind sign - * pwf_playersign
bind topc - * pwf_topicchange
bind raw - 330 pwf_qauthnick
bind raw - 473 pwf_qinvite
bind raw - 474 pwf_qunban
bind mode - "% +o" pwf_botop
bind time - "00 00 30 * *" pwf_resetvoice
bind time - "00 00 15 * *" pwf_resetop
bind time - "00 00 30 * *" pwf_resetop
utimer 10 pwf_remoldflag

if {$pwf_welcomemsg!=0} {
  bind join - * pwf_msgonjoin
}

set pwf_pickupchan [string tolower $pwf_pickupchan]
set pwf_shutupchan 0
set pwf_type ""
set pwf_maxpl $pwf_defaultplayer
set pwf_voters [list ]
set pwf_baneduser ""
set pwf_quality 0
set pwf_serverholder ""
set pwf_active 0
set pwf_playernumber 0
set pwf_serverip ""
set pwf_serverpassword ""
set pwf_teamaserver [list ]
set pwf_teambserver [list ]
set pwf_maplock 0
set pwf_mapslength [llength $pwf_maps]
set pwf_players ""
set pwf_version "1.8a"
set pwf_playerhosts [list ]
set pwf_voiced [list ]
set pwf_stats [list ]
 
incr pwf_playerleft
utimer 2 pwf_readfile

if ![info exists pwf_antirehash] {
  timer 10 pwf_checkactive
  timer 2 pwf_tchk
  timer 2 pwf_qneedop
  set pwf_antirehash 1
}

if {[info exists pwf_qqueue1]} {unset pwf_qqueue1}
if {[info exists pwf_qqueue2]} {unset pwf_qqueue2}

if {![file readable pwf_stats]} {
  set fileio [open pwf_stats "w"]
  puts $fileio ""
  close $fileio
}
if {![file readable pwf_hosts]} {
  set fileio [open pwf_hosts "w"]
  puts $fileio ""
  close $fileio
}
if {![file readable pwf_voice]} {
  set fileio [open pwf_voice "w"]
  puts $fileio ""
  close $fileio
}

proc pwf_msgonjoin { nickname user handle channel } {
  global pwf_welcomemsg pwf_pickupchan
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    putserv "NOTICE $nickname :[pwf_txt welcome] $nickname . $pwf_welcomemsg"
  }
}


proc pwf_topicchange {nick uhost handle channel topic} {
  global botnick pwf_pickupchan
  set channel [string tolower $channel]
  if { ( $nick != $botnick ) && ( $channel == $pwf_pickupchan ) } {
    set thetopic
    if {$thetopic == ""} {
     utimer 2 "pwf_waittopic $channel"
    } else {
     pwf_newtopic $channel $thetopic
    }
  }
  return 1
}



proc pwf_waittopic {channel} {
  set channel [string tolower $channel]
  if {[pwf_checkfile pwf_topic "r"]} {
    set fileio [open pwf_topic "r"]
    set restoredtopic [gets $fileio]
    close $fileio
    if {$restoredtopic != ""} {
      putserv "TOPIC $channel :$restoredtopic"
      pwf_newtopic $channel $restoredtopic
      return 1
    }
  }
}



proc pwf_newtopic {channel topic} {
  set channel [string tolower $channel]
  if {[file exists pwf_topic]} {
    if {![pwf_checkfile pwf_topic "w"]} {
    putlog "[pwf_txt misc1] pwf_topic"
    return 0
    }
  }
  set fileio [open pwf_topic "w"]
  puts $fileio $topic
  flush $fileio
  close $fileio
  return 1
}



proc pwf_checkfile {file rw} {
  if {[file exists $file] && [file isfile $file]} {
    if {$rw == "r"} {
      if {[file readable $file]} {
        return 1
      } else {
        return 0
      }
    } elseif {$rw == "w"} {
      if {[file writable $file]} {
        return 1
      } else {
        return 0
      }
    } else {
      return 1
    }
  }
  return 0
}



proc pwf_setnogame {} {
  global pwf_pickupchan pwf_shutupchan pwf_nogametopic
  set channel $pwf_pickupchan
  if { $pwf_shutupchan == 0 } {
    if {[pwf_checkfile pwf_topic "r"]} {
      set fileio [open pwf_topic "r"]
      set restoredtopic [gets $fileio]
      close $fileio
      if {$restoredtopic != ""} {
        set keyword [string range $pwf_nogametopic 0 5]
        if { [string match "*$keyword*" $restoredtopic]} {
             putserv "TOPIC $channel :$restoredtopic"
        } else {
          putserv "TOPIC $channel :$restoredtopic $pwf_nogametopic"
        }
      }
    }
  }
}



proc pwf_starttopic {} {
  global pwf_teamatopic pwf_teambtopic pwf_maptopic pwf_maxpl pwf_playernumber pwf_serverholder pwf_quality pwf_pickupchan pwf_shutupchan pwf_type
  pwf_buildteams
  if { $pwf_quality == 0 } {
    if { $pwf_shutupchan == 0 } {
      if { $pwf_type == "" } {
        putserv "TOPIC $pwf_pickupchan :[pwf_txt topic1] $pwf_serverholder [pwf_txt topic2] $pwf_maptopic"
      } else {
        putserv "TOPIC $pwf_pickupchan :[pwf_txt topic1] $pwf_serverholder [pwf_txt topic4] $pwf_type [pwf_txt topic2] $pwf_maptopic"
      }
    }
  } else {
    if { $pwf_shutupchan == 0 } {
      if { $pwf_type == "" } {
        putserv "TOPIC $pwf_pickupchan :[pwf_txt topic1] $pwf_serverholder [pwf_txt topic5] [pwf_txt topic2] $pwf_maptopic"
      } else {
        putserv "TOPIC $pwf_pickupchan :[pwf_txt topic1] $pwf_serverholder [pwf_txt topic5] [pwf_txt topic4] $pwf_type [pwf_txt topic2] $pwf_maptopic"
      }
    }
  }
}



proc pwf_settopic {} {
  global pwf_teamatopic pwf_teambtopic pwf_maxpl pwf_playernumber pwf_serverholder pwf_pickupchan pwf_shutupchan
  pwf_buildteams
  if { $pwf_shutupchan == 0 } {
      putserv "PRIVMSG $pwf_pickupchan :[pwf_txt teams1] $pwf_playernumber/$pwf_maxpl [pwf_txt separator] $pwf_teamatopic [pwf_txt separator] $pwf_teambtopic"
  }
}



proc pwf_addme { nick uhost handle channel team } {
  global pwf_teamaserver pwf_teambserver pwf_playernumber pwf_maxpl pwf_pickupchan pwf_active pwf_quality pwf_shutupchan pwf_playerleft
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } { 
    if { $pwf_shutupchan == 0 } {
      if { $pwf_active == 1 } {
        set team [string tolower $team]
        set nick [pwf_charfilter $nick]
        if { $team == "" } {
          set numberteama [lsearch -exact $pwf_teamaserver $nick ]
          set numberteamb [lsearch -exact $pwf_teambserver $nick ]
          set ispresent [expr $numberteama + $numberteamb]
          if { $ispresent == -2 } {
            if { [llength $pwf_teambserver] < [llength $pwf_teamaserver] } {
              set team b
            } else {
              set team a
            }
          } else {
            putserv "NOTICE $nick :[pwf_txt addme1]"
            return 0
          }
        }
        if { $pwf_quality == 1 } {
          if { ( [isvoice $nick $channel] ) || ( [isop $nick $channel] ) } {
            if { ( [lsearch -exact $team a ] >-1 ) && ( [lsearch -exact $pwf_teamaserver $nick ] <0 ) && ( [llength $pwf_teamaserver] < [expr $pwf_maxpl/2] ) } {
              set pwf_teamaserver [linsert $pwf_teamaserver end $nick ]
              if {[lsearch -exact $pwf_teambserver $nick ] >-1 } {
                set playerindex [lsearch -exact $pwf_teambserver $nick ]
                set pwf_teambserver [lreplace $pwf_teambserver $playerindex $playerindex ]
              }
              set pwf_playernumber [expr [llength $pwf_teamaserver]+[llength $pwf_teambserver]]
              pwf_settopic
            } elseif { ( [lsearch -exact $team b] >-1 ) && ( [lsearch -exact $pwf_teambserver $nick ] <0 ) && ( [llength $pwf_teambserver] < [expr $pwf_maxpl/2] ) } {
              set pwf_teambserver [linsert $pwf_teambserver end $nick ]
              if {[lsearch -exact $pwf_teamaserver $nick ] >-1 } {
                set playerindex [lsearch -exact $pwf_teamaserver $nick ]
                set pwf_teamaserver [lreplace $pwf_teamaserver $playerindex $playerindex ]
              }
              set pwf_playernumber [expr [llength $pwf_teamaserver]+[llength $pwf_teambserver]]
              pwf_settopic
            } else {
              putserv "NOTICE $nick :[pwf_txt addme1]"
            }
            if { $pwf_playernumber == $pwf_maxpl } {
              pwf_launchgame
              set pwf_quality 0
            } elseif { $pwf_playernumber > [expr $pwf_maxpl - $pwf_playerleft] } {
              set pwf_playerneeded [expr $pwf_maxpl -$pwf_playernumber]
              putserv "NOTICE $channel :[pwf_txt start5] $channel !! [pwf_txt separator2] $pwf_playerneeded [pwf_txt start6]"
            }
          } else {
            putserv "NOTICE $nick :[pwf_txt addme2]"
          }
        } elseif { $pwf_quality == 0 } {
          if { ( [lsearch -exact $team a ] >-1 ) && ( [lsearch -exact $pwf_teamaserver $nick ] <0 ) && ( [llength $pwf_teamaserver] < [expr $pwf_maxpl/2] ) } {
            set pwf_teamaserver [linsert $pwf_teamaserver end $nick ]
            if {[lsearch -exact $pwf_teambserver $nick ] >-1 } {
              set playerindex [lsearch -exact $pwf_teambserver $nick ]
              set pwf_teambserver [lreplace $pwf_teambserver $playerindex $playerindex ]
            }
            set pwf_playernumber [expr [llength $pwf_teamaserver]+[llength $pwf_teambserver]]
            pwf_settopic
          } elseif { ( [lsearch -exact $team b] >-1 ) && ( [lsearch -exact $pwf_teambserver $nick ] <0 ) && ( [llength $pwf_teambserver] < [expr $pwf_maxpl/2] ) } {
            set pwf_teambserver [linsert $pwf_teambserver end $nick ]
            if {[lsearch -exact $pwf_teamaserver $nick ] >-1 } {
              set playerindex [lsearch -exact $pwf_teamaserver $nick ]
              set pwf_teamaserver [lreplace $pwf_teamaserver $playerindex $playerindex ]
            }
            set pwf_playernumber [expr [llength $pwf_teamaserver]+[llength $pwf_teambserver]]
            pwf_settopic
          } else {
            putserv "NOTICE $nick :[pwf_txt addme1]"
          }
          if { $pwf_playernumber == $pwf_maxpl } {
            pwf_launchgame
          } elseif { $pwf_playernumber > [expr $pwf_maxpl - $pwf_playerleft] } {
            set pwf_playerneeded [expr $pwf_maxpl - $pwf_playernumber]
            putserv "NOTICE $channel :[pwf_txt start5] $channel !! [pwf_txt separator2] $pwf_playerneeded [pwf_txt start6]"
          }
        }
      } else {
        putserv "NOTICE $nick :[pwf_txt addme3]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt addme4]"
    }
  }
}



proc pwf_remove { nick uhost handle channel arg} {
  global pwf_teamaserver pwf_teambserver pwf_playernumber pwf_active pwf_pickupchan pwf_shutupchan
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    if { $pwf_shutupchan == 0 } {
      if { $pwf_active == 1 } {
        set nick [pwf_charfilter $nick]
        if { [lsearch -exact $pwf_teamaserver $nick ] >-1 } {
          set playerindex [lsearch -exact $pwf_teamaserver $nick ]
          set pwf_teamaserver [lreplace $pwf_teamaserver $playerindex $playerindex ]
          set pwf_playernumber [expr [llength $pwf_teamaserver]+[llength $pwf_teambserver]]
          pwf_settopic
        } elseif { [lsearch -exact $pwf_teambserver $nick ] >-1 } {
          set playerindex [lsearch -exact $pwf_teambserver $nick ]
          set pwf_teambserver [lreplace $pwf_teambserver $playerindex $playerindex ]
          set pwf_playernumber [expr [llength $pwf_teamaserver]+[llength $pwf_teambserver]]
          pwf_settopic
        } else {
          putserv "NOTICE $nick :[pwf_txt addme5]"
        }
      } else {
        putserv "NOTICE $nick :[pwf_txt addme3]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt addme4]"
    }
  }
}



proc pwf_votemap { nick uhost handle channel votemap } {
  global pwf_teamaserver pwf_teambserver pwf_active pwf_maplock pwf_voters pwf_maps pwf_maptopic pwf_maptopic2 pwf_maptopic3 pwf_mapslength pwf_pickupchan pwf_shutupchan pwf_votenumber
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    if { $pwf_shutupchan == 0 } {
      if { $pwf_active == 1 } {
        set numberteama [lsearch -exact $pwf_teamaserver $nick ]
        set numberteamb [lsearch -exact $pwf_teambserver $nick ]
        set ispresent [expr $numberteama + $numberteamb]
        if { $ispresent > -2 } {
          if { $pwf_maplock == 0 } {
            set votecounter 0
            set voters2 $pwf_voters
            set votedmap [list ]
            while { [lsearch -exact $voters2 $nick] > -1 } {
              set voterindex [lsearch -exact $voters2 $nick]
              set mapindex [expr $voterindex +1]
              set votedmap [linsert $votedmap end [lindex $voters2 $mapindex]]
              set voters2 [lreplace $voters2 $voterindex $voterindex]
              incr votecounter
            }
            if { $votecounter < $pwf_votenumber } { 
              set votemap [string tolower $votemap]
              set mapindex [lsearch $pwf_maps $votemap]
              if { ( $mapindex > -1 ) && ( [lsearch -exact $votedmap $mapindex] < 0 ) } {
                set pwf_voters [linsert $pwf_voters end $nick]
                set pwf_voters [linsert $pwf_voters end $mapindex]
                putserv "NOTICE $nick :[pwf_txt vote1]"
              } else {
                putserv "NOTICE $nick :[pwf_txt vote2]"
              }
            } else {
              set mapindex [lsearch $pwf_maps $votemap]
              if { ( $mapindex > -1 ) && ( [lsearch -exact $votedmap $mapindex] < 0 ) } {
                set voterindex [lsearch -exact $pwf_voters $nick]
                set voterindex2 [expr $voterindex +1]
                set pwf_voters [lreplace $pwf_voters $voterindex $voterindex2]
                set pwf_voters [linsert $pwf_voters end $nick]
                set pwf_voters [linsert $pwf_voters end $mapindex]                
                putserv "NOTICE $nick :[pwf_txt vote1]"
              } else {
                putserv "NOTICE $nick :[pwf_txt vote2]"
              }
            }
            set previousmap $pwf_maptopic
            set voters2 $pwf_voters
            set voters2length [llength $voters2]
            set mapranking [list ]
            set maps2 [list ]
            for {set x 0} { $x < $pwf_mapslength } {incr x} {
              set maps2 [linsert $maps2 0 0]
            }
            for {set x 1} { $x < $voters2length } {incr x 2} {
              set votedmap [lindex $voters2 $x]
              set numbervote [lindex $maps2 $votedmap]
              incr numbervote
              set maps2 [lreplace $maps2 $votedmap $votedmap $numbervote]
            }
            for {set x 0} { $x < $pwf_mapslength } {incr x} {
              set themap

[lindex $pwf_maps $x]]
              set mapranking [linsert $mapranking end $themap]
            }
            set mapranking [lsort -integer -decreasing -index 0 $mapranking]
            set mapwin ]
            set mapwin2 ]
            set mapwin3 ]
            set endindex [expr [string length $mapwin ] - 2 ]
            set endindex2 [expr [string length $mapwin2 ] - 2 ]
            set endindex3 [expr [string length $mapwin3 ] - 2 ]
            set pwf_maptopic [string range $mapwin 3 $endindex]
            if { [lindex [lindex $mapwin2 0] 0] != "0" } {
              set pwf_maptopic2 [string range $mapwin2 3 $endindex2]
            } else {
              set pwf_maptopic2 [pwf_txt defmap]
            }
            if { [lindex [lindex $mapwin3 0] 0] != "0" } {
              set pwf_maptopic3 [string range $mapwin3 3 $endindex3]
            } else {
              set pwf_maptopic3 [pwf_txt defmap]
            }
            if { ( $pwf_maptopic == $votemap ) && ( $pwf_maptopic != $previousmap ) } {
              putserv "PRIVMSG $channel :[pwf_txt vote3] $pwf_maptopic"
              pwf_starttopic
            }
          } else {
            putserv "NOTICE $nick :[pwf_txt vote4]"
          }
        } else {
          putserv "NOTICE $nick :[pwf_txt vote5]"
        }
      } else {
        putserv "NOTICE $nick :[pwf_txt addme3]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt addme4]"
    }
  }
}


proc pwf_topmaps { nick uhost handle channel arg } {
  global pwf_active pwf_pickupchan pwf_maptopic pwf_shutupchan pwf_maptopic2 pwf_maptopic3
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    if { $pwf_shutupchan == 0 } {
      if { $pwf_active == 1 } {
        putserv "PRIVMSG $channel :[pwf_txt vote6] 1. $pwf_maptopic 2. $pwf_maptopic2 3. $pwf_maptopic3"
      } else {
        putserv "NOTICE $nick :[pwf_txt addme3]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt addme4]"
    }
  }
}



proc pwf_ip { nick uhost handle channel arg } {
  global pwf_active pwf_pickupchan pwf_serverip pwf_shutupchan
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    if { $pwf_shutupchan == 0 } {
      if { $pwf_active == 1 } {
        putserv "PRIVMSG $channel :[pwf_txt ip1] $pwf_serverip [pwf_txt ip2]"
      } else {
        putserv "NOTICE $nick :[pwf_txt addme3]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt addme4]"
    }
  }
}



proc pwf_teams { nick uhost handle channel arg } {
  global pwf_active pwf_pickupchan pwf_teamatopic pwf_teambtopic pwf_shutupchan
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    if { $pwf_shutupchan == 0 } {
      if { $pwf_active == 1 } {
        putserv "PRIVMSG $channel : $pwf_teamatopic [pwf_txt separator] $pwf_teambtopic"
      } else {
        putserv "NOTICE $nick :[pwf_txt addme3]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt addme4]"
    }
  }
}



proc pwf_addmap { nick uhost handle channel map } {
  global pwf_maptopic pwf_active pwf_pickupchan pwf_maplock pwf_serverholder pwf_shutupchan
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    if { $pwf_shutupchan == 0 } {
      if { $pwf_active == 1 } {
        set nick [pwf_charfilter $nick]
        if { ( $nick == $pwf_serverholder ) || ( [matchattr $handle m|m ] ) } {
          if { $map != "" } {
            set pwf_maptopic $map
            pwf_starttopic
            set pwf_maplock 1
          } else {
            putserv "NOTICE $nick :[pwf_txt admin1]"
          }
        } else {
          putserv "NOTICE $nick :[pwf_txt admin2]"
        }
      } else {
        putserv "NOTICE $nick :[pwf_txt addme3]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt addme4]"
    }
  }
}



proc pwf_addtype { nick uhost handle channel arg } {
  global pwf_type pwf_active pwf_pickupchan pwf_serverholder pwf_shutupchan
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    if { $pwf_shutupchan == 0 } {
      if { $pwf_active == 1 } {
        set nick [pwf_charfilter $nick]
        if { ( $nick == $pwf_serverholder ) || ( [matchattr $handle m|m ] ) } {
          set pwf_type $arg
          pwf_starttopic
        } else {
          putserv "NOTICE $nick :[pwf_txt admin2]"
        }
      } else {
        putserv "NOTICE $nick :[pwf_txt addme3]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt addme4]"
    }
  }
}



proc pwf_playernumber { nick uhost handle channel arg } {
  global pwf_maxpl pwf_active pwf_pickupchan pwf_serverholder pwf_shutupchan pwf_playernumber pwf_teamaserver pwf_teambserver
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    if { $pwf_shutupchan == 0 } {
      if { $pwf_active == 1 } {
        set nick [pwf_charfilter $nick]
        if { ( $nick == $pwf_serverholder ) || ( [matchattr $handle m|m ] ) } {
          if { $arg != "" } {
            if { [expr $arg % 2 ] == "0" } {
              if { $pwf_playernumber < $arg } {
                if { [llength $pwf_teamaserver] > [expr $arg / 2] } {
                  set players [lrange $pwf_teamaserver [expr $arg / 2] end]
                  set pwf_teambserver [linsert $pwf_teambserver end $players]
                  set pwf_teamaserver [lreplace $pwf_teamaserver [expr $arg / 2] end]
                } elseif { [llength $pwf_teambserver] > [expr $arg / 2] } {
                  set players [lrange $pwf_teambserver [expr $arg / 2] end]
                  set pwf_teamaserver [linsert $pwf_teamaserver end $players]
                  set pwf_teambserver [lreplace $pwf_teambserver [expr $arg / 2] end]
                }
                set pwf_maxpl $arg
                pwf_settopic
              } elseif { ( $pwf_playernumber == $arg ) && ( $arg != 0 ) } {
                if { [llength $pwf_teamaserver] > [expr $arg / 2] } {
                  set players [lrange $pwf_teamaserver [expr $arg / 2] end]
                  set pwf_teambserver [linsert $pwf_teambserver end $players]
                  set pwf_teamaserver [lreplace $pwf_teamaserver [expr $arg / 2] end]
                } elseif { [llength $pwf_teambserver] > [expr $arg / 2] } {
                  set players [lrange $pwf_teambserver [expr $arg / 2] end]
                  set pwf_teamaserver [linsert $pwf_teamaserver end $players]
                  set pwf_teambserver [lreplace $pwf_teambserver [expr $arg / 2] end]
                }
                set pwf_maxpl $arg
                pwf_settopic
                pwf_launchgame
              } else {
                putserv "NOTICE $nick :[pwf_txt admin5]"
              }
            } else {
              putserv "NOTICE $nick :[pwf_txt admin4]"
            }
          } else {
            putserv "NOTICE $nick :[pwf_txt admin3]"
          }
        } else {
          putserv "NOTICE $nick :[pwf_txt admin2]"
        }         
      } else {
        putserv "NOTICE $nick :[pwf_txt addme3]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt addme4]"
    }
  }
}



proc pwf_moveplayer { nick uhost handle channel player } {
  global pwf_active pwf_pickupchan pwf_serverholder pwf_shutupchan pwf_teamaserver pwf_teambserver pwf_maxpl
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    if { $pwf_shutupchan == 0 } {
      if { $pwf_active == 1 } {
        set nick [pwf_charfilter $nick]
        if { ( $nick == $pwf_serverholder ) || ( [matchattr $handle m|m ] ) } {
          set player2 [lindex $player 1]
          set player [lindex $player 0]
          if { $player != ""  } {
            if { $player2 == "" } {
              if { ( [lsearch -exact $pwf_teambserver $player ] > -1 ) && ( [llength $pwf_teamaserver] < [expr $pwf_maxpl/2] ) } {
                set pwf_teamaserver [linsert $pwf_teamaserver end $player]
                set playerindex [lsearch -exact $pwf_teambserver $player]
                set pwf_teambserver [lreplace $pwf_teambserver $playerindex $playerindex]
                pwf_settopic
              } elseif { ( [lsearch -exact $pwf_teamaserver $player ] > -1 ) && ( [llength $pwf_teambserver] < [expr $pwf_maxpl/2] ) } {
                set pwf_teambserver [linsert $pwf_teambserver end $player]
                set playerindex [lsearch -exact $pwf_teamaserver $player]
                set pwf_teamaserver [lreplace $pwf_teamaserver $playerindex $playerindex]
                pwf_settopic
              } else {
                putserv "NOTICE $nick :[pwf_txt move1]"
              }
            } else {
              if { ( [lsearch -exact $pwf_teambserver $player ] > -1 ) && ( [lsearch -exact $pwf_teamaserver $player2 ] > -1 ) } {
                set playerindex [lsearch -exact $pwf_teambserver $player ]
                set playerindex2 [lsearch -exact $pwf_teamaserver $player2 ]
                set pwf_teamaserver [lreplace $pwf_teamaserver $playerindex2 $playerindex2 $player]
                set pwf_teambserver [lreplace $pwf_teambserver $playerindex $playerindex $player2]
                pwf_settopic
              } elseif { ( [lsearch -exact $pwf_teamaserver $player ] > -1 ) && ( [lsearch -exact $pwf_teambserver $player2 ] > -1 ) } {
                set playerindex [lsearch -exact $pwf_teamaserver $player ]
                set playerindex2 [lsearch -exact $pwf_teambserver $player2 ]
                set pwf_teambserver [lreplace $pwf_teambserver $playerindex2 $playerindex2 $player]
                set pwf_teamaserver [lreplace $pwf_teamaserver $playerindex $playerindex $player2]
                pwf_settopic
              } else {
                putserv "NOTICE $nick :[pwf_txt move2]"
              }
            }
          } else {
            putserv "NOTICE $nick :[pwf_txt admin1]"
          }
        } else {
          putserv "NOTICE $nick :[pwf_txt admin2]"
        }
      } else {
        putserv "NOTICE $nick :[pwf_txt addme3]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt addme4]"
    }
  }
}



proc pwf_addgame { nick uhost handle arg } {
  global pwf_active pwf_pickupchan pwf_shutupchan pwf_serverip pwf_serverpassword pwf_serverholder pwf_quality
  if { [matchattr $handle H] } {
    if { $pwf_shutupchan == 0 } {
      if { ( $pwf_active == 0 ) } {
        set nick [pwf_charfilter $nick]
        set pwf_serverip [lindex $arg 0]
        set pwf_serverpassword [lindex $arg 1]
        set gamequality [lindex $arg 2]
        set qualitytxt "vip"
        if { ( $pwf_serverpassword != "" ) && ( $pwf_serverip != "" ) && ( $pwf_serverpassword != $qualitytxt ) } {
          if { $gamequality == $qualitytxt } {
            if { $pwf_quality == 0 } {
              set pwf_quality 1
              set pwf_serverholder $nick
              putserv "PRIVMSG $pwf_serverholder :[pwf_txt addgame1] $pwf_serverip [pwf_txt addgame2] $pwf_serverpassword [pwf_txt addgame3] [pwf_txt addgame4]"
            } else {
              putserv "PRIVMSG $pwf_serverholder :[pwf_txt addgame5]"
              set pwf_serverip ""
              set pwf_serverpassword ""
            }
          } else {
            set pwf_serverholder $nick
            putserv "PRIVMSG $pwf_serverholder :[pwf_txt addgame1] $pwf_serverip [pwf_txt addgame2] $pwf_serverpassword [pwf_txt addgame4]"
          }
        } else {
          putserv "PRIVMSG $nick :[pwf_txt addgame8]"
          set pwf_serverip ""
          set pwf_serverpassword ""
        }
      } else {
        putserv "PRIVMSG $nick :[pwf_txt addgame6] $pwf_serverholder [pwf_txt addgame7]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt addgame10] $pwf_pickupchan"
    }
  } else {
    putserv "NOTICE $nick :[pwf_txt noauth]"
  }
}



proc pwf_info { nick uhost handle arg } {
  global pwf_active pwf_pickupchan pwf_serverip pwf_serverpassword pwf_serverholder pwf_pickupchan pwf_quality pwf_stats
  set nick [pwf_charfilter $nick]
  if { ( $nick == $pwf_serverholder ) && ( $pwf_active == 0 )} {
    if { $arg == "ok" } {
      putserv "PRIVMSG $nick :[pwf_txt addgame9]"
      set pwf_active 1
      set pwf_stats [linsert $pwf_stats end $handle]
      set fileio [open pwf_stats "w"]
      puts $fileio $pwf_stats
      flush $fileio
      close $fileio
      pwf_starttopic
      putserv "NOTICE $pwf_pickupchan :[pwf_txt addgame11] $pwf_pickupchan [pwf_txt separator2] [pwf_txt addgame12]"
      if {![isop $nick $pwf_pickupchan]} {
        if {[getuser $victhand info]!=""} {
          putserv "PRIVMSG $pwf_qauth :chanlev $pwf_pickupchan #[getuser $victhand info] +ao"
          putserv "MODE $pwf_pickupchan +o $nick"
        } else {
          if {($pwf_qauth=="Q")||($pwf_qauth=="L")} {
            set pwf_qauthnick_timers($victime) [utimer 20 "set pwf_qauthnick($victime) 0"]
            trace variable pwf_qauthnick($victime) w pwf_addadmincheck
            putserv "WHOIS $victime"
          }
        }
      }
    } else {
      set pwf_serverpassword ""
      set pwf_serverip ""
      set pwf_serverholder ""
      putserv "PRIVMSG $nick :[pwf_txt addgame0]"
    }
  }
}



proc pwf_lastgame { nick uhost handle channel arg } {
  global pwf_pickupchan pwf_lastgame
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    putserv "PRIVMSG $channel :$pwf_lastgame"
  }
}



proc pwf_help { nick uhost handle channel arg } {
  global pwf_pickupchan
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    putserv "NOTICE $nick :[pwf_txt help1]"
    putserv "NOTICE $nick :[pwf_txt help2]"
    putserv "NOTICE $nick :[pwf_txt help3]"
    putserv "NOTICE $nick :[pwf_txt help4]"
    putserv "NOTICE $nick :[pwf_txt help5]"
    putserv "NOTICE $nick :[pwf_txt help6] #Gather ( EvilNet.Org ) - https://gather.evilnet.org - by xpl0ziv"
  }
}



proc pwf_msghelp { nick uhost handle arg } {
  putserv "NOTICE $nick :[pwf_txt help1]"
  putserv "NOTICE $nick :[pwf_txt help2]"
  putserv "NOTICE $nick :[pwf_txt help3]"
  putserv "NOTICE $nick :[pwf_txt help4]"
  putserv "NOTICE $nick :[pwf_txt help5]"
  putserv "NOTICE $nick :[pwf_txt help6] #Gather ( EvilNet.Org ) - https://gather.evilnet.org - by xpl0ziv"
}



proc pwf_version { nick uhost handle arg } {
  global pwf_version
  putserv "PRIVMSG $nick :[pwf_txt version] $pwf_version"
}



proc pwf_checkactive {} {
  global pwf_active pwf_serverpassword pwf_serverip pwf_serverholder pwf_baneduser
  timer 10 pwf_checkactive
  if { ( $pwf_active == 0 ) && ( $pwf_serverholder != "" ) } {
    set pwf_serverpassword ""
    set pwf_serverip ""
    set pwf_serverholder ""
  }
  set pwf_baneduser ""
}



proc pwf_remgame { nick uhost handle arg } {
  global pwf_active pwf_quality pwf_maptopic pwf_playernumber pwf_serverip pwf_teamaserver pwf_teambserver pwf_serverpassword pwf_pickupchan pwf_maplock pwf_serverholder pwf_voters pwf_type pwf_maxpl pwf_defaultplayer
  if { [matchattr $handle H] } {
    if { $pwf_active == 1 } {
      set nick [pwf_charfilter $nick]
      if { ( $nick == $pwf_serverholder ) || ( [matchattr $handle m|m ] ) } {
        putserv "PRIVMSG $pwf_pickupchan : [pwf_txt cancel1] $pwf_serverholder [pwf_txt cancel2]"
        set players $pwf_teamaserver
        set players [concat $players [concat $pwf_teambserver]]
        foreach player $players {
          putserv "PRIVMSG $player :[pwf_txt cancel6]"
        }
        set pwf_active 0
        set pwf_serverip ""
        set pwf_serverpassword ""
        set pwf_playernumber 0
        set pwf_teamaserver [list ]
        set pwf_teambserver [list ]
        set pwf_maplock 0
        set pwf_serverholder 0
        set pwf_maptopic [pwf_txt defmap]
        set pwf_voters [list ]
        pwf_setnogame
        set pwf_quality 0
        set pwf_type ""
        set pwf_maxpl $pwf_defaultplayer
      } else {
        putserv "NOTICE $nick :[pwf_txt cancel5]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt cancel4]"
    }  
  } else {
    putserv "NOTICE $nick :[pwf_txt noauth]"
  }
}



proc pwf_nickchange { nick uhost handle channel newnick } {
   global pwf_teamaserver pwf_teambserver pwf_serverholder pwf_shutupchan pwf_authnick pwf_pickupchan pwf_voters
   set channel [string tolower $channel]
   if { $channel == $pwf_pickupchan } {
     if { $pwf_shutupchan == 0 } {
       set nick [pwf_charfilter $nick]
       set newnick [pwf_charfilter $newnick]
       if {[lsearch -exact $pwf_teamaserver $nick ] >-1 } {
         set playerindex [lsearch -exact $pwf_teamaserver $nick ]
         set pwf_teamaserver [lreplace $pwf_teamaserver $playerindex $playerindex $newnick]
       } elseif {[lsearch -exact $pwf_teambserver $nick ] >-1 } {
         set playerindex [lsearch -exact $pwf_teambserver $nick ]
         set pwf_teambserver [lreplace $pwf_teambserver $playerindex $playerindex $newnick]
       }
       if { $nick == $pwf_serverholder } {
         set pwf_serverholder $newnick
       }
       while {[lsearch -exact $pwf_voters $nick ] > -1 } {
         set playerindex [lsearch -exact $pwf_voters $nick ]
         set pwf_voters [lreplace $pwf_voters $playerindex $playerindex $newnick]
       }
     }
     if [info exists pwf_authnick($nick)] {
       set pwf_authnick($newnick) $pwf_authnick($nick)
       unset pwf_authnick($nick)
     }
   }
}


proc pwf_playerquit { nick uhost handle channel arg } {
  global pwf_teamaserver pwf_teambserver pwf_playernumber pwf_pickupchan pwf_serverholder pwf_shutupchan pwf_authnick
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    if { $pwf_shutupchan == 0 } {
      set nick [pwf_charfilter $nick]
      if {[lsearch -exact $pwf_teamaserver $nick ] >-1 } {
        set playerindex [lsearch -exact $pwf_teamaserver $nick ]
        set pwf_teamaserver [lreplace $pwf_teamaserver $playerindex $playerindex ]
        set pwf_playernumber [expr [llength $pwf_teamaserver]+[llength $pwf_teambserver]]
        pwf_settopic
      } elseif {[lsearch -exact $pwf_teambserver $nick ] >-1 } {
        set playerindex [lsearch -exact $pwf_teambserver $nick ]
        set pwf_teambserver [lreplace $pwf_teambserver $playerindex $playerindex ]
        set pwf_playernumber [expr [llength $pwf_teamaserver]+[llength $pwf_teambserver]]
        pwf_settopic
      }
      if { $nick == $pwf_serverholder } {
        if { $pwf_shutupchan == 0 } { 
          putserv "PRIVMSG $pwf_pickupchan :[pwf_txt cancel1] $pwf_serverholder [pwf_txt cancel3]"
          set players $pwf_teamaserver
          set players [concat $players [concat $pwf_teambserver]]
          foreach player $players {
            putserv "PRIVMSG $player :[pwf_txt cancel6]"
          }
        }
        pwf_endgame
      }
    }
    if ![info exists pwf_authnick($nick)] {
      return 0
    }
    if ![matchattr $pwf_authnick($nick) H] {
      return 0
    }
    chattr $pwf_authnick($nick) -H
    unset pwf_authnick($nick)
    putserv "NOTICE $nick :[pwf_txt deauthpart]"
    return 0
  }
}



proc pwf_playerkicked { kickernick uhost hand channel nick reason } {
  global pwf_teamaserver pwf_teambserver pwf_playernumber pwf_pickupchan pwf_serverholder pwf_shutupchan pwf_authnick
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    if { $pwf_shutupchan == 0 } {
      set nick [pwf_charfilter $nick]
      if {[lsearch -exact $pwf_teamaserver $nick ] >-1 } {
        set playerindex [lsearch -exact $pwf_teamaserver $nick ]
        set pwf_teamaserver [lreplace $pwf_teamaserver $playerindex $playerindex ]
        set pwf_playernumber [expr [llength $pwf_teamaserver]+[llength $pwf_teambserver]]
        pwf_settopic
      } elseif {[lsearch -exact $pwf_teambserver $nick ] >-1 } {
        set playerindex [lsearch -exact $pwf_teambserver $nick ]
        set pwf_teambserver [lreplace $pwf_teambserver $playerindex $playerindex ]
        set pwf_playernumber [expr [llength $pwf_teamaserver]+[llength $pwf_teambserver]]
        pwf_settopic
      }
      if { $nick == $pwf_serverholder } {
        if { $pwf_shutupchan == 0 } { 
          putserv "PRIVMSG $pwf_pickupchan :[pwf_txt cancel1] $pwf_serverholder [pwf_txt cancel3]"
          set players $pwf_teamaserver
          set players [concat $players [concat $pwf_teambserver]]
          foreach player $players {
            putserv "PRIVMSG $player :[pwf_txt cancel6]"
          }
        }
        pwf_endgame
      }
    }
    if ![info exists pwf_authnick($nick)] {
      return 0
    }
    if ![matchattr $pwf_authnick($nick) H] {
      return 0
    }
    chattr $pwf_authnick($nick) -H
    unset pwf_authnick($nick)
    putserv "NOTICE $nick :[pwf_txt deauthkick]"
    return 0
  }
}



proc pwf_playersign {nick uhost hand channel rest} { 
  global pwf_teamaserver pwf_teambserver pwf_playernumber pwf_pickupchan pwf_serverholder pwf_shutupchan pwf_authnick
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    if { $pwf_shutupchan == 0 } {
      set nick [pwf_charfilter $nick]
      if {[lsearch -exact $pwf_teamaserver $nick ] >-1 } {
        set playerindex [lsearch -exact $pwf_teamaserver $nick ]
        set pwf_teamaserver [lreplace $pwf_teamaserver $playerindex $playerindex ]
        set pwf_playernumber [expr [llength $pwf_teamaserver]+[llength $pwf_teambserver]]
        pwf_settopic
      } elseif {[lsearch -exact $pwf_teambserver $nick ] >-1 } {
        set playerindex [lsearch -exact $pwf_teambserver $nick ]
        set pwf_teambserver [lreplace $pwf_teambserver $playerindex $playerindex ]
        set pwf_playernumber [expr [llength $pwf_teamaserver]+[llength $pwf_teambserver]]
        pwf_settopic
      }
      if { $nick == $pwf_serverholder } {
        if { $pwf_shutupchan == 0 } { 
          putserv "PRIVMSG $pwf_pickupchan :[pwf_txt cancel1] $pwf_serverholder [pwf_txt cancel3]"
          set players $pwf_teamaserver
          set players [concat $players [concat $pwf_teambserver]]
          foreach player $players {
            putserv "PRIVMSG $player :[pwf_txt cancel6]"
          }
        }
        pwf_endgame
      }
    }
    if ![info exists pwf_authnick($nick)] {
      return 0
    }
    if ![matchattr $pwf_authnick($nick) H] {
      return 0
    }
    chattr $pwf_authnick($nick) -H
    unset pwf_authnick($nick)
  }
}



proc pwf_endgame {} {
  global pwf_active pwf_maptopic pwf_playernumber pwf_serverip pwf_teamaserver pwf_teambserver pwf_serverpassword pwf_pickupchan pwf_maplock pwf_serverholder pwf_voters pwf_type pwf_maxpl pwf_defaultplayer
  set pwf_active 0
  set pwf_serverip ""
  set pwf_serverpassword ""
  set pwf_playernumber 0
  set pwf_teamaserver [list ]
  set pwf_teambserver [list ]
  set pwf_maplock 0
  set pwf_serverholder 0
  set pwf_maptopic [pwf_txt defmap]
  set pwf_voters [list ]
  set pwf_type ""
  set pwf_maxpl $pwf_defaultplayer
  pwf_setnogame
}



proc pwf_buildteams {} {
  global pwf_teamaserver pwf_teambserver pwf_teamatopic pwf_teambtopic pwf_maxpl
  set lengthteama [llength $pwf_teamaserver]
  set lengthteamb [llength $pwf_teambserver]
  set x 0
  set y 0
  set pwf_teamatopic [pwf_txt defteama]
  set pwf_teambtopic [pwf_txt defteamb]
  while {$x<$lengthteama} {
    set pwf_teamatopic "$pwf_teamatopic [lindex $pwf_teamaserver $x] -"
    incr x
  }
  while {$x<[expr $pwf_maxpl/2]} {
    set pwf_teamatopic "$pwf_teamatopic ? -"
    incr x
  }
  while {$y<$lengthteamb} {
    set pwf_teambtopic "$pwf_teambtopic [lindex $pwf_teambserver $y] -"
    incr y
  }
    while {$y<[expr $pwf_maxpl/2]} {
    set pwf_teambtopic "$pwf_teambtopic ? -"
    incr y
  }
  set endindexa [expr [string length $pwf_teamatopic ] - 2 ]
  set pwf_teamatopic [string range $pwf_teamatopic 0 $endindexa]
  set endindexb [expr [string length $pwf_teambtopic ] - 2 ]
  set pwf_teambtopic [string range $pwf_teambtopic 0 $endindexb]
}



proc pwf_launchgame {} {
  global pwf_serverip pwf_serverpassword pwf_maxpl pwf_active pwf_teamaserver pwf_teambserver pwf_serverholder pwf_pickupchan pwf_shutupchan pwf_lastgame pwf_players
  set pwf_active 0
  set limit [expr $pwf_maxpl / 2 ]
  if { $pwf_shutupchan == 0 } {
    putserv "PRIVMSG $pwf_pickupchan :[pwf_txt start1]"
  }
  set players [list ]
  foreach player $pwf_teamaserver {
    set players [linsert $players end $player]
  }
  foreach player $pwf_teambserver {
    set players [linsert $players end $player]
  }
  pwf_checkhosts $players
  set msgteama "[pwf_txt addgame1] $pwf_serverip [pwf_txt addgame2] $pwf_serverpassword [pwf_txt start2] $pwf_serverholder [pwf_txt start4]"
  set msgteamb "[pwf_txt addgame1] $pwf_serverip [pwf_txt addgame2] $pwf_serverpassword [pwf_txt start3] $pwf_serverholder [pwf_txt start4]"
  for {set x 0} { $x < $limit } {incr x} {
    set pwf_players [linsert $pwf_players end "[lindex $pwf_teamaserver $x] $msgteama"]
    set pwf_players [linsert $pwf_players end "[lindex $pwf_teambserver $x] $msgteamb"]
  }
  utimer 1 pwf_passmsg
  set pwf_lastgame "[pwf_txt lastgame1] $pwf_pickupchan: [time] [date] [pwf_txt lastgame2] $pwf_serverip"
  pwf_endgame
}



proc pwf_passmsg {} {
  global pwf_players pwf_msgdelay pwf_pickupchan
  set player [lindex [lindex $pwf_players 0] 0]
  set msg [lrange [lindex $pwf_players 0] 1 end]
  putserv "PRIVMSG $player :$msg"
  set pwf_players [lreplace $pwf_players 0 0]
  if {[llength $pwf_players] != 0} {
    utimer $pwf_msgdelay pwf_passmsg
  } else {
    putserv "PRIVMSG $pwf_pickupchan :[pwf_txt start7]"
  }
}



proc pwf_ban { nick uhost handle arg } {
  global pwf_baneduser
  if { [matchattr $handle H] } {
    set arg [pwf_charfilter $arg]
    set pwf_baneduser $arg
    putserv "PRIVMSG $nick :[pwf_txt banconf1] $pwf_baneduser [pwf_txt banconf2]"
  } else {
    putserv "NOTICE $nick :[pwf_txt noauth]"
  }
}



proc pwf_baninfo { nick uhost handle arg } {
  global pwf_pickupchan pwf_baneduser pwf_qauthnick pwf_qauthnick_timers pwf_qauth
  set ok ok
  if { $pwf_baneduser != "" } {
    if { $arg == $ok } {
      if {($pwf_qauth=="Q")||($pwf_qauth=="L")} {
        set pwf_qauthnick_timers($victime) [utimer 20 "set pwf_qauthnick($victime) 0"]
        trace variable pwf_qauthnick($victime) w pwf_bancheck
        putserv "WHOIS $victime"
      }
      set reason [pwf_txt banconf5]
      newchanban $pwf_pickupchan $pwf_baneduser $handle $reason 11340
      putserv "PRIVMSG $nick :[pwf_txt banconf3]"
      set pwf_baneduser ""
    } else {
      set pwf_baneduser ""
      putserv "PRIVMSG $nick :[pwf_txt banconf4]"
    }
  }
}



proc pwf_shaketeam { nick uhost handle channel arg } {
  global pwf_pickupchan pwf_active pwf_shutupchan pwf_teamaserver pwf_teambserver pwf_playernumber pwf_serverholder
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    if { [matchattr $handle H] } {
      if { $pwf_active == 1 } {
        set nick [pwf_charfilter $nick]
        if { ( $nick == $pwf_serverholder ) || ( [matchattr $handle m|m ] ) } {
          set players $pwf_teamaserver
          set players [concat $players [concat $pwf_teambserver]]
          if { $pwf_playernumber > 1 } {
            set newplayers [list ]
            set cycletime [llength $players]
            for {set x 0} {$x<$cycletime} {incr x} {
              set limit [llength $players]
              set random [rand $limit]
              set newplayers [linsert $newplayers end [lindex $players $random]]
              set players [lreplace $players $random $random]
            }
            set players [llength $newplayers]
            if { [expr $players % 2] == 0 } {
              set limit [expr $players / 2]
              incr limit -1
              set pwf_teamaserver [lrange $newplayers 0 $limit]
              incr limit
              set pwf_teambserver [lrange $newplayers $limit end]
            } else {
              set tempplayer [lindex $newplayers 0]
              set newplayers [lreplace $newplayers 0 0]
              incr players -1
              set limit [expr $players / 2]
              incr limit -1
              set pwf_teamaserver [lrange $newplayers 0 $limit]
              incr limit
              set pwf_teambserver [lrange $newplayers $limit end]
              lappend pwf_teamaserver $tempplayer
            }
            pwf_settopic
          } else {
            putserv "NOTICE $nick :[pwf_txt shake]"
          }
        } else {
          putserv "NOTICE $nick :[pwf_txt admin2]"
        }
      } else {
        putserv "NOTICE $nick :[pwf_txt addme3]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt noauth]"
    }
  }
}



proc pwf_enable { nick uhost handle channel arg } {
  global pwf_pickupchan pwf_shutupchan
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    if { [matchattr $handle H] } {
      if { $pwf_shutupchan == 1 } {
        set pwf_shutupchan 0
        putserv "PRIVMSG $channel :[pwf_txt enable1]"
      } else {
        putserv "NOTICE $nick :[pwf_txt enable2]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt noauth]"
    }
  }
}



proc pwf_disable { nick uhost handle channel arg } {
  global pwf_pickupchan pwf_shutupchan pwf_active
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    if { [matchattr $handle H ] } {
      if { $pwf_shutupchan == 0 } {
        if { $pwf_active == 0 } {
          set pwf_shutupchan 1
          putserv "PRIVMSG $channel :[pwf_txt disable1]"
        } elseif { [matchattr $handle m|m ] } {
          pwf_endgame
          putserv "PRIVMSG $channel :[pwf_txt disable1]"
          set pwf_shutupchan 1
        } else {
          putserv "NOTICE $nick :[pwf_txt disable4]"
        }
      } else {
        putserv "NOTICE $nick :[pwf_txt disable2]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt noauth]"
    }
  }
}



proc pwf_msgenable { nick uhost handle arg } {
  global pwf_pickupchan pwf_shutupchan
  if { [matchattr $handle H] } {
    set channel $arg
    if {[string index $channel 0] != "#"} {
      set channel "#$channel"
    }
    if { ( $pwf_shutupchan == 1 ) && ( $pwf_pickupchan == $channel ) } {
      set pwf_shutupchan 0
      putserv "PRIVMSG $channel :[pwf_txt enable1]"
    } else {
      putserv "PRIVMSG $nick :[pwf_txt enable3]"
    }
  } else {
    putserv "NOTICE $nick :[pwf_txt noauth]"
  }
}



proc pwf_msgdisable { nick uhost handle arg } {
  global pwf_pickupchan pwf_shutupchan pwf_active
  if { [matchattr $handle H] } {
    set channel $arg
    if {[string index $channel 0] != "#"} {
      set channel "#$channel"
    }
    if { ( $pwf_shutupchan == 0 ) && ( $pwf_pickupchan == $channel ) } {
      putserv "PRIVMSG $channel :[pwf_txt disable1]"
      if { $pwf_active == 1 } {
        pwf_endgame
      }
      set pwf_shutupchan 1
    } else {
      putserv "PRIVMSG $nick :[pwf_txt disable3]"
    }
  } else {
    putserv "NOTICE $nick :[pwf_txt noauth]"
  }
}



proc pwf_addadmin {nick uhost hand channel rest} {
  global pwf_pickupchan pwf_qauthnick pwf_qauthnick_timers pwf_qauth
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    set rest [pwf_charfilter $rest]
    set victime [lindex $rest 0]
    if { [matchattr $hand H] } {
      if [matchattr $hand m|m $channel] {
        if [onchan $victime $channel] {
          if {($pwf_qauth=="Q")||($pwf_qauth=="L")} {
            set pwf_qauthnick_timers($victime) [utimer 20 "set pwf_qauthnick($victime) 0"]
            trace variable pwf_qauthnick($victime) w pwf_addadmincheck
            putserv "WHOIS $victime"
          }
          set victhand [nick2hand $victime]
          if [string compare $victhand "*"] {
            if [matchattr $victhand G|G $channel] {
              putserv "NOTICE $nick :[pwf_txt right1]"
            } else {
              chattr $victhand +|GY $channel
              putserv "NOTICE $nick :[pwf_txt right2] $victime"
              putserv "NOTICE $victime :[pwf_txt right3] $channel [pwf_txt right4a]"
              return 1
            }
          } else {
            adduser $victime [maskhost [getchanhost $victime $channel]]
            chattr [nick2hand $victime] +|GY $channel
            putserv "NOTICE $nick :[pwf_txt right2] $victime"
            putserv "NOTICE $victime :[pwf_txt right3] $channel [pwf_txt right4b]"
            return 1
          }
        } else {
          putserv "NOTICE $nick :[pwf_txt right5]"
        }
      } else {
        putserv "NOTICE $nick :[pwf_txt right6]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt noauth]"
    }
  }
}



proc pwf_removeadmin {nick uhost hand channel rest} {
  global pwf_pickupchan pwf_qauthnick pwf_qauthnick_timers pwf_qauth
  set channel [string tolower $channel]
  if { $channel == $pwf_pickupchan } {
    set rest [pwf_charfilter $rest]
    set victime [lindex $rest 0]
    if { [matchattr $hand H] } { 
      if [matchattr $hand m|m $channel] {
        if [onchan $victime $channel] {
          set victhand [nick2hand $victime]
          if {[getuser $victhand info]!=""} {
            if {($pwf_qauth=="Q")||($pwf_qauth=="L")} {
              putserv "PRIVMSG $pwf_qauth :chanlev $pwf_pickupchan #[getuser $victhand info] -ao"
            }
          }
          if [matchattr $victhand &G $channel] {
            chattr $victhand |-GYZ $channel
            putserv "NOTICE $nick :[pwf_txt right7] $victime"
            putserv "NOTICE $victime :[pwf_txt right8]"
            return 1
          } else {
            putserv "NOTICE $nick :[pwf_txt right9]"
          }
        } else {
          if [validuser $victime] {
            if [matchattr $victime &|G $channel] {
              chattr $victime |-GYZ $channel
              putserv "NOTICE $nick :[pwf_txt right7] $victime"
              return 1
            } else {
              putserv "NOTICE $nick :[pwf_txt right9]"
            }
          } else {
            putserv "NOTICE $nick :[pwf_txt right9]"
          }
        }
      } else {
        putserv "NOTICE $nick :[pwf_txt right0]"
      }
    } else {
      putserv "NOTICE $nick :[pwf_txt noauth]"
    }
  }
}



proc pwf_remoldflag {} {
  global pwf_pickupchan pwf_authnick
  foreach pwf_handlecheck [userlist H] {
    set pwf_nickcheck [hand2nick $pwf_handlecheck $pwf_pickupchan]
    if { ( $pwf_nickcheck == "" ) || ( ![info exists pwf_authnick($pwf_nickcheck)] ) } {
      chattr $pwf_handlecheck -H
      if { [info exists pwf_authnick($pwf_nickcheck)] } {
        unset pwf_authnick($pwf_nickcheck)
      }
    }
  }
}



proc pwf_isauth { nick chan } {
  global pwf_authnick
  if ![info exists pwf_authnick($nick)] { return "" }
    if [matchattr $pwf_authnick($nick) G|G $chan] {
      if [matchattr $pwf_authnick($nick) H] {
        return $pwf_authnick($nick)
      }
    }
  return ""
}



proc pwf_auth {nick uhost hand rest} {
  global pwf_authnick pwf_pickupchan
  set nick [pwf_charfilter $nick]
  set handle hand
  set pw [lindex $rest 0]
  set givenick [lindex $rest 1]
  if [string length $givenick] {
    set hand $givenick
  } else {
    if ![string compare $hand "*"] {
      putserv "NOTICE $nick :[pwf_txt auth1]"
      return 0
    }
  }
  if [lsearch -exact [userlist G|G] $hand]==-1 {
    putserv "NOTICE $nick :[pwf_txt auth2] $hand"
    return 0
  }
  set ok 0
  if [onchan $nick $pwf_pickupchan] {
     set ok 1
  }
  if !$ok {
    putserv "NOTICE $nick :[pwf_txt auth3] $pwf_pickupchan [pwf_txt auth4]"
    return 0
  }
  if [info exists pwf_authnick($nick)] {
    putserv "NOTICE $nick :[pwf_txt auth5] $pwf_authnick($nick)."
    return 0
  }
  if ![string length $pw] {
    putserv "NOTICE $nick :[pwf_txt auth6]"
    return 0
  }
  if [passwdok $hand ""] {
    putserv "NOTICE $nick :[pwf_txt auth7]"
    return 0
  }
  if [passwdok $hand $pw] {
    chattr $hand +H
    set pwf_authnick($nick) $hand
    putserv "NOTICE $nick :[pwf_txt auth8]"
    putcmdlog "($nick!$uhost) !$hand! admin ..."
  } else {
    putserv "NOTICE $nick :[pwf_txt auth9]"
    putcmdlog "($nick!$uhost) !$hand! FAILED admin"
  }
}


proc pwf_tchk {} {
  global pwf_timeoutdelay pwf_authnick pwf_pickupchan
  timer 2 pwf_tchk
  set inactnicks ""
  set actnicks ""
  set chan $pwf_pickupchan
  foreach nick [chanlist $chan] {
    if [string length [pwf_isauth $nick $chan]] {
      set inactindex [lsearch -exact $inactnicks $nick]
      set actindex [lsearch -exact $actnicks $nick]
      if [getchanidle $nick $chan]>$pwf_timeoutdelay {
        if ($inactindex==-1)&&($actindex==-1) {
          lappend inactnicks $nick
        }
      } else {
        if ($actindex!=-1) {
          lappend actnicks $nick
        }
        set inactnicks [lreplace $inactnicks $inactindex $inactindex]
      }
    }
  }
  foreach nick $inactnicks {
    chattr $pwf_authnick($nick) -H
    unset pwf_authnick($nick)
    putserv "NOTICE $nick :[pwf_txt auth0]"
  }
}



proc pwf_botop {nick host handle channel mode victim} {
  global pwf_qauth pwf_qauthname pwf_qauthpass botnick
  if {$victim==$botnick} {
    if {($pwf_qauth=="Q")||($pwf_qauth=="L")} {
      putserv "PRIVMSG Q@CServe.quakenet.org :auth $pwf_qauthname $pwf_qauthpass"
    }
  }
}



proc pwf_qneedop {} {
  global pwf_qauth pwf_pickupchan pwf_qauthname pwf_qauthpass botnick
  timer 5 pwf_qneedop
  if {($pwf_qauth=="Q")||($pwf_qauth=="L")} {
    if {![onchan $botnick $pwf_pickupchan] || [botisop $pwf_pickupchan]} {return 0}
    if { [onchan $pwf_qauth $pwf_pickupchan] && [isop $pwf_qauth $pwf_pickupchan] } {
      putserv "PRIVMSG Q@CServe.quakenet.org :auth $pwf_qauthname $pwf_qauthpass"
      putserv "PRIVMSG $pwf_qauth :OP $pwf_pickupchan"
      return 0
    }
  }
}



proc pwf_qinvite {a b c} {
 global pwf_qqueue2 pwf_qauth pwf_pickupchan pwf_qauthnick pwf_qauthpass botnick
 set channel [string tolower [lindex $c 1]]
 if {[info exists pwf_qqueue2($channel)]} {
  if {[expr [unixtime] - $pwf_qqueue2($channel)] < 180} {
   return 0
  }
 }
 set pwf_qqueue2($channel) [unixtime]
 if {($pwf_qauth=="Q")||($pwf_qauth=="L")} {
  if { $channel == $pwf_pickupchan } {
    putserv "PRIVMSG Q@CServe.quakenet.org :auth $pwf_qauthnick $pwf_qauthpass"
    putserv "PRIVMSG $pwf_qauth :invite $pwf_pickupchan"
    return 0
  }
 }
}



proc pwf_qunban {a b c} {
 global pwf_qqueue1 pwf_qauth pwf_pickupchan pwf_qauthnick pwf_qauthpass botnick
 set channel [string tolower [lindex $c 1]]
 if {[info exists pwf_qqueue1($channel)]} {
  if {[expr [unixtime] - $pwf_qqueue1($channel)] < 160} {
   return 0
  }
 }
 set pwf_qqueue1($channel) [unixtime]
 if {($pwf_qauth=="Q")||($pwf_qauth=="L")} {
  if { $channel == $pwf_pickupchan } {
    putserv "PRIVMSG Q@CServe.quakenet.org :auth $pwf_qauthnick $pwf_qauthpass"
    putserv "PRIVMSG $pwf_qauth :unbanall $pwf_pickupchan"
    return 0
  }
 }
}



proc pwf_qauthnick {a b c} {
  global pwf_qauthnick pwf_qauthnick_timers
  set c [pwf_charfilter $c]
  set nick [lindex $c 1]
  set authnick [lindex $c 5]
  killutimer $pwf_qauthnick_timers($nick)
  unset pwf_qauthnick_timers($nick)
  set pwf_qauthnick($nick) $authnick
}



proc pwf_txt { txt } {
  global pwf_reply pwf_langok
  if { [info exists pwf_langok] } {
    return $pwf_reply($txt)
  } else {
    return $pwf_reply(wait)
  }
}



proc pwf_giveadmin {nick uhost handle arg} {
  global pwf_authnick
  if { [llength [userlist G|G]] == 0 } {
    chattr $handle +GH
    set pwf_authnick($nick) $handle
    putserv "PRIVMSG $nick :[pwf_txt auth8]"
  }
}



proc pwf_readfile {} {
  global pwf_stats pwf_playerhosts pwf_voiced
  set fd [open pwf_stats r]
  set pwf_stats [gets $fd]
  close $fd
  set fd [open pwf_hosts r]
  set pwf_playerhosts [gets $fd]
  close $fd
  set fd [open pwf_voice r]
  set pwf_voiced [gets $fd]
  close $fd
}



proc pwf_addadmin2 {hand idx args} {
  global pwf_pickupchan pwf_qauthnick pwf_qauthnick_timers pwf_qauth
  set args [pwf_charfilter $args]
  set victime [lindex $args 0]
  if [onchan $victime $pwf_pickupchan] {
    if {($pwf_qauth=="Q")||($pwf_qauth=="L")} {
      set pwf_qauthnick_timers($victime) [utimer 20 "set pwf_qauthnick($victime) 0"]
      trace variable pwf_qauthnick($victime) w pwf_addadmincheck
      putserv "WHOIS $victime"
    }
    set victhand [nick2hand $victime]
    if [string compare $victhand "*"] {
      if [matchattr $victhand G|G $pwf_pickupchan] {
        putlog "[pwf_txt right1]"
      } else {
        chattr $victhand +|GY $pwf_pickupchan
        putlog "[pwf_txt right2] $victime"
        putserv "NOTICE $victime :[pwf_txt right3] $pwf_pickupchan [pwf_txt right4a]"
        return 1
      }
    } else {
      adduser $victime [maskhost [getchanhost $victime $pwf_pickupchan]]
      chattr [nick2hand $victime] +|Gfo $pwf_pickupchan
      chattr [nick2hand $victime] -fv
      putlog "[pwf_txt right2] $victime"
      putserv "NOTICE $victime :[pwf_txt right3] $pwf_pickupchan [pwf_txt right4b]"
      return 1
    }
  } else {
    putlog "[pwf_txt right5]"
  }
}



proc pwf_addadmincheck {variable nick cmd} {
  global pwf_pickupchan pwf_qauthnick pwf_qauthnick_timers pwf_qauth
  if {$pwf_qauthnick($nick) == 0} {
    unset pwf_qauthnick_timers($nick)
  } else {
    setuser [nick2hand $nick] info $pwf_qauthnick($nick)
    putserv "PRIVMSG $pwf_qauth :chanlev $pwf_pickupchan #$pwf_qauthnick($nick) +ao"
  }
  putserv "MODE $pwf_pickupchan +o $nick"
  unset pwf_qauthnick($nick)
}



proc pwf_bancheck {variable nick cmd} {
  global pwf_pickupchan pwf_qauthnick pwf_qauthnick_timers pwf_qauth
  if {$pwf_qauthnick($nick) == 0} {
    unset pwf_qauthnick_timers($nick)"
  } else {
    putserv "PRIVMSG $pwf_qauth :chanlev $pwf_pickupchan #$pwf_qauthnick($nick) +b"
  }
  unset pwf_qauthnick($nick)
}



proc pwf_adminstats {hand idx args} {
  global pwf_stats
  if {[llength $pwf_stats]==0} {
    putlog "No stats yet for this month"
    return 0
  }
  set stats $pwf_stats
  set results [list ]
  while {[llength $stats]!=0} {
    set match [lindex $stats 0]
    set counter 0
    set temp [list ]
    set temp [linsert $temp end $match]
    while {[lsearch -exact $stats $match]>-1} {
      incr counter
      set pos [lsearch -exact $stats $match]
      set stats [lreplace $stats $pos $pos]
    }
    set temp [linsert $temp end $counter]
    set results [linsert $results end $temp]
  }
  set results [lsort -integer -decreasing -index 1 $results]
  set counter 1
  foreach result $results {
    putlog "$counter. [lindex $result 0] with [lindex $result 1] pickups"
    incr counter
  }
}



proc pwf_checkhosts {pwf_players} {
  global pwf_playerhosts pwf_pickupchan pwf_qauthnick pwf_qauthnick_timers pwf_qauth pwf_pickupnumber
  set allhosts $pwf_playerhosts
  foreach nick $pwf_players {
    set host [getchanhost $nick $pwf_pickupchan]
    set maskedhost [maskhost $host]
    set counter 0
    while {[lsearch -exact $allhosts $maskedhost]>-1} {
      incr counter
      set pos [lsearch -exact $allhosts $maskedhost]
      set allhosts [lreplace $allhosts $pos $pos]
    }
    if {$counter>$pwf_pickupnumber} {
      break
    } elseif {$counter==$pwf_pickupnumber} {
      if {($pwf_qauth=="Q")||($pwf_qauth=="L")} {
        set pwf_qauthnick_timers($nick) [utimer 20 "set pwf_qauthnick($nick) 0"]
        trace variable pwf_qauthnick($nick) w pwf_addvoice
        putserv "WHOIS $nick"
      } else {
        set pwf_playerhosts [linsert $pwf_playerhosts end $maskedhost]
      }
    } elseif {$counter<$pwf_pickupnumber} {
      set pwf_playerhosts [linsert $pwf_playerhosts end $maskedhost]
    }
  }
  set fileio [open pwf_hosts "w"]
  puts $fileio $pwf_playerhosts
  close $fileio
}



proc pwf_addvoice {variable nick cmd} {
  global pwf_pickupchan pwf_qauthnick pwf_qauthnick_timers pwf_qauth pwf_voiced pwf_playerhosts
  if {$pwf_qauthnick($nick) == 0} {
    unset pwf_qauthnick_timers($nick)
  } else {
    set host [maskhost [getchanhost $nick $pwf_pickupchan]]
    set pwf_playerhosts [linsert $pwf_playerhosts end $host]
    if {[lsearch -exact $pwf_voiced $pwf_qauthnick($nick)]==-1} {
      set pwf_voiced [linsert $pwf_voiced end $pwf_qauthnick($nick)]
      putserv "PRIVMSG $pwf_qauth :chanlev $pwf_pickupchan #$pwf_qauthnick($nick) +av"
      set fileio [open pwf_voice "w"]
      puts $fileio $pwf_voiced
      close $fileio
      set fileio [open pwf_hosts "w"]
      puts $fileio $pwf_playerhosts
      close $fileio
    }
  }
  unset pwf_qauthnick($nick)
}



proc pwf_resetvoice {minute hour day month year} {
  global pwf_voiced pwf_playerhosts pwf_qauth pwf_pickupchan pwf_accessrestar
  if {$pwf_accessrestart==0} {
    return 0
  }
  if {($pwf_qauth=="Q")||($pwf_qauth=="L")} {
    foreach user $pwf_voiced {
      putserv "PRIVMSG $pwf_qauth :chanlev $pwf_pickupchan #$user -av"
    }
  }
  set pwf_voiced [list ]
  set pwf_playerhosts [list ]
  set fileio [open pwf_voice "w"]
  puts $fileio $pwf_voiced
  close $fileio
  set fileio [open pwf_hosts "w"]
  puts $fileio $pwf_playerhosts
  close $fileio
}



proc pwf_resetop {minute hour day month year} {
  global pwf_qauth pwf_pickupchan pwf_stats pwf_accessrestart
  if {$pwf_accessrestart==0} {
    return 0
  }
  if {($pwf_qauth=="Q")||($pwf_qauth=="L")} {
    foreach user [userlist G] {
      if {![matchattr $user m|m]} {
        if {([lsearch -exact $pwf_stats $user]==-1)&&([getuser $user info]!="")} {
          putserv "PRIVMSG $pwf_qauth :chanlev $pwf_pickupchan #[getuser $user info] -ao"
        }
      }
    }
  }
  set pwf_stats [list ]
  set fileio [open pwf_stats "w"]
  puts $fileio $pwf_stats
  close $fileio
}



proc pwf_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
}



## You can easyly translate and edit all the msg the bot reply here ( utimer is used to wait for the value of $botnick , do not use variable wich are not glabal )  


set pwf_reply(wait) "Please wait during language initialisation. Try again in some seconds ( 20 secs max )"


utimer 20 {
if $pwf_language==1 {
set pwf_reply(addme1) "4Invalid team 14( try a team using [string trim $pwf_trigger]addme a or b )"
set pwf_reply(addme2) "14Sorry but the current game is a ** VIP ** match, only voiced users and opers can add themselves."
set pwf_reply(addme3) "4There is no match for the moment."
set pwf_reply(addme4) "14Match are disable on this chan."
set pwf_reply(addme5) "4I can't find you in any team."
set pwf_reply(vote1) "Vote Recorded"
set pwf_reply(vote2) "4This map is not in my database or you already voted for it."
set pwf_reply(vote3) "7The most voted map is now"
set pwf_reply(vote4) "4Map has been set by the pickup admin, votes are disabled."
set pwf_reply(vote5) "4You have to be in a valid team to vote for a map."
set pwf_reply(vote6) "5The top3 maps are:"
set pwf_reply(ip1) "5The next match will start on"
set pwf_reply(ip2) "5Check your ping..."
set pwf_reply(admin1) "4Ambiguous command, use [string trim $pwf_trigger]addmap <map>"
set pwf_reply(admin2) "4You are not the administror of this match."
set pwf_reply(admin3) "4Ambiguous number, use [string trim $pwf_trigger]playernumber <number>"
set pwf_reply(admin4) "4Invalid player number. Please enter a event numbers."
set pwf_reply(admin5) "4Invalid player number. You can't set a number less than the actual number of player for the pickup."
set pwf_reply(addgame1) "14IP :"
set pwf_reply(addgame2) "- Password :"
set pwf_reply(addgame3) "- ** VIP **"
set pwf_reply(addgame4) "- If these informations are correct, use /msg $botnick [string trim $pwf_trigger]info ok , if not use /msg $botnick [string trim $pwf_trigger]info wrong"
set pwf_reply(addgame5) "5The last match was a 14** VIP ** game, you can't launch an other one now. Please use [string trim $pwf_trigger]addgame again."
set pwf_reply(addgame6) "14A pickup is currently running on the channel and is managed by"
set pwf_reply(addgame7) "14, try again it will be finished."
set pwf_reply(addgame8) "14You have to enter both : <ip:port> AND <password> . Please use [string trim $pwf_trigger]addgame command again."
set pwf_reply(addgame9) "14Ok, thank you for confirming, your game is now launched"
set pwf_reply(addgame0) "14Your server info are now deleted, please use the /msg $botnick [string trim $pwf_trigger]addgame <ip:port> <password> command again"
set pwf_reply(addgame10) "14You can't launch a new match now because the pickups have been disabled on"
set pwf_reply(addgame11) "5Pickup launched on"
set pwf_reply(addgame12) "Go subscribe !"
set pwf_reply(noauth) "You are not authenticated, use /msg $botnick [string trim $pwf_trigger]admin <password>"
set pwf_reply(help1) "Public Channel commands are : [string trim $pwf_trigger]add <team> - [string trim $pwf_trigger]remove - [string trim $pwf_trigger]votemap <map> - [string trim $pwf_trigger]topmaps - [string trim $pwf_trigger]ip - [string trim $pwf_trigger]teams - [string trim $pwf_trigger]lastgame"
set pwf_reply(help2) "Admins Channel commands are : [string trim $pwf_trigger]addmap <map> - [string trim $pwf_trigger]addtype <type> - [string trim $pwf_trigger]playernumber <number> - [string trim $pwf_trigger]enable - [string trim $pwf_trigger]disable- [string trim $pwf_trigger]shake - [string trim $pwf_trigger]move <player1> <player2>"
set pwf_reply(help3) "Admins Private commands are : [string trim $pwf_trigger]addgame <ip:port> <password> - [string trim $pwf_trigger]info <ok> - [string trim $pwf_trigger]endgame - [string trim $pwf_trigger]ban <mask> - [string trim $pwf_trigger]baninfo <ok>"
set pwf_reply(help4) "Admins don't forget to authenticate yourself before using commands by typing /msg $botnick [string trim $pwf_trigger]admin <password>"
set pwf_reply(help5) "Don't be lame and enjoy your pickup."
set pwf_reply(help6) "More info about this script :"
set pwf_reply(cancel1) "4The server admin ("
set pwf_reply(cancel2) ") cancelled the game :("
set pwf_reply(cancel3) ") left the channel, the game is cancelled :("
set pwf_reply(cancel4) "14You try to cancel a game but no games are launched."
set pwf_reply(cancel5) "14You are not the Server-Holder of the current game, you can't end it."
set pwf_reply(cancel6) "4The pickup you subscribed to has been cancelled :("
set pwf_reply(deauthpart) "Auto-deauthentication after a channel part."
set pwf_reply(deauthkick) "Auto-deauthentication after a channel kick."
set pwf_reply(start1) "4Match Starting, please wait during password forwarding... ( if you subscribed this match, check your private messages, this may take some time. DO NOT RENAME NOW )"
set pwf_reply(start2) "14- You are in team 4A14 - Your admin is4"
set pwf_reply(start3) "14- You are in team 4B14 - Your admin is4"
set pwf_reply(start4) "14- GO GO GO connect to the server NOW"
set pwf_reply(start5) "5Add you to"
set pwf_reply(start6) "more people needed !!"
set pwf_reply(start7) "4Ip and password have been sent to every player, if you didn't receive it plz contact the admin."
set pwf_reply(banconf1) "14Ban this mask for life :"
set pwf_reply(banconf2) "? ( use /msg $botnick [string trim $pwf_trigger]baninfo ok to confirm )"
set pwf_reply(banconf3) "14Ok , user is now banned :/"
set pwf_reply(banconf4) "14Ban cancelled, use /msg $botnick [string trim $pwf_trigger]ban again."
set pwf_reply(banconf5) "pickup-lamer successfully removed"
set pwf_reply(enable1) "4Pickups are now enabled on this channel."
set pwf_reply(enable2) "14This channel is already enabled."
set pwf_reply(enable3) "4This channel is not in my channel database or this chan is already enabled."
set pwf_reply(disable1) "4Pickups are now disabled on this channel."
set pwf_reply(disable2) "14This chan is already disabled."
set pwf_reply(disable3) "4This channel is not in my channel database or this chan is already disabled."
set pwf_reply(disable4) "14You cannot disable a chan where a pickup is launching if you are not a channel master."
set pwf_reply(right1) "14The user you are trying to add a Game-Admin acces already have one."
set pwf_reply(right2) "14You just added a Game-Admin access to :"
set pwf_reply(right3) "4Congratulations, you now have the Game-Admin access on"
set pwf_reply(right4a) "14 You can authenticate yourself using: /msg $botnick [string trim $pwf_trigger]admin <password> . Help available on /msg $botnick [string trim $pwf_trigger]help. If you are not auth in Q, please do it now to complete your registration."
set pwf_reply(right4b) "14 You should specify a password immediatly using: /msg $botnick pass <password> . You can then authenticate yourself using: /msg $botnick [string trim $pwf_trigger]admin <password> . Help available on /msg $botnick [string trim $pwf_trigger]help . If you are not auth in Q, please do it now to complete your registration."
set pwf_reply(right5) "14The user you are trying to add a Game-Admin acces is not on the channel for the moment."
set pwf_reply(right6) "14You are authenticated, but you don't have the required rights to add a new Game-Admin access."
set pwf_reply(right7) "14You have removed Game-Admin access to"
set pwf_reply(right8) "4You Game-Admin access has been removed. 14You won't be able to use commands anymore on"
set pwf_reply(right9) "14This user dont't have Game-Admin access."
set pwf_reply(right0) "14You are authenticated, but you don't have the rights to remove a Game-Admin access."
set pwf_reply(auth1) "14You aren't recognized by the bot. Maybe you changed your ident@host. Please contact an operator."
set pwf_reply(auth2) "14You are recognized, but you don't have the Game-Admin access. Please contact an operator. I know you as:"
set pwf_reply(auth3) "14You have to be on"
set pwf_reply(auth4) "to authenticate yourself."
set pwf_reply(auth5) "14You are already authenticated as a Game-Admin with the nick"
set pwf_reply(auth6) "14Syntax : /msg $botnick [string trim $pwf_trigger]admin <password>"
set pwf_reply(auth7) "4You don't have any password set.14 Type /msg $botnick pass <password>"
set pwf_reply(auth8) "14You are now authenticated as a Game-Admin."
set pwf_reply(auth9) "4Authentication failed ... logged !"
set pwf_reply(auth0) "14Your Game-Admin authentication has been removed automatcly because of your idleness."
set pwf_reply(rehash) "4database has been restarted, sorry for the disturbance."
set pwf_reply(welcome) "Welcome"
set pwf_reply(topic1) "7Ready for next match 1-2 Admin is"
set pwf_reply(topic2) "1-3"
set pwf_reply(topic4) "1-10 Game Type :"
set pwf_reply(topic5) "1- 14** VIP GAME **"
set pwf_reply(teams1) "2 Currently :3"
set pwf_reply(separator) "1-"
set pwf_reply(separator2) "1-10"
set pwf_reply(defteama) "5Team A : 2"
set pwf_reply(defteamb) "5Team B : 2"
set pwf_reply(defteama2) "5Team A :2 ? - ? - ? - ? - ? -"
set pwf_reply(defteamb2) "5Team B :2 ? - ? - ? - ? - ?"
set pwf_reply(defmap) "Map not defined yet"
set pwf_reply(misc1) "topicmem : could not edit the topic file of"
set pwf_reply(lastgame1) "5Last game on"
set pwf_reply(lastgame2) "1- 5On the server:"
set pwf_reply(lastgame3) "5I don't have informations about the last game in my memory."
set pwf_reply(version) "14Script version:"
set pwf_reply(shake) "14Can't shake, there must be 2 players or more to shake."
set pwf_reply(move1) "14This player is not in the teams or the other team is full."
set pwf_reply(move2) "14At least one of the 2 players is not in a team or the 2 players are in the same team."
} elseif $pwf_language==2 {
set pwf_reply(addme1) "4Team invalide 14( essayez une team avec [string trim $pwf_trigger]addme a ou b )"
set pwf_reply(addme2) "14Désoler mais le jeu actuel est un match ** VIP ** , seuls les utilisateurs voice ou op peuvent s'ajouter."
set pwf_reply(addme3) "4Aucun pickup pour l'instant."
set pwf_reply(addme4) "14Les pickups sont actuellement désactivés sur ce channel."
set pwf_reply(addme5) "4Je ne vous ai trouvé dans aucune team."
set pwf_reply(vote1) "Vote enrégistré"
set pwf_reply(vote2) "4Cette map n'est pas dans ma base de donnée ou vous avez déjà votée pour cette map."
set pwf_reply(vote3) "7La map la plus sollicitée est maintenant"
set pwf_reply(vote4) "4La map a été choisie par l'administeur de ce pickup, les votes sont désactivés."
set pwf_reply(vote5) "4Vous devez être dans une team pour pouvoir voter."
set pwf_reply(vote6) "5Les 3 maps les plus votées sont:"
set pwf_reply(ip1) "5Le prochain match se jouera sur"
set pwf_reply(ip2) "5Testez votre ping..."
set pwf_reply(admin1) "4Commande ambiguë, utilisez [string trim $pwf_trigger]addmap <map>"
set pwf_reply(admin2) "4Vous n'êtes pas l'administrateur de ce pickup."
set pwf_reply(admin3) "4Commande ambiguë, utlisez [string trim $pwf_trigger]playernumber <nombre>"
set pwf_reply(admin4) "4Nombre de joueurs invalide. N'utilisez que des nombres pairs svp"
set pwf_reply(admin5) "4Nombre de joueurs invalide. Vous ne pouvez pas entrer un nombre de joueurs inférieure au nombre de joueurs actuels pour le match."
set pwf_reply(addgame1) "14IP :"
set pwf_reply(addgame2) "- Mot-de-Passe :"
set pwf_reply(addgame3) "- ** VIP **"
set pwf_reply(addgame4) "- Si ces informations sont correctent, utilisez /msg $botnick [string trim $pwf_trigger]info ok , sinon utilisez /msg $botnick [string trim $pwf_trigger]info erreure"
set pwf_reply(addgame5) "5Le dernier pickup était déja un match 14** VIP **, vous ne pouvez pas en lancer un nouveau maintenant. Veuillez utilisez [string trim $pwf_trigger]addgame à nouveau."
set pwf_reply(addgame6) "14Un match est déjà en cour sur le channel et est administrer par"
set pwf_reply(addgame7) "14, réessayez quand celui ci sera termniné."
set pwf_reply(addgame8) "14Commande ambiguë, vous devez entrer <ip:port> ET <mot-de-passe> . Veuillez utilisez [string trim $pwf_trigger]addgame à nouveau."
set pwf_reply(addgame9) "14Ok, merci d'avoir confirmé, votre match est lancé."
set pwf_reply(addgame0) "14Les informations que vous avez entré ont été effacées, utilisez la commande /msg $botnick [string trim $pwf_trigger]addgame <ip:port> <mot-de-passe> à nouveau."
set pwf_reply(addgame10) "14Vous ne pouvez pas lancer de nouveau match pour le moment car les pickup ont été désactivés sur"
set pwf_reply(addgame11) "5Un pickup vient d'être lancé sur"
set pwf_reply(addgame12) "Inscrivez-vous !"
set pwf_reply(noauth) "14Vous n'êtes pas authentifié, utilisez /msg $botnick [string trim $pwf_trigger]admin <mot-de-passe>"
set pwf_reply(help1) "Commandes Publiques sur le channel : [string trim $pwf_trigger]add <team> - [string trim $pwf_trigger]remove - [string trim $pwf_trigger]votemap <map> - [string trim $pwf_trigger]topmaps - [string trim $pwf_trigger]ip - [string trim $pwf_trigger]teams - [string trim $pwf_trigger]lastgame"
set pwf_reply(help2) "Commandes des Admins sur le channel : [string trim $pwf_trigger]addmap <map> - [string trim $pwf_trigger]addtype <type> - [string trim $pwf_trigger]playernumber <nombre> - [string trim $pwf_trigger]enable - [string trim $pwf_trigger]disable - [string trim $pwf_trigger]shake - [string trim $pwf_trigger]move <player1> <player2>"
set pwf_reply(help3) "Commandes des Admins en privé : [string trim $pwf_trigger]addgame <ip:port> <password> - [string trim $pwf_trigger]info <ok> - [string trim $pwf_trigger]endgame - [string trim $pwf_trigger]ban <mask> - [string trim $pwf_trigger]baninfo <ok>"
set pwf_reply(help4) "Pour les Admins, n'oubliez pas de vous authentifier pour utiliser les commandes en tapant /msg $botnick [string trim $pwf_trigger]admin <mot-de-passe>"
set pwf_reply(help5) "Respectez les autres joueurs et amusez vous bien."
set pwf_reply(help6) "Pour plus d'informations à propos de ce script :"
set pwf_reply(cancel1) "4L'administrateur du match ("
set pwf_reply(cancel2) ") a annulé le pickup :("
set pwf_reply(cancel3) ") a quitté le channel, le match est donc annulé :("
set pwf_reply(cancel4) "14Vous essayez d'annuler un match en cour mais il n'y en a aucun."
set pwf_reply(cancel5) "14Vous n'êtes pas le Server-Holder de ce match, vous ne pouvez pas annuler le match."
set pwf_reply(cancel6) "4Le pickup pour lequel vous vous étiez enrégistré a été annulé :("
set pwf_reply(deauthpart) "14Désauthentification automatique après avoir quitter le channel."
set pwf_reply(deauthkick) "14Désauthentification automatique après avoir été kicker."
set pwf_reply(start1) "4Le match va maintenant commencer, veillez patienter pendant l'envoi du mot-de-passe... ( si vous êtes inscris pour ce match, vérifiez vos messages privés. Ceci peut prendre un peu de temps )"
set pwf_reply(start2) "14- Vous êtes dans l'équipe 4A14 - Votre admin est4"
set pwf_reply(start3) "14- Vous êtes dans l'équipe 4B14 - Votre admin est4"
set pwf_reply(start4) "14- GO GO GO connectez le serveur maintenant."
set pwf_reply(start5) "5Ajoutez vous sur"
set pwf_reply(start6) "personnes pour démarrer le match !!"
set pwf_reply(start7) "4L'ip et le mot de passe ont été envoyés à tous les joueurs, si vous ne l'avez pas reçu contactez votre admin."
set pwf_reply(banconf1) "14Bannir ce mask de façon permanente :"
set pwf_reply(banconf2) "? ( utilisez /msg $botnick [string trim $pwf_trigger]baninfo ok pour confirmer )"
set pwf_reply(banconf3) "14Ok, l'utilisateur est banni de façon permanente :/"
set pwf_reply(banconf4) "14Ban annulé, utilisez /msg $botnick [string trim $pwf_trigger]ban à nouveau."
set pwf_reply(banconf5) "pickup-lamer successfully removed"
set pwf_reply(enable1) "4Les pickups sont maintenant actifs sur ce channel."
set pwf_reply(enable2) "14Ce channel est déjà activé."
set pwf_reply(enable3) "4Ce channel n'est pas dans ma base de donnée ou ce channel est déjà activé."
set pwf_reply(disable1) "4Les pickups sont maintenant désactivés sur ce channel."
set pwf_reply(disable2) "14Ce channel est déjà désactivé."
set pwf_reply(disable3) "4Ce channel n'est pas dans ma base de donnée ou ce channel est déjà désactivé."
set pwf_reply(disable4) "14Vous ne pouvez pas désactiver ce channel si vous n'êtes pas master de celui-ci."
set pwf_reply(right1) "14L'utilisateur pour lequel vous essayez d'ajouter l'accès Game-Admin l'a déjà."
set pwf_reply(right2) "14Vous avez donné l'accès Game-Admin à"
set pwf_reply(right3) "4Félicitation, vous êtes maintenant un Game-Admin sur"
set pwf_reply(right4a) "14 Vous pouvez vous authentifier en utilisant: /msg $botnick [string trim $pwf_trigger]admin <mot-de-passe> . Si vous avez besoin d'aide tapez /msg $botnick [string trim $pwf_trigger]help . Si vous n'êtes pas authentifié dans Q, faites le maintenant pour compléter votre enrégistrement."
set pwf_reply(right4b) "14 Vous devriez définir votre mot de passe en utilisant: /msg $botnick pass <mot-de-passe> . Vous pourrez ensuite vous authentifier avec: /msg $botnick [string trim $pwf_trigger]admin <mot-de-passe> . Si vous avez besoin d'aide tapez /msg $botnick [string trim $pwf_trigger]help . Si vous n'êtes pas authentifié dans Q, faites le maintenant pour compléter votre enrégistrement."
set pwf_reply(right5) "14L'utilisateur pour lequel vous tentez d'ajouter un accès Game-Admin n'est pas sur le channel pour l'instant."
set pwf_reply(right6) "14Vous êtes authentifié mais vous n'avez pas les droits pour ajouter un nouvel accès Game-Admin."
set pwf_reply(right7) "14Vous avez effacer l'acces Game-Admin de"
set pwf_reply(right8) "4Votre accès Game-Admin vous a été supprimer, vous ne pouvez plus utilisés les commandes d'administration sur"
set pwf_reply(right9) "14Cet utilisateur n'a pas d'accès Game-Admin."
set pwf_reply(right0) "14Vous êtes authentifié mais vous n'avez pas les droits pour supprimer un accès Game-Admin."
set pwf_reply(auth1) "14Vous n'êtes pas reconnu, peut-être avez vous modifié votre ident@host. Veuillez contacter un opérateur."
set pwf_reply(auth2) "14Vous êtes reconnu, mais vous n'avez pas d'accès Game-Admin. Veuillez contacter un opérateur. Je vous connais sous le nom:"
set pwf_reply(auth3) "14Vous devez etre présent sur"
set pwf_reply(auth4) "pour vous authentifier."
set pwf_reply(auth5) "14Vous êtes déjà authentifié en tant que Game-Admin avec le nick"
set pwf_reply(auth6) "14Syntaxe : /msg $botnick [string trim $pwf_trigger]admin <mot-de-passe>"
set pwf_reply(auth7) "4Vous n'avez encore aucun mot de passe défini.14 Tapez /msg $botnick pass <mot-de-passe>"
set pwf_reply(auth8) "14Vous êtes maintenant authentifié en tant que Game-Admin."
set pwf_reply(auth9) "4L'authentification a échouer ... essais logger !"
set pwf_reply(auth0) "14Votre authentification vous a été automatiquement retirée suite à une absence prolongée."
set pwf_reply(rehash) "4La base de donnée a été remise a zéro, veuillez nous excuser."
set pwf_reply(welcome) "Bienvenue"
set pwf_reply(topic1) "7Prêt pour le prochain match 1-2 Admin :"
set pwf_reply(topic2) "1-3"
set pwf_reply(topic4) "1-10 Type de match :"
set pwf_reply(topic5) "1- 14** MATCH VIP **"
set pwf_reply(teams1) "2 Actuellement :3"
set pwf_reply(separator) "1-"
set pwf_reply(separator2) "1-10"
set pwf_reply(defteama) "5Team A : 2"
set pwf_reply(defteamb) "5Team B : 2"
set pwf_reply(defteama2) "5Team A :2 ? - ? - ? - ? - ? -"
set pwf_reply(defteamb2) "5Team B :2 ? - ? - ? - ? - ?"
set pwf_reply(defmap) "Map non désignée pour l'instant"
set pwf_reply(misc1) "topicmem : impossible d'editer le fichier topic de"
set pwf_reply(lastgame1) "5Dernier match à démarrer sur"
set pwf_reply(lastgame2) "1- 5Sur le serveur:"
set pwf_reply(lastgame3) "5Aucune informations n'est disponible sur le dernier match."
set pwf_reply(version) "5Version du script:"
set pwf_reply(shake) "14Il faut au minimum 2 joueurs inscris pour mélanger les équipent."
set pwf_reply(move1) "14Ce joueur n'est dans aucune team ou l'autre team est complète."
set pwf_reply(move2) "14Au moins un des 2 joueurs n'est dans aucune team ou les 2 joueurs sont dans la même team."
} else {
  putlog "Error with language in pwf.tcl , please verify your config"
}
  chattr $pwf_myhandle +G
  chattr $pwf_myhandle +m $pwf_pickupchan
  set pwf_langok 1
  set pwf_maptopic [pwf_txt defmap]
  set pwf_maptopic2 [pwf_txt defmap]
  set pwf_maptopic3 [pwf_txt defmap]
  set pwf_teamatopic [pwf_txt defteama2]
  set pwf_teambtopic [pwf_txt defteamb2]
  set pwf_lastgame [pwf_txt lastgame3]
}


if [info exists pwf_rehashmsg] {
  putserv "PRIVMSG $pwf_pickupchan :[pwf_txt rehash]"
} else {
  set pwf_rehashmsg 1
}


pwf_setnogame


putlog "PWF v$pwf_version by xpl0ziv has successfully loaded"


 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  



×