// ---------------------------------------------------------------------------
// StatsMe 2.8.3 Config Pack [16 June, 2004]
// ---------------------------------------------------------------------------
// This file is part of StatsMe (See README for more information).
// Copyright 2002 - 2004 UnitedAdmins (www.unitedadmins.com)
// Project originally created by OLO (http://olo.counter-strike.pl)
// ---------------------------------------------------------------------------
// Please read the manual and the forums carefully before altering this file!
// The Manual is located at http://docs.unitedadmins.com/statsme/
// The Forum can be found at http://forums.unitedadmins.com/
// ---------------------------------------------------------------------------
// Kicks Player if they have average ping above mping setting, doens't care about x amount of rounds

sm_menu "High Ping Kicker\\y\\R{sm_mode2&g?ON:OFF}" "sm_mode2 {sm_mode2&g?remove:set} g"

sm_mode2 set g  // Enable High Ping Kicker

// Format of message for telling players they are privledged users
alias set_hpka "sm_sayformat 255 0 0 0.30 0.60 0 6 6 0.5 1.5 4"
// Format of message for Announcing people got kicked
alias set_hpkb "sm_sayformat 0 255 0 0.30 0.60 0 6 6 0.5 1.5 4"

// If you wish to use a password change this to the password to use (Clients must have setinfo _hppw yourpassword set in config.cfg)
localinfo hppw "be-sure-to-change-this-to-something-unique"

//  Add WONID's surrounded by :'s
//  Remove the // in front of the next line to activate
//localinfo admn ":WONID1:WONID2:WONID3:WONID4:"	

//  Add IP Addresses with :27005 after each one
//  Remove the // in front of the next line to activate
//localinfo adip ":IPADDRESS1:27005:IPADDRESS2:27005:IPADDRESS3:27005:IPADDRESS4:27005:"

//  Add your subnet to exclude checks on (Only good for 1, and do not use .0, leave off the subnet part just specify the network number)
//  Remove the // in front of the next line to activate
//localinfo hpsn "12.345.678"

// Over this ping then Kick
localinfo mping	225

// Below this ping then never check (FOR LAN Players and Low Latency Players)
localinfo lping 80

// Display console message letting them know they won't be checked
sm_register "SM_PutInServer g 2" "{I.adip&{:{p.ip}:}?:#}{%.pchk{p.uid}=2}set_hpkb;sm_tell2 #{p.uid} \'Privledged IP/Computer Detected, No Ping Checks Will Be Run Against You.\';sm_clexec2 #{p.uid} \'echo \\'Privledged IP/Computer Detected, No Ping Checks Will Be Run Against You.\\'\'" bde
sm_register "SM_PutInServer g 2" "{p.ip&{{I.hpsn}}?:#}{%.pchk{p.uid}=2}set_hpkb;sm_tell2 #{p.uid} \'Privledged Subnet/Computer Detected, No Ping Checks Will Be Run Against You.\';sm_clexec2 #{p.uid} \'echo \\'Privledged Subnet/Computer Detected, No Ping Checks Will Be Run Against You.\\'\'" bde
sm_register "SM_PutInServer g 2" "{I.admn&{:{p.aid}:}?:#}{%.pchk{p.uid}=2}set_hpkb;sm_tell2 #{p.uid} \'Privledged User Detected, No Ping Checks Will Be Run Against You.\';sm_clexec2 #{p.uid} \'echo \\'Privledged User Detected, No Ping Checks Will Be Run Against You.\\'\'" bde
sm_register "SM_PutInServer g 2" "{p.I._hppw={I.hppw}?:#}{%.pchk{p.uid}=2}set_hpkb;sm_tell2 #{p.uid} \'Privledged User Detected (Password Set), No Ping Checks Will Be Run Against You.\';sm_clexec2 #{p.uid} \'echo \\'Privledged User Detected (Password Set), No Ping Checks Will Be Run Against You.\\'\'" bde

// Core of Script, Check the ping if they aren't flagged, aren't in the wonid list or in the ip addr list
sm_register "SM_RoundStart g 2" "{%.pchk{p.uid}=1?:#}{I.adip&{:{p.ip}:}?#:{I.admn&{:{p.aid}:}?#}}{p.ping<{I.mping}?#}sm_clexec2 #{p.uid} \'echo \\'Sorry, but your ping is too high. If you feel that you had a ping spike please type retry or reconnect to get back in.\\';disconnect\';sm_log \'{p.name}<{p.uid}><{p.aid}><{p.tm.gm.name}>\' kicked due to high ping [ping \'{p.ping}]\';set_hpkb;sm_tell * \'{p.name} kicked due to high ping [ping {p.ping} over {I.mping}]\' )" bde

// Flag Player ID to check Ping or Not
sm_register "SM_RoundStart g 2" "{%.pchk{p.uid}>0?#}{p.ping=0?#}{p.ping<{I.lping}?{%.pchk{p.uid}=2}:{%.pchk{p.uid}=1}}" bde 

// Reset Player Check Flag When they Disconnect
sm_register "SM_Disconnect g 2" "{%.pchk{p.uid}=0}" bde

// Debug Command to Echo Players Ping  (Uncomment following line if you want to see your averageping and if you are suppose to be checked each round)
//sm_register "SM_RoundStart g 2" "sm_clexec2 #{p.uid} \'echo \\'hpingkick:  Your Average Ping:  {p.ping} |  PingCheck:  {%.pchk{p.uid}} (2=Never, 1=Check, 0=NoCheckYet)\\'\'" bde
