/*
Original code xPaw and SchlumPF modded stats by kzuq^BorJomi 
version 1.64

Big thanks developers of kz_ljs_xm:D and Exolent

Visit  http://unique-kz.com/
       http://cs.n-sib.net/
       http://extreme-jump.ru/forum/

       2010 year
       
       
WORK VERSION OF SMA
*/

#include <amxmodx>
#include <amxmisc>
#include <colorchat>
#include <fakemeta>
#include <engine>
#include <cstrike>
#include <fakemeta_util>

#pragma semicolon 1

#define NSHOW 10
#define INFO_ONE 1
#define INFO_ZERO 0
#define NSTRAFES 14
#define NTOP 20
#define MAX_DISTANCE 280.0



enum JumpType {
	Type_LongJump = 0,
	Type_HighJump = 1,
	Type_CountJump = 2,
	Type_BhopLongJump = 3,
	Type_Slide = 4, //nothing
	Type_StandupBhopLongJump = 5,
	Type_WeirdLongJump = 6,
	Type_Drop_BhopLongJump = 7,
	Type_Drop_CountJump = 8,
	Type_Multi_CountJump = 9,//dcj
	Type_Multi_Count = 11,//mcj
	Type_LadderDropBhop = 12, //nothing
	Type_ladder = 13,
	Type_None = 14,
	Type_ladderBhop =15,
	Type_Drop_StandBhopLongJump = 16,
	Type_CountJumpafterDrop = 17,//nothing
	Type_Drop_CountJump1 = 18, 
	Type_Fast_CountJump = 19 //nothing
};
#define FPS_TASK_ID 927560
new Float:dropbjtime[33];
new Float:dropstime[33];
new bool:firstdrop[33];
new bool:edgeshow[33];
new bool:slide[33];
new pre_type[33][33];
new pre_type1[33][33];
new bool:ljpre[33];
//new lll;
new bool:doubleduck[33];
new Float:doubletime[33];
new bool:multibhoppre[33];
new g_fps[33];
new kz_uq_fps;
new bool:bhopfail[33];
new chit[33];//dlya testov
new Float:cjorigin[33][3];
new Float:rDistance[3];
new Float:frame2time;
new Float:vFallAt[33][3];
new Float:vFallAt1[33][3];
new bool:ddbeforwj[33];
new bool:gHasColorChat[33];
new Float:old_angle1[33];
new bool:g_lj_stats[33];
new strafe_num[33];
new bool:g_Jumped[33];
new bool:g_reset[33];
new bool:flajok[33];
new ljsDir[64];
new Float:gBeam_points[33][100][3];
new gBeam_duck[33][100];
new gBeam_count[33];
new gBeam;
new waits[33];
new waits1[33];
new Float:slideland[33];
new dist[33],syncc[33],maxsped[33],prestr[33],dcj_names[33][33],dcj_ip[33][33], streif[33];
new lj_dist[33],lj_syncc[33],lj_maxsped[33], lj_prestr[33],lj_names[33][33],lj_ip[33][33],lj_streif[33];
new dropsbj_dist[33], dropsbj_syncc[33],dropsbj_maxsped[33],dropsbj_prestr[33],dropsbj_names[33][33],dropsbj_ip[33][33], dropsbj_streif[33];
new cj_dist[33], cj_syncc[33], cj_maxsped[33], cj_prestr[33], cj_names[33][33],cj_ip[33][33], cj_streif[33];
new wj_dist[33], wj_syncc[33], wj_maxsped[33], wj_prestr[33],wj_names[33][33],wj_ip[33][33], wj_streif[33];
new bj_dist[33], bj_syncc[33],bj_maxsped[33], bj_prestr[33],bj_names[33][33],bj_ip[33][33], bj_streif[33];
new sbj_dist[33],sbj_syncc[33],sbj_maxsped[33],sbj_prestr[33],sbj_names[33][33],sbj_ip[33][33],sbj_streif[33];
new ladder_dist[33], ladder_syncc[33],ladder_maxsped[33], ladder_prestr[33],ladder_names[33][33],ladder_ip[33][33],ladder_streif[33];
new dropcj_dist[33],dropcj_syncc[33], dropcj_maxsped[33],dropcj_prestr[33], dropcj_names[33][33], dropcj_ip[33][33],dropcj_streif[33];
new dropbj_dist[33],dropbj_syncc[33], dropbj_maxsped[33],dropbj_prestr[33],dropbj_names[33][33],dropbj_ip[33][33],dropbj_streif[33];
new ldbhop_dist[33],ldbhop_syncc[33],ldbhop_maxsped[33],ldbhop_prestr[33],ldbhop_names[33][33],ldbhop_ip[33][33],ldbhop_streif[33];
new map_dist[33],map_syncc[33],map_maxsped[33], map_prestr[33],map_names[33][33],map_ip[33][33],map_streif[33],map_type[33][33];
new mcj_dist[33],mcj_syncc[33],mcj_maxsped[33],mcj_prestr[33],mcj_names[33][33],mcj_ip[33][33],mcj_streif[33],mcj_ducks[33];

new kz_uq_lj,kz_uq_cj,kz_uq_dcj,kz_uq_mcj ,kz_uq_ladder,kz_uq_ldbj;
new kz_uq_bj,kz_uq_sbj,kz_uq_drbj,kz_uq_drsbj,kz_uq_drcj,kz_uq_wj;	

new bool:landslide[33];
new strafecounter_oldbuttons[33],buttons, Float:Fulltime;
new Float:needslide[33];
new Float:groundslide[33];
new jj; // iz kz_ljs_xm dlya cikla scheta streifof
new sync_[33];
new goodSyncTemp;
new badSyncTemp;
new Float:time_;
new Float:groundorig[33][3];
new Float:strafe_stat_time[33][NSTRAFES]; 
new Float:strafe_stat_speed[33][NSTRAFES][2];
new strafe_stat_sync[33][NSTRAFES][2];
new strLen;
new strMess[40*NSTRAFES];
new strMessBuf[40*NSTRAFES];

new strL;
new strM[40*NSTRAFES];
new strMBuf[40*NSTRAFES];

new Float:firstvel[33];
new Float:secvel[33];
new Float:firstorig[33][3];
new Float:secorig[33][3];
new Float:fSpeed, Float:speed, Float:TempSpeed[33],Float:velocity[3],Float:statsduckspeed[33][100]; 
new FPS = 0,Float:NC = 0.0,Float:g_nc[33] = 0.0,g_lastfps[33],g_average[10];
new bool:slidim[33];
new Float:slidedist[33];
new edgefriction,mp_footsteps,sv_cheats,sv_airaccelerate,sv_maxspeed,sv_stepsize,sv_maxvelocity,sv_gravity;

new kz_min_dcj;
new kz_stats_x;
new kz_stats_y;
new Float:stats_x;
new Float:stats_y;
new taskslide[33];
new taskslide1[33];
new bool:failslide[33];
new Float:failslidez[33];
new kz_strafe_x;
new kz_strafe_y;
new Float:strafe_x;
new Float:strafe_y;
new Float:laddist[33];
new kz_duck_x;
new kz_duck_y;
new Float:duck_x;
new Float:duck_y;
new bool:bhopaem[33];
new kz_stats_red,kz_stats_green, kz_stats_blue, kz_failstats_red,kz_failstats_green;
new kz_failstats_blue, kz_sounds, kz_airaccelerate, kz_prefix, kz_top_rank_by,kz_legal_settings;

new kz_good_lj,kz_pro_lj,kz_holy_lj,kz_leet_lj,kz_god_lj;
new kz_good_bj,kz_pro_bj,kz_holy_bj,kz_leet_bj,kz_god_bj;
new kz_good_cj,kz_pro_cj,kz_holy_cj,kz_leet_cj,kz_god_cj;
new kz_good_wj,kz_pro_wj,kz_holy_wj,kz_leet_wj,kz_god_wj;
new kz_good_dbj,kz_pro_dbj, kz_holy_dbj,kz_leet_dbj, kz_god_dbj;
new kz_good_scj,kz_pro_scj, kz_holy_scj,kz_leet_scj, kz_god_scj;
new kz_good_ladder,kz_pro_ladder,kz_holy_ladder, kz_leet_ladder,kz_god_ladder;
new kz_good_dcj,kz_pro_dcj,kz_holy_dcj,kz_leet_dcj,kz_god_dcj;

new Float:slidez[33][4][3];
//new MIN_DISTANCE;
new prefix[64];

//new bool:g_bCheckSurf[ 33 ];


	
new bool:cjjump[33];
new bool:serf_reset[33];
new entlist[512],ent,nLadder,Float:ladderxyz[512][3], Float:laddersize[512][3], nashladder,bool:ladderjump[33];

new bool:kz_stats_pre[33], bool:kz_beam[33],bool:showpre[33],bool:speedon[33];

new const KZ_DIR[] = "uq_jumpstats";
new const KZ_CVARSDIR[] = "config.cfg";


new Float:dropbjorigin[33][3], Float:falloriginz[33],Float:origin[3];
new ducks[33], movetype[33];
static Float:maxspeed[33], Float:prestrafe[33];

static JumpType:jump_type[33], frames[33], frames_gained_speed[33], bool:turning_left[33];
static bool:turning_right[33],bool:started_cj_pre[33],bool:in_duck[33], bool:in_bhop[33],bool:in_air[33];

new bool:failearly[33],bool:firstshow[33],bool:first_onground[33],bool:notjump[33],bool:OnGround[33],bool:donehook[33];
new bool:streifstat[33];
new Jtype[33][33],Jtype1[33][33];
new Float:weapSpeed[33],Float:weapSpeedOld[33];
new airacel[33][33];
new bool:firstfr[33];
new kz_speed_x,kz_speed_y; 
new hud_stats,hud_streif,hud_pre,hud_duck,hud_speed; 
new kz_uq_connect;
new kz_uq_light; 
new bool:duckstring[33];
new kz_uq_top;
new kz_uq_maptop;
new bool:showduck[33]; 
new Float:surf[33];
new bool:first_surf[33];
new oldjump_type[33];
new oldjump_typ1[33];
new mapname[33];
new Float:duckstartz[33];
new najalw;
static Float:height_difference[33];
new kz_uq_team;
new bool:jumpoffirst[33];
new kz_prest_x,kz_prest_y,kz_speed_r,kz_speed_g,kz_speed_b,kz_prest_r,kz_prest_g,kz_prest_b;
public plugin_init() {
	register_plugin( "JumpStats", "v1.64", "kzuq#BorJomi" );
	
	kz_good_lj            = register_cvar("kz_uq_good_lj",            "240");	// lj hj
	kz_pro_lj            = register_cvar("kz_uq_pro_lj",             "245");
	kz_holy_lj            = register_cvar("kz_uq_holy_lj",            "250");
	kz_leet_lj           = register_cvar("kz_uq_leet_lj",            "253");
	kz_god_lj           = register_cvar("kz_uq_god_lj",            "255");
	
	kz_good_cj            = register_cvar("kz_uq_good_cj",            "250");	// cj
	kz_pro_cj            = register_cvar("kz_uq_pro_cj",             "255");
	kz_holy_cj            = register_cvar("kz_uq_holy_cj",            "260");
	kz_leet_cj           = register_cvar("kz_uq_leet_cj",            "265");
	kz_god_cj           = register_cvar("kz_uq_god_cj",            "267");
	
	kz_good_dcj            = register_cvar("kz_uq_good_dcj",            "250");	// dcj mcj
	kz_pro_dcj            = register_cvar("kz_uq_pro_dcj",             "255");
	kz_holy_dcj            = register_cvar("kz_uq_holy_dcj",            "260");
	kz_leet_dcj           = register_cvar("kz_uq_leet_dcj",            "265");
	kz_god_dcj           = register_cvar("kz_uq_god_dcj",            "270");
	
	kz_good_ladder           = register_cvar("kz_uq_good_ladder",            "150");	// ladder
	kz_pro_ladder           = register_cvar("kz_uq_pro_ladder",             "160");
	kz_holy_ladder           = register_cvar("kz_uq_holy_ladder",            "170");
	kz_leet_ladder           = register_cvar("kz_uq_leet_ladder",            "180");
	kz_god_ladder          = register_cvar("kz_uq_god_ladder",            "190");
	
	kz_good_bj           = register_cvar("kz_uq_good_bj",            "230");	// bj sbj
	kz_pro_bj           = register_cvar("kz_uq_pro_bj",             "235");
	kz_holy_bj           = register_cvar("kz_uq_holy_bj",            "240");
	kz_leet_bj           = register_cvar("kz_uq_leet_bj",            "245");
	kz_god_bj          = register_cvar("kz_uq_god_bj",            "247");
	
	kz_good_wj          = register_cvar("kz_uq_good_wj",            "255");	// wj dropcj ladderbhop
	kz_pro_wj           = register_cvar("kz_uq_pro_wj",             "260");
	kz_holy_wj           = register_cvar("kz_uq_holy_wj",            "265");
	kz_leet_wj           = register_cvar("kz_uq_leet_wj",            "270");
	kz_god_wj          = register_cvar("kz_uq_god_wj",            "272");
	
	kz_good_dbj          = register_cvar("kz_uq_good_dbj",            "240");	// 
	kz_pro_dbj          = register_cvar("kz_uq_pro_dbj",             "250");
	kz_holy_dbj          = register_cvar("kz_uq_holy_dbj",            "265");
	kz_leet_dbj           = register_cvar("kz_uq_leet_dbj",            "270");
	kz_god_dbj          = register_cvar("kz_uq_god_dbj",            "272");
	
	kz_good_scj          = register_cvar("kz_uq_good_scj",            "240");	// 
	kz_pro_scj          = register_cvar("kz_uq_pro_scj",             "245");
	kz_holy_scj          = register_cvar("kz_uq_holy_scj",            "250");
	kz_leet_scj           = register_cvar("kz_uq_leet_scj",            "255");
	kz_god_scj          = register_cvar("kz_uq_god_scj",            "257");
	
	kz_min_dcj          = register_cvar("kz_uq_min_dist",            "215");
	
	
	kz_stats_red        = register_cvar("kz_uq_stats_red",        "0");		
	kz_stats_green      = register_cvar("kz_uq_stats_green",      "255");
	kz_stats_blue       = register_cvar("kz_uq_stats_blue",       "159");
	kz_failstats_red        = register_cvar("kz_uq_failstats_red",        "255");		
	kz_failstats_green      = register_cvar("kz_uq_failstats_green",      "0");
	kz_failstats_blue       = register_cvar("kz_uq_failstats_blue",       "109");
	kz_sounds 	     = register_cvar("kz_uq_sounds",           "1");
	kz_top_rank_by        = register_cvar("kz_uq_top_by",        "1");		// How ranking will work? 0=name, 1=ip 2=steam
	kz_legal_settings     = register_cvar("kz_uq_legal_settings",     "1");
	kz_prefix 	       = register_cvar("kz_uq_prefix",       "unique-kz");
	kz_airaccelerate     = register_cvar("kz_uq_airaccelerate",     "0");
	
	kz_stats_x        = register_cvar("kz_uq_stats_x",        "-1.0");		
	kz_stats_y      = register_cvar("kz_uq_stats_y",      "0.70");
	kz_strafe_x        = register_cvar("kz_uq_strafe_x",        "0.70");		
	kz_strafe_y      = register_cvar("kz_uq_strafe_y",      "0.35");
	kz_duck_x        = register_cvar("kz_uq_duck_x",        "0.6");		
	kz_duck_y      = register_cvar("kz_uq_duck_y",      "0.78");
	kz_speed_x        = register_cvar("kz_uq_speed_x",        "-1.0");		
	kz_speed_y      = register_cvar("kz_uq_speed_y",      "0.83");
	
	kz_prest_x        = register_cvar("kz_uq_prestrafe_x",        "-1.0");		
	kz_prest_y      = register_cvar("kz_uq_prestrafe_y",      "0.65");
	
	kz_speed_r        = register_cvar("kz_uq_speed_red",        "255");		
	kz_speed_g        = register_cvar("kz_uq_speed_green",      "255");
	kz_speed_b          = register_cvar("kz_uq_speed_blue",        "255");		
	kz_prest_r        = register_cvar("kz_uq_prestrafe_red",        "255");		
	kz_prest_g      = register_cvar("kz_uq_prestrafe_green",      "255");
	kz_prest_b        = register_cvar("kz_uq_prestrafe_blue",        "255");
	
	hud_stats       = register_cvar("kz_uq_hud_stats",        "3");		
	hud_streif    = register_cvar("kz_uq_hud_strafe",      "4");
	hud_pre      = register_cvar("kz_uq_hud_pre",        "1");		
	hud_duck     = register_cvar("kz_uq_hud_duck",      "1");
	hud_speed     = register_cvar("kz_uq_hud_speed",      "2");
	
	kz_uq_lj       = register_cvar("kz_uq_lj",        "1");		
	kz_uq_cj       = register_cvar("kz_uq_cj",        "1");	
	kz_uq_dcj       = register_cvar("kz_uq_dcj",        "1");	
	kz_uq_mcj       = register_cvar("kz_uq_mcj",        "1");	
	kz_uq_ladder       = register_cvar("kz_uq_ladder",        "1");	
	kz_uq_ldbj       = register_cvar("kz_uq_ldbj",        "1");	
	kz_uq_bj       = register_cvar("kz_uq_bj",        "1");	
	kz_uq_sbj       = register_cvar("kz_uq_sbj",        "1");	
	kz_uq_drbj       = register_cvar("kz_uq_drbj",        "1");	
	kz_uq_drsbj       = register_cvar("kz_uq_scj",        "1");	
	kz_uq_drcj       = register_cvar("kz_uq_drcj",        "1");	
	kz_uq_wj       = register_cvar("kz_uq_wj",        "1");	
	
	kz_uq_light    = register_cvar("kz_uq_light",      "0");
	kz_uq_connect = register_cvar("kz_uq_connect", "abdehk");		// What is enabled at connect (0=nothing, a=colorchat, b=stats, c=speed, d=showpre,e=strafe stats,f=beam,g=duck stat fo mcj,g=multi bhop pre)
	
	kz_uq_fps = register_cvar("kz_uq_fps", "0");	
	kz_uq_top = register_cvar("kz_uq_save_top", "1");
	kz_uq_maptop = register_cvar("kz_uq_maptop", "1");
	kz_uq_team = register_cvar("kz_uq_team", "0");
	register_concmd("amx_reset_uqtops","reset_tops",ADMIN_MAP,"reset all tops");
	register_concmd("amx_uq_default_cvars","defaultall",ADMIN_MAP,"reset all cvars");
	
	register_clcmd( "say /strafe",	"streif_stats" ,         ADMIN_ALL, "- enabled/disables");
	register_clcmd( "say /strafes",	"streif_stats" ,         ADMIN_ALL, "- enabled/disables");
	register_clcmd( "say /strafestat",	"streif_stats" ,         ADMIN_ALL, "- enabled/disables");
	register_clcmd( "say /strafestats",	"streif_stats" ,         ADMIN_ALL, "- enabled/disables");
	register_clcmd( "say /showpre",	"show_pre" ,         ADMIN_ALL, "- enabled/disables");
	register_clcmd( "say /duck",	"pre_stats" ,         ADMIN_ALL, "- enabled/disables");
	register_clcmd( "say /ducks",	"pre_stats" ,         ADMIN_ALL, "- enabled/disables");
	register_clcmd( "say /uqstats",		"cmdljStats",         ADMIN_ALL, "- enabled/disables" );
	register_clcmd( "say /ljstats",		"cmdljStats",         ADMIN_ALL, "- enabled/disables" );
	register_clcmd( "say /stats",		"cmdljStats",         ADMIN_ALL, "- enabled/disables" );
	register_clcmd( "say /uqversion",	"cmdVersion",         ADMIN_ALL);
	register_clcmd( "say uqversion",	"cmdVersion",         ADMIN_ALL);
	register_clcmd("say /uqbeam",     "cmdljbeam",         ADMIN_ALL);
	register_clcmd("say /beam",     "cmdljbeam",         ADMIN_ALL);
	//register_clcmd("say /fps",     "cmdfps",         ADMIN_ALL);
	register_clcmd("say /speed",     "show_speed",         ADMIN_ALL);
	register_clcmd("say speed",     "show_speed",         ADMIN_ALL);
	register_clcmd("say /colorchat",     "cmdColorChat",         ADMIN_ALL);
	register_clcmd("say colorchat",     "cmdColorChat",         ADMIN_ALL);
	register_clcmd("say /bhopwarn",     "show_early",         ADMIN_ALL);
	register_clcmd("say /multibhop",     "multi_bhop",         ADMIN_ALL);
	register_clcmd("say /duckspre",     "duck_show",         ADMIN_ALL);
	register_clcmd("say /duckpre",     "duck_show",         ADMIN_ALL);
	register_clcmd("say /ljpre",     "lj_show",         ADMIN_ALL);
	register_clcmd("say /prelj",     "lj_show",         ADMIN_ALL);
	
	register_menucmd(register_menuid("StatsTopMenu1"),          1023, "TopMenu1");
	register_menucmd(register_menuid("StatsTopMenu2"),          1023, "TopMenu2");
	register_menucmd(register_menuid("StatsOptionMenu"),          1023, "OptionMenu");
	
	register_clcmd("say /options",     "Option",         ADMIN_ALL);
	register_clcmd("say /ljsmenu",     "Option",         ADMIN_ALL);
	register_clcmd("say /uqmenu",     "Option",         ADMIN_ALL);
	register_clcmd("say /option",     "Option",         ADMIN_ALL);
	
	register_clcmd( "say /dcj10",	"uqTopmenu1" );
	register_clcmd( "say /dcj15",	"uqTopmenu1" );
	register_clcmd( "say /dcjtop",	"uqTopmenu1" );
	register_clcmd( "say /dcjtop10", "uqTopmenu1" );
	register_clcmd( "say /dcjtop15", "uqTopmenu1" );
	register_clcmd( "say /mcj10",	"uqTopmenu2" );
	register_clcmd( "say /mcj15",	"uqTopmenu2" );
	register_clcmd( "say /mcjtop",	"uqTopmenu2" );
	register_clcmd( "say /mcjtop10", "uqTopmenu2" );
	register_clcmd( "say /mcjtop15", "uqTopmenu2" );
	register_clcmd( "say /lj10",	"uqTopmenu1" );
	register_clcmd( "say /lj15",	"uqTopmenu1" );
	register_clcmd( "say /ljtop",	"uqTopmenu1" );
	register_clcmd( "say /ljtop10", "uqTopmenu1" );
	register_clcmd( "say /ljtop15", "uqTopmenu1" );
	register_clcmd( "say /cj10",	"uqTopmenu1" );
	register_clcmd( "say /cj15",	"uqTopmenu1" );
	register_clcmd( "say /cjtop",	"uqTopmenu1" );
	register_clcmd( "say /cjtop10", "uqTopmenu1" );
	register_clcmd( "say /cjtop15", "uqTopmenu1" );
	register_clcmd( "say /hj10",	"uqTopmenu1" );
	register_clcmd( "say /hj15",	"uqTopmenu1" );
	register_clcmd( "say /hjtop",	"uqTopmenu1" );
	register_clcmd( "say /hjtop10", "uqTopmenu1" );
	register_clcmd( "say /hjtop15", "uqTopmenu1" );
	register_clcmd( "say /wj10",	"uqTopmenu1" );
	register_clcmd( "say /wj15",	"uqTopmenu1" );
	register_clcmd( "say /wjtop",	"uqTopmenu1" );
	register_clcmd( "say /wjtop10", "uqTopmenu1" );
	register_clcmd( "say /wjtop15", "uqTopmenu1" );
	register_clcmd( "say /bj10",	"uqTopmenu1" );
	register_clcmd( "say /bj15",	"uqTopmenu1" );
	register_clcmd( "say /bjtop",	"uqTopmenu1" );
	register_clcmd( "say /bjtop10", "uqTopmenu1" );
	register_clcmd( "say /bjtop15", "uqTopmenu1" );
	register_clcmd( "say /ladder10",	"uqTopmenu2" );
	register_clcmd( "say /ladder15",	"uqTopmenu2" );
	register_clcmd( "say /laddertop",	"uqTopmenu2" );
	register_clcmd( "say /laddertop10", "uqTopmenu2" );
	register_clcmd( "say /laddertop15", "uqTopmenu2" );
	register_clcmd( "say /ladder", "uqTopmenu2" );
	register_clcmd( "say /dropbj", "uqTopmenu2" );
	register_clcmd( "say /dropcj", "uqTopmenu2" );
	register_clcmd( "say /dropsj", "uqTopmenu2" );
	//gavno ot /tp
	register_clcmd("+hook",           "resethook",           -1,        " - used hook");
	register_clcmd("-hook",           "resethook",           -1,        " - used hook");
	
	register_forward( FM_ClientCommand, "client_commands" );
	
	edgefriction          = get_cvar_pointer("edgefriction");
	mp_footsteps          = get_cvar_pointer("mp_footsteps");
	sv_cheats             = get_cvar_pointer("sv_cheats");
	sv_gravity            = get_cvar_pointer("sv_gravity");
	sv_airaccelerate      = get_cvar_pointer("sv_airaccelerate");
	sv_maxspeed           = get_cvar_pointer("sv_maxspeed");
	sv_stepsize           = get_cvar_pointer("sv_stepsize");
	sv_maxvelocity        = get_cvar_pointer("sv_maxvelocity");
	
	register_forward( FM_PlayerPreThink,	"fwdPlayerPreThink",	0 );
	register_forward( FM_PlayerPreThink,	"edgedist",	0 );
	register_forward( FM_PlayerPostThink,	"fwdPlayerPostThink",	0 );
	register_forward(FM_StartFrame,      "fwdStartFrame",      0);
	//register_forward(FM_PlayerPreThink,"PreThink");
	new dataDir[64];
	get_datadir(dataDir, 63);
	format(ljsDir, 63, "%s/Topljs", dataDir);
	if( !dir_exists(ljsDir) )
		mkdir(ljsDir);
	register_event("ResetHUD","ResetHUD","b");
	read_topdcj();
	read_topmcj();
	read_topcj();
	read_toplj();
	read_topdropsbj();
	read_topwj();
	read_topbj();
	read_topsbj();
	read_topldbhop();
	read_topladder();
	read_topdropcj();
	read_topdropbj();
	sv_gravity = get_cvar_pointer( "sv_gravity" );
	
	
	ent=find_ent_by_class(-1,"func_ladder");
	while( ent > 0 )
	{
	entity_get_vector ( ent, EV_VEC_maxs, ladderxyz[nLadder] );
	entity_get_vector ( ent, EV_VEC_size, laddersize[nLadder] );
	entlist[nLadder]=ent;
	
	ent = find_ent_by_class(ent,"func_ladder");
	nLadder++;
	}
	
	get_mapname(mapname, 32);

}
public plugin_natives()
{
	register_native("kz_get_configsdir", "native_kz_get_configsdir", 1);
}
public plugin_cfg()
{
	if( get_pcvar_num(kz_legal_settings) )
	{
		set_cvar_string("edgefriction", "2");
		set_cvar_string("mp_footsteps", "1");
		set_cvar_string("sv_cheats", "0");
		set_cvar_string("sv_gravity", "800");
		if( get_pcvar_num( kz_airaccelerate ) ) set_cvar_string("sv_airaccelerate", "100");
		else set_cvar_string("sv_airaccelerate", "10");
		set_cvar_string("sv_maxspeed", "320");
		set_cvar_string("sv_stepsize", "18");
		set_cvar_string("sv_maxvelocity", "2000");
	}
	
	new cvarfiles[100], uqpath[64];
	kz_get_configsdir(uqpath, 63);
	formatex(cvarfiles, 99, "%s/%s", uqpath, KZ_CVARSDIR);
	
	if( file_exists(cvarfiles) )
	{
		server_cmd("exec %s", cvarfiles);
		server_exec();
	}
	else
	{
		kz_make_cvarexec(cvarfiles);
	}
	
	//if( !havecheck )
	//{
	//	delete_file(cvarfiles);
		
	//}
}

public plugin_precache()
{
	gBeam = precache_model( "sprites/zbeam6.spr" );
	precache_sound( "misc/impressive.wav" );
	precache_sound( "misc/perfect.wav" );
	precache_sound( "misc/mod_godlike.wav" );
	precache_sound( "misc/holyshit.wav" );
	precache_sound( "misc/mod_wickedsick.wav" );
	
}
stock kz_make_cvarexec(const config[])
{
	new f = fopen(config, "wt");
	new stringscvars[192];
	fprintf(f, "// Config of JumpStats by [kzuq]BorJomi^n");
	fprintf(f, "// version 1.64^n");
	fprintf(f, "^n");
	
	fprintf(f, "// Players commands^n");
	fprintf(f, "^n");
	fprintf(f, "// say /strafes - on/off statistics Strafes^n"); 
	fprintf(f, "// say /showpre - on/off display prestrafe^n"); 
	fprintf(f, "// say /ducks - on/off statistics ducks for multi cj^n"); 
	fprintf(f, "// say /ljstats - on/off the main statistics^n"); 
	fprintf(f, "// say /uqversion - show version^n"); 
	fprintf(f, "// say /beam - on/off showing the trajectory of the jump^n"); 
	fprintf(f, "// say /speed - on/off display of speed player^n"); 
	fprintf(f, "// say /colorchat - on/off display of color in the chat messages from other players^n"); 
	fprintf(f, "// say /ljsmenu - open the configuration menu^n"); 
	fprintf(f, "// say /ljtop - open TOP10 menu^n");
	fprintf(f, "// say /bhopwarn - on/off show message when you bhop prestrafe is fail^n");
	fprintf(f, "// say /multibhop - on/off show multi bhop pre^n");
	fprintf(f, "// say /duckspre - on/off display prestrafe after each duck^n");
	fprintf(f, "// say /ljpre - on/off display prestrafe for LJ^n");
	fprintf(f, "^n");
	
	fprintf(f, "// Admin command^n");
	fprintf(f, "^n");
	fprintf(f, "// amx_reset_uqtops – reset all tops^n");
	fprintf(f, "// amx_uq_default_cvars - set all cvars to default values^n");
	fprintf(f, "^n");
	
	/*fprintf(f, "//Coordinates Hud messages^n");
	fprintf(f, "^n");
	fprintf(f, "//General stats jump^n");
	fprintf(f, "//kz_uq_stats_x^n");	
	fprintf(f, "//kz_uq_stats_y^n");
	fprintf(f, "^n");
	fprintf(f, "//Strafes Stats^n");
	fprintf(f, "//kz_uq_strafe_x^n");		
	fprintf(f, "//kz_uq_strafe_y^n");
	fprintf(f, "^n");
	fprintf(f, "//Ducks Stats for Multi CountJump^n");
	fprintf(f, "//kz_uq_duck_x^n");      		
	fprintf(f, "//kz_uq_duck_y^n");   
	fprintf(f, "^n");
	fprintf(f, "//speed^n");
	fprintf(f, "//kz_uq_speed_x^n");    		
	fprintf(f, "//kz_uq_speed_y^n");
	fprintf(f, "^n");
	fprintf(f, "//prestrafe^n");
	fprintf(f, "//kz_uq_prestrafe_x^n"); 
	fprintf(f, "//kz_uq_prestrafe_y^n");
	fprintf(f, "^n");
	*/
	fprintf(f, "// Cvars^n");
	fprintf(f, "^n");
	fprintf(f, "// What should work when players connect to the server:^n");
	fprintf(f, "// 	0 = none^n"); 
	fprintf(f, "// 	a = colorchat^n"); 
	fprintf(f, "// 	b = stats^n"); 
	fprintf(f, "// 	c = speed^n"); 
	fprintf(f, "// 	d = showpre^n"); 
	fprintf(f, "// 	e = strafe stats^n"); 
	fprintf(f, "// 	f = beam^n"); 
	fprintf(f, "// 	g = duck stats for mcj^n"); 
	fprintf(f, "// 	h = shows message when your bhop prestrafe is failed^n");
	fprintf(f, "// 	i = show multibhop pre^n");
	fprintf(f, "// 	j = show prestrafe after duck^n");
	fprintf(f, "// 	k = show lj prestrafe^n");
	get_pcvar_string(kz_uq_connect, stringscvars, 191);
	fprintf(f, "kz_uq_connect ^"%s^"^n", stringscvars);
	fprintf(f, "^n");
	
	fprintf(f, "// Min distance^n");
	fprintf(f, "kz_uq_min_dist  %i^n", get_pcvar_num(kz_min_dcj));
	fprintf(f, "^n");
	
	fprintf(f, "// Enable stats for team (0=all,1=T,2=CT^n");
	fprintf(f, "kz_uq_team  %i^n", get_pcvar_num(kz_uq_team));
	fprintf(f, "^n");
	
	fprintf(f, "// Allow highlighting after landing (1 = on, 0 = off; works for holy, leet and god distances)^n");
	fprintf(f, "kz_uq_light  %i^n", get_pcvar_num(kz_uq_light));
	fprintf(f, "^n");
	
	fprintf(f, "// Allow sounds (1 = on, 0 = off)^n");
	fprintf(f, "kz_uq_sounds %i^n",get_pcvar_num(kz_sounds));
	fprintf(f, "^n");
	
	fprintf(f, "// How to save Top10 (2 = steamid, 1 = Ip, 0 = name)^n");
	fprintf(f, "kz_uq_top_by %i^n",get_pcvar_num(kz_top_rank_by));
	fprintf(f, "^n");
	
	fprintf(f, "kz_uq_save_top %i - On/Off TOP10 (1 = on, 0 = off)^n",get_pcvar_num(kz_uq_top));  
	fprintf(f, "kz_uq_maptop %i  - On/Off MapTop (1 = on, 0 = off)^n",get_pcvar_num(kz_uq_maptop));
	fprintf(f, "^n");
	
	fprintf(f, "// Allow check to legal settings (1 = on, 0 = off)^n");
	fprintf(f, "kz_uq_legal_settings %i^n",get_pcvar_num(kz_legal_settings));
	fprintf(f, "kz_uq_fps %i - (1=more than 101 FPS jump does not count(*beta), 0=count)^n",get_pcvar_num(kz_uq_fps)); 
	fprintf(f, "^n");
	
	get_pcvar_string(kz_prefix, stringscvars, 191);
	fprintf(f, "// The prefix for all messages in chat^n"); 
	fprintf(f, "kz_uq_prefix ^"%s^"^n", stringscvars);
	fprintf(f, "^n");
	
	fprintf(f, "// How to set up a server by value sv_airaccelerate (0=10aa, 1=100aa)^n");
	fprintf(f, "kz_uq_airaccelerate %i^n",get_pcvar_num(kz_airaccelerate));
	fprintf(f, "^n");
	
	fprintf(f, "// Color Hud message statistics when you jump, in the RGB^n");
	fprintf(f, "kz_uq_stats_red %i^n",get_pcvar_num(kz_stats_red));	
	fprintf(f, "kz_uq_stats_green %i^n",get_pcvar_num(kz_stats_green));
	fprintf(f, "kz_uq_stats_blue %i^n",get_pcvar_num(kz_stats_blue));
	fprintf(f, "^n");
	
	fprintf(f, "// Color Hud messages Fail statistics when you jump, in the RGB^n");
	fprintf(f, "kz_uq_failstats_red %i^n",get_pcvar_num(kz_failstats_red));		
	fprintf(f, "kz_uq_failstats_green %i^n",get_pcvar_num(kz_failstats_green));
	fprintf(f, "kz_uq_failstats_blue %i^n",get_pcvar_num(kz_failstats_blue));
	fprintf(f, "^n");
	
	fprintf(f, "// Color Hud messages prestrafe, in the RGB^n");
	fprintf(f, "kz_uq_prestrafe_red %i^n",get_pcvar_num(kz_prest_r));	
	fprintf(f, "kz_uq_prestrafe_green %i^n",get_pcvar_num(kz_prest_g));
	fprintf(f, "kz_uq_prestrafe_blue %i^n",get_pcvar_num(kz_prest_b));
	fprintf(f, "^n");
	
	fprintf(f, "// Color of speed, in the RGB^n");
	fprintf(f, "kz_uq_speed_red %i^n",get_pcvar_num(kz_speed_r));		
	fprintf(f, "kz_uq_speed_green %i^n",get_pcvar_num(kz_speed_b));
	fprintf(f, "kz_uq_speed_blue %i^n",get_pcvar_num(kz_speed_b));
	fprintf(f, "^n");
	
	
	
	fprintf(f, "// Channel Hud messages of general stats jump^n");
	fprintf(f, "kz_uq_hud_stats %i^n",get_pcvar_num(hud_stats));
	fprintf(f, "^n");
	fprintf(f, "// Channel Hud messages of strafes Stats^n");
	fprintf(f, "kz_uq_hud_strafe %i^n",get_pcvar_num(hud_streif));
	fprintf(f, "^n");
	fprintf(f, "// Channel Hud messages of ducks Stats for Multi CountJump^n");
	fprintf(f, "kz_uq_hud_duck %i^n",get_pcvar_num(hud_duck));
	fprintf(f, "^n");
	fprintf(f, "// Channel Hud messages of speed^n");
	fprintf(f, "kz_uq_hud_speed %i^n",get_pcvar_num(hud_speed));
	fprintf(f, "^n");
	fprintf(f, "// Channel Hud messages of prestafe^n");
	fprintf(f, "kz_uq_hud_pre %i^n",get_pcvar_num(hud_pre));
	fprintf(f, "^n");
	
	fprintf(f, "// For what technique stats enable^n");
	fprintf(f, "kz_uq_lj %i^n",get_pcvar_num(kz_uq_lj));	
	fprintf(f, "kz_uq_cj %i^n",get_pcvar_num(kz_uq_cj));	
	fprintf(f, "kz_uq_bj %i^n",get_pcvar_num(kz_uq_bj));	
	fprintf(f, "kz_uq_sbj %i^n",get_pcvar_num(kz_uq_sbj));	
	fprintf(f, "kz_uq_wj %i^n",get_pcvar_num(kz_uq_wj));	
	fprintf(f, "kz_uq_dcj %i^n",get_pcvar_num(kz_uq_dcj));	
	fprintf(f, "kz_uq_mcj %i^n",get_pcvar_num(kz_uq_mcj));	
	fprintf(f, "kz_uq_drbj %i^n",get_pcvar_num(kz_uq_drbj));	
	fprintf(f, "kz_uq_scj %i^n",get_pcvar_num(kz_uq_drsbj));	
	fprintf(f, "kz_uq_drcj %i^n",get_pcvar_num(kz_uq_drcj));	
	fprintf(f, "kz_uq_ladder %i^n",get_pcvar_num(kz_uq_ladder));	
	fprintf(f, "kz_uq_ldbj %i^n",get_pcvar_num(kz_uq_ldbj));	
	fprintf(f, "^n");
	
	fprintf(f, "// Color for chat messages of jump distances (good = grey, pro = green, holy = blue, leet = red, god = red (with sound godlike for all players))^n");
	fprintf(f, "// LongJump/HighJump^n");
	fprintf(f, "kz_uq_good_lj %i^n",get_pcvar_num(kz_good_lj));	
	fprintf(f, "kz_uq_pro_lj %i^n",get_pcvar_num(kz_pro_lj));
	fprintf(f, "kz_uq_holy_lj %i^n",get_pcvar_num(kz_holy_lj));
	fprintf(f, "kz_uq_leet_lj %i^n",get_pcvar_num(kz_leet_lj));
	fprintf(f, "kz_uq_god_lj %i^n",get_pcvar_num(kz_god_lj));
	fprintf(f, "^n");

	fprintf(f, "// CountJump^n");
	fprintf(f, "kz_uq_good_cj %i^n",get_pcvar_num(kz_good_cj));	
	fprintf(f, "kz_uq_pro_cj %i^n",get_pcvar_num(kz_pro_cj));
	fprintf(f, "kz_uq_holy_cj %i^n",get_pcvar_num(kz_holy_cj));
	fprintf(f, "kz_uq_leet_cj %i^n",get_pcvar_num(kz_leet_cj));
	fprintf(f, "kz_uq_god_cj %i^n",get_pcvar_num(kz_god_cj));
	fprintf(f, "^n");
	
	fprintf(f, "// Double CountJump/Multi CountJump^n");
	fprintf(f, "kz_uq_good_dcj %i^n",get_pcvar_num(kz_good_dcj));	
	fprintf(f, "kz_uq_pro_dcj %i^n",get_pcvar_num(kz_pro_dcj));
	fprintf(f, "kz_uq_holy_dcj %i^n",get_pcvar_num(kz_holy_dcj));
	fprintf(f, "kz_uq_leet_dcj %i^n",get_pcvar_num(kz_leet_dcj));
	fprintf(f, "kz_uq_god_dcj %i^n",get_pcvar_num(kz_god_dcj));
	fprintf(f, "^n");
	
	fprintf(f, "// LadderJump^n");
	fprintf(f, "kz_uq_good_ladder %i^n",get_pcvar_num(kz_good_ladder));	
	fprintf(f, "kz_uq_pro_ladder %i^n",get_pcvar_num(kz_pro_ladder));
	fprintf(f, "kz_uq_holy_ladder %i^n",get_pcvar_num(kz_holy_ladder));
	fprintf(f, "kz_uq_leet_ladder %i^n",get_pcvar_num(kz_leet_ladder));
	fprintf(f, "kz_uq_god_ladder %i^n",get_pcvar_num(kz_god_ladder));
	fprintf(f, "^n");
	
	fprintf(f, "// BhopJump/StandUp BhopJump^n");
	fprintf(f, "kz_uq_good_bj %i^n",get_pcvar_num(kz_good_bj));	
	fprintf(f, "kz_uq_pro_bj %i^n",get_pcvar_num(kz_pro_bj));
	fprintf(f, "kz_uq_holy_bj %i^n",get_pcvar_num(kz_holy_bj));
	fprintf(f, "kz_uq_leet_bj %i^n",get_pcvar_num(kz_leet_bj));
	fprintf(f, "kz_uq_god_bj %i^n",get_pcvar_num(kz_god_bj));
	fprintf(f, "^n");
	
	fprintf(f, "// WeirdJump/Drop CountJump/Ladder BhopJump^n");
	fprintf(f, "kz_uq_good_wj %i^n",get_pcvar_num(kz_good_wj));	
	fprintf(f, "kz_uq_pro_wj %i^n",get_pcvar_num(kz_pro_wj));
	fprintf(f, "kz_uq_holy_wj %i^n",get_pcvar_num(kz_holy_wj));
	fprintf(f, "kz_uq_leet_wj %i^n",get_pcvar_num(kz_leet_wj));
	fprintf(f, "kz_uq_god_wj %i^n",get_pcvar_num(kz_god_wj));
	fprintf(f, "^n");
	
	fprintf(f, "// Drop BhopJump^n");
	fprintf(f, "kz_uq_good_dbj %i^n",get_pcvar_num(kz_good_dbj));	
	fprintf(f, "kz_uq_pro_dbj %i^n",get_pcvar_num(kz_pro_dbj));
	fprintf(f, "kz_uq_holy_dbj %i^n",get_pcvar_num(kz_holy_dbj));
	fprintf(f, "kz_uq_leet_dbj %i^n",get_pcvar_num(kz_leet_dbj));
	fprintf(f, "kz_uq_god_dbj %i^n",get_pcvar_num(kz_god_dbj));
	fprintf(f, "^n");
	
	fprintf(f, "// StandUp CountJump(if 100aa all cvar dist +15 units)^n");
	fprintf(f, "kz_uq_good_scj %i^n",get_pcvar_num(kz_good_scj));	
	fprintf(f, "kz_uq_pro_scj %i^n",get_pcvar_num(kz_pro_scj));
	fprintf(f, "kz_uq_holy_scj %i^n",get_pcvar_num(kz_holy_scj));
	fprintf(f, "kz_uq_leet_scj %i^n",get_pcvar_num(kz_leet_scj));
	fprintf(f, "kz_uq_god_scj %i^n",get_pcvar_num(kz_god_scj));
	fprintf(f, "^n");

	
	
	fclose(f);
	
	server_cmd("exec %s", config);
	server_exec();
}
public defaultall(id)
{
	client_print(id,print_console,"[uq_JumpStats] Default Cvar's set!!!");
	set_pcvar_num(kz_good_lj, 240);	// lj hj
	set_pcvar_num(kz_pro_lj,             245);
	set_pcvar_num(kz_holy_lj,            250);
	set_pcvar_num(kz_leet_lj,            253);
	set_pcvar_num(kz_god_lj,            255);
	
	set_pcvar_num(kz_good_cj,            250);	// cj
	set_pcvar_num(kz_pro_cj,             255);
	set_pcvar_num(kz_holy_cj,            260);
	set_pcvar_num(kz_leet_cj,            265);
	set_pcvar_num(kz_god_cj,            267);
	
	set_pcvar_num(kz_good_dcj,            250);	// dcj mcj
	set_pcvar_num(kz_pro_dcj,             255);
	set_pcvar_num(kz_holy_dcj,            260);
	set_pcvar_num(kz_leet_dcj,            265);
	set_pcvar_num(kz_god_dcj,            270);
	
	set_pcvar_num(kz_good_ladder,            150);	// ladder
	set_pcvar_num(kz_pro_ladder,             160);
	set_pcvar_num(kz_holy_ladder,            170);
	set_pcvar_num(kz_leet_ladder,            180);
	set_pcvar_num(kz_god_ladder,            190);
	
	set_pcvar_num(kz_good_bj,            230);	// bj sbj
	set_pcvar_num(kz_pro_bj,             235);
	set_pcvar_num(kz_holy_bj,            240);
	set_pcvar_num(kz_leet_bj,            245);
	set_pcvar_num(kz_god_bj,            247);
	
	set_pcvar_num(kz_good_wj,            255);	// wj dropcj ladderbhop
	set_pcvar_num(kz_pro_wj,             260);
	set_pcvar_num(kz_holy_wj,            265);
	set_pcvar_num(kz_leet_wj,            270);
	set_pcvar_num(kz_god_wj,            272);
	
	set_pcvar_num(kz_good_dbj,            240);	// 
	set_pcvar_num(kz_pro_dbj,             250);
	set_pcvar_num(kz_holy_dbj,            265);
	set_pcvar_num(kz_leet_dbj,            270);
	set_pcvar_num(kz_god_dbj,            272);
	
	set_pcvar_num(kz_good_scj,            240);	// 
	set_pcvar_num(kz_pro_scj,             245);
	set_pcvar_num(kz_holy_scj,            250);
	set_pcvar_num(kz_leet_scj,            255);
	set_pcvar_num(kz_god_scj,            256);
	
	set_pcvar_num(kz_min_dcj,            215);
	
	
	set_pcvar_num(kz_stats_red,        0);		
	set_pcvar_num(kz_stats_green,      255);
	set_pcvar_num(kz_stats_blue,       159);
	set_pcvar_num(kz_failstats_red,        255);		
	set_pcvar_num(kz_failstats_green,      0);
	set_pcvar_num(kz_failstats_blue,       109);
	set_pcvar_num(kz_sounds,           1);
	set_pcvar_num(kz_top_rank_by,        1);		// How ranking will work? 0=name, 1=ip 2=steam
	set_pcvar_num(kz_legal_settings,     1);
	set_pcvar_string(kz_prefix,       "unique-kz");
	set_pcvar_num(kz_airaccelerate,     0);
	
	set_pcvar_float(kz_stats_x,        -1.0);		
	set_pcvar_float(kz_stats_y,      0.70);
	set_pcvar_float(kz_strafe_x,        0.70);		
	set_pcvar_float(kz_strafe_y,      0.35);
	set_pcvar_float(kz_duck_x,        0.6);		
	set_pcvar_float(kz_duck_y,      0.78);
	set_pcvar_float(kz_speed_x,        -1.0);		
	set_pcvar_float(kz_speed_y,      0.83);
	
	set_pcvar_float(kz_prest_x,        -1.0);		
	set_pcvar_float(kz_prest_y,      0.65);
	
	set_pcvar_num(kz_speed_r,        255);		
	set_pcvar_num(kz_speed_g,      255);
	set_pcvar_num(kz_speed_b,        255);		
	set_pcvar_num(kz_prest_r,        255);		
	set_pcvar_num(kz_prest_g,      255);
	set_pcvar_num(kz_prest_b,        255);
	
	set_pcvar_num(hud_stats,        3);		
	set_pcvar_num(hud_streif,      4);
	set_pcvar_num(hud_pre,        1);		
	set_pcvar_num(hud_duck,      1);
	set_pcvar_num(hud_speed,      2);

	set_pcvar_num(kz_uq_light,      0);
	set_pcvar_string(kz_uq_connect, "abdehk");		// What is enabled at connect (0=nothing, a=colorchat, b=stats, c=speed, d=showpre,e=strafe stats,f=beam,g=duck stat fo mcj)

	set_pcvar_num(kz_uq_team, 0);
	set_pcvar_num(kz_uq_fps, 0);
	set_pcvar_num(kz_uq_top, 1);
	set_pcvar_num(kz_uq_maptop,1);
	

	set_pcvar_num(kz_uq_lj,1);	
	set_pcvar_num(kz_uq_cj,1);	
	set_pcvar_num(kz_uq_bj,1);	
	set_pcvar_num(kz_uq_sbj,1);	
	set_pcvar_num(kz_uq_wj,1);	
	set_pcvar_num(kz_uq_dcj,1);	
	set_pcvar_num(kz_uq_mcj,1);	
	set_pcvar_num(kz_uq_drbj,1);	
	set_pcvar_num(kz_uq_drsbj,1);	
	set_pcvar_num(kz_uq_drcj,1);	
	set_pcvar_num(kz_uq_ladder,1);	
	set_pcvar_num(kz_uq_ldbj,1);	
	
}
public krasnota(id)
{                
		message_begin(MSG_ONE, get_user_msgid("ScreenFade"), _, id);
		write_short(1<<10);
		write_short(1<<10);
		write_short(0x0000);
		write_byte(255);
		write_byte(0);
		write_byte(0);
		write_byte(110);
		message_end();
}

public sineva(id)
{                
		message_begin(MSG_ONE, get_user_msgid("ScreenFade"), _, id);
		write_short(1<<10);
		write_short(1<<10);
		write_short(0x0000);
		write_byte(0);
		write_byte(0);
		write_byte(255);
		write_byte(110);
		message_end();
}




public tskFps(id)
{
	if( get_pcvar_num(kz_legal_settings))
	{
		id-=434490;
		client_cmd(id, "developer 0;fps_max 101;cl_forwardspeed 400;cl_sidespeed 400;cl_backspeed 400");
	}
}
	

public fwdStartFrame()
{	
	if( get_pcvar_num(kz_legal_settings) )
	{
		if( get_pcvar_num(edgefriction) != 2 )
			set_pcvar_num(edgefriction, 2);
		
		if( get_pcvar_num(mp_footsteps) != 1 )
			set_pcvar_num(mp_footsteps, 1);
		
		if( get_pcvar_num(sv_cheats) != 0 )
			set_pcvar_num(sv_cheats, 0);
		
		if( get_pcvar_num(sv_gravity) != 800 )
			set_pcvar_num(sv_gravity, 800);
		
		if( get_pcvar_num( kz_airaccelerate ) )
		{
			if( get_pcvar_num(sv_airaccelerate) != 100 )
			set_pcvar_num(sv_airaccelerate, 100);
		}
		else
		{
			if( get_pcvar_num(sv_airaccelerate) != 10 )
			set_pcvar_num(sv_airaccelerate, 10);
		}
		
		if( get_pcvar_num(sv_maxspeed) != 320 )
			set_pcvar_num(sv_maxspeed, 320);
		
		if( get_pcvar_num(sv_stepsize) != 18 )
			set_pcvar_num(sv_stepsize, 18);
		
		if( get_pcvar_num(sv_maxvelocity) != 2000 )
			set_pcvar_num(sv_maxvelocity, 2000);
	}

	new Float:HLT = get_gametime();
	if(NC >= HLT)
	{
		FPS++;
	}
	else
	{
		NC = NC + 1;
	//LASTFPS = FPS;
		new rand = random_num(0,9);
		g_average[rand] = FPS;
		FPS = 0;
	}

}
public client_commands(id)
{
	static command[32];
	read_argv( 0, command, 31 );
	
	static const forbidden[][] = {
		"savepos","loadpos","sp","lp","cp+","ungocheck", "cp-", "ungc", "tele", "tp", "gocheck", "gc", "stuck", "unstuck", "start", "reset", "restart",
		"spawn", "respawn"
	};
	
	if( equal( command, "say" ) ) {
		read_args( command, 31 );
		remove_quotes( command );
	}
	
	if( equal( command, "+hook" ) ) {
		donehook[id]=true;
		//client_print(id,print_center,"rested");
		
	}
	else if( command[0] == '/' || command[0] == '.' || command[0] == '!') {
		copy( command, 31, command[1] );
		
		for( new i ; i < sizeof( forbidden ) ; i++ ) {
			if( equal( command, forbidden[i] ) ) {
				g_reset[id] = true;
				//remove_task(id);
				//client_print(id,print_center,"rested");
				break;
			}
		}
	}
	// hz perestraxovka ot buga s tp
	new cmd[21];
	read_argv(0,cmd,20);
	
	if(equal(cmd,"say")||equal(cmd,"say_team")){
		read_argv(1,cmd,20);
		trim(cmd);
		if( contain( cmd, " " ) > -1 ) return PLUGIN_CONTINUE;
	}
	
	if( equal(cmd,"/",1) || equal(cmd,"\",1) || equal(cmd,".",1) || equal(cmd,"!",1) )
		copy(cmd,20,cmd[1]);
	
	else if( equali(cmd,"gocheck") || equali(cmd,"gc") || equali(cmd,"tp")
		|| equali(cmd,"tele") || equali(cmd,"start") 
		|| equali(cmd,"reset") || equali(cmd,"spawn") 
		|| equali(cmd,"respawn") || equali(cmd,"restart")
		|| equali(cmd,"ungc") || equali(cmd,"ungocheck")
		|| equali(cmd,"cp-") || equali(cmd,"cp+")
		|| equali(cmd,"stuck") || equali(cmd,"unstuck")) {
		g_reset[id] = true;
		//remove_task(id);
		//client_print(id,print_center,"rested");
		
	}
	return PLUGIN_CONTINUE;
}
public wait(id)
{
	id-=3213;
	waits[id]=1;

}
public wait1(id)
{
	id-=3214;
	waits1[id]=1;

}

		


public fwdPlayerPreThink( id ) {

if(is_user_connected( id ))
{
new team;
if(get_pcvar_num(kz_uq_team)==0)
{
	team=0;
}
else if(cs_get_user_team(id)==CS_TEAM_T)
{
	team=1;
}
else if(cs_get_user_team(id)==CS_TEAM_CT)
{
	team=2;
}

if( is_user_alive( id ) && team==get_pcvar_num(kz_uq_team))
{	
	
	
	
	static bool:failed_ducking[33];
	static bool:first_frame[33],bool:started_multicj_pre[33];
	static Float:duckoff_time[33];
	static Float:duckoff_origin[33][3], Float:pre_jumpoff_origin[33][3];
	static Float:jumpoff_foot_height[33];
	static bool:failed_jump[33];	
	static Float:prest[33],Float:prest1[33],Float:jumpoff_origin[33][3],Float:failed_origin[33][3];
	static Float:frame_origin[33][2][3], Float:frame_velocity[33][2][3], Float:jumpoff_time[33], Float:last_land_time[33];
	
	
	new Float:HLT = get_gametime();
	if( g_nc[id] >= HLT)
	{
		g_fps[id]++;
	}
	else
	{
		g_nc[id] = g_nc[id] + 1.0;
		g_lastfps[id] = g_fps[id];
		g_fps[id] = 0;
	}
	
	
	
	stats_x=get_pcvar_float(kz_stats_x);
	stats_y=get_pcvar_float(kz_stats_y);
	strafe_x=get_pcvar_float(kz_strafe_x);
	strafe_y=get_pcvar_float(kz_strafe_y);
	duck_x=get_pcvar_float(kz_duck_x);
	duck_y=get_pcvar_float(kz_duck_y);
	
	//MIN_DISTANCE=get_pcvar_num(kz_min_dcj);	
	weapSpeedOld[id] = weapSpeed[id];

	//reset
	if( g_reset[id] ==true) {
		g_reset[id]	= false;
		g_Jumped[id]	= false;
		cjjump[id] =false;
		in_air[id]	= false;
		in_duck[id]	= false;
		in_bhop[id]	= false;
		ducks[id]=0;
		chit[id]=0;
		ducks[id]=0;
		failed_jump[id] = false;
		prest[id]=0.0;
		prestrafe[id]=250.0;
		//ColorChat(id, GREY, "reset");
		//oldorig[id][0]=jumpoff[0];
		//oldorig[id][1]=jumpoff[1];
		//oldorig[id][2]=jumpoff[2];
		pre_type1[id] = "adin";
		pre_type[id]="";
		first_surf[id]=false;
		surf[id]=0.0;
		bhopfail[id]=false;
		ddbeforwj[id]=false;
		duckstring[id]=false;
		notjump[id]=false;
		frames_gained_speed[id] = 0;
		frames[id]	= 0;
		strafe_num[id] = 0;
		ladderjump[id]=false;
		started_multicj_pre[id]	= false;
		started_cj_pre[id]		= false;
		jumpoffirst[id]=false;
		jump_type[id]	= Type_None;
		//olddist[id]=0.0;
		gBeam_count[id] = 0;
		for( new i = 0; i < 100; i++ ) {
			gBeam_points[id][i][0]	= 0.0;
			gBeam_points[id][i][1]	= 0.0;
			gBeam_points[id][i][2]	= 0.0;
			gBeam_duck[id][i]	= false;
		}
	}
	//get_user_fps(id,);
	//tskFps(id);
	//ColorChat(id, GREY, "distanciya %f",distance);
	
	
	
	static button, oldbuttons, flags;
	pev(id, pev_maxspeed, weapSpeed[id]);
	pev(id, pev_origin, origin);
	button = pev(id, pev_button );
	flags = pev(id, pev_flags );
	
	
	oldbuttons = pev( id, pev_oldbuttons );
	
	//static Float:origin[3];
	
	static Float:fGravity;
	pev(id, pev_gravity, fGravity);
	
	new Float:velocity[3];
	pev(id, pev_velocity, velocity);
	movetype[id] = pev(id, pev_movetype);
	
	if( flags&FL_ONGROUND && flags&FL_INWATER )  //??
			velocity[2] = 0.0;
	fSpeed = vector_length(velocity);
	
	if( velocity[2] != 0 )
		velocity[2]-=velocity[2];
	speed = vector_length(velocity);
	
	for( new i = INFO_ONE; i < 33; i++ )
		{
			if( (i == id || is_user_spectating_player(i, id)))
			{	
				if(speedon[i]==true)
				{	
					set_hudmessage(get_pcvar_num(kz_speed_r), get_pcvar_num(kz_speed_g), get_pcvar_num(kz_speed_b), get_pcvar_float(kz_speed_x), get_pcvar_float(kz_speed_y), 0, 0.0, 0.1, 0.0, 0.0, get_pcvar_num(hud_speed));
					show_hudmessage(i, "%d units/sec",floatround(speed, floatround_floor));//floatround(speed, floatround_floor));
				}
			}
		}
	
	new airace,aircj;
	if( get_pcvar_num( kz_airaccelerate ) )
	{
		airace=100;
		formatex(airacel[id],31,"(100aa)");
		aircj=15;
	}
	else
	{
		airace=10;
		aircj=0;
		formatex(airacel[id],31,"");
	}
	new spd;
	if(equal(mapname,"slide_gs_longjumps") || equal(mapname,"b2j_slide_longjumps"))
	{
		spd=1400;
	}
	else spd=385;
	
	if(speed> spd
		|| fGravity != 1.0
		|| get_pcvar_num(edgefriction) != 2
		|| get_pcvar_num(mp_footsteps) != 1
		|| get_pcvar_num(sv_cheats) != 0
		|| get_pcvar_num(sv_gravity) != 800
		|| get_pcvar_num(sv_airaccelerate) != airace
		|| get_pcvar_num(sv_maxspeed) != 320
		|| get_pcvar_num(sv_stepsize) != 18
		|| get_pcvar_num(sv_maxvelocity) != 2000
		|| pev(id, pev_waterlevel) >= 2 
		|| weapSpeedOld[id] != weapSpeed[id])
	
		{
			JumpReset(id);
		//ColorChat(id, GREEN, "reset121");
			return FMRES_IGNORED;
		}

	
	//new Float:kalpak[3];
	//pev(id, pev_fuser2,kalpak);
	//ColorChat(id, GREEN, "reset2 %f",kalpak[2]);
		
	if( !(flags&FL_ONGROUND) )
		last_land_time[id] = get_gametime();
		
	//if(bhopaem[id]==true && oldbuttons&IN_JUMP)
	//{
		//bhopaem[id]=false;
		//ColorChat(id, GREY, "bhopaem false %f ",jumpoff_origin[id][2]-origin[2]);
	//}
	//else 
	
	if(bhopaem[id]==true && flags&FL_ONGROUND && (oldbuttons&IN_FORWARD || oldbuttons&IN_BACK))
	{
			
		bhopaem[id]=false; //todo zdelat norm anti multi bhop
	}
	//ColorChat(id, GREY, "bhopaem %f ",jumpoff_origin[id][2]-origin[2]);
	if(flags&FL_ONGROUND)	
	{	
		
		
	//ColorChat(id,GREEN,"zemlya");
		
		if(donehook[id]==true)
		{
			donehook[id]=false;
			//ColorChat(id,GREEN,"hook off");
			JumpReset(id);
			set_task(0.4,"JumpReset", id);
			//ColorChat(id, GREEN, "reset2");
			return FMRES_IGNORED;
			
		}
	}
	
	
	
	if(flags & FL_ONGROUND && (jump_type[id]==Type_Drop_BhopLongJump || jump_type[id]==Type_Drop_StandBhopLongJump || jump_type[id]==Type_Drop_CountJump1) && firstdrop[id]==false)
	{
		dropstime[id]=get_gametime();
		firstdrop[id]=true;
	}	
	if((movetype[id] != MOVETYPE_FLY))	
	{
		if(firstfr[id]==false)
		{
			firstfr[id]=true;
			pev(id, pev_velocity, velocity);
			pev(id, pev_origin, origin);
			if((g_Jumped[id]==true || !(flags&FL_ONGROUND)))
			{
				firstvel[id]=velocity[2];
			}
			firstorig[id]=origin;
			//timefirst[id]=get_gametime();
			
			//ColorChat(id,GREEN,"first %f",velocity[2]);
		}
		else if(firstfr[id]==true )
		{
			pev(id, pev_origin, origin);
			pev(id, pev_velocity, velocity);
			//ColorChat(id,GREEN,"second %f",velocity[2]);
			secorig[id]=origin;
			if((g_Jumped[id]==true || !(flags&FL_ONGROUND)))
			{
				secvel[id]=velocity[2];
			}
			firstfr[id]=false;
			
			//timesecond[id]=get_gametime();
			
		}
		
		if(!(flags&FL_ONGROUND) && floatabs(firstvel[id]-secvel[id])<7.0 && floatabs(firstvel[id]-secvel[id])!=4.0)
		{
			//ColorChat(id,RED,"Surf");
			if(equal(mapname,"slide_gs_longjumps") || equal(mapname,"b2j_slide_longjumps"))
			{
				slide[id]=true;
				//ColorChat(id,RED,"Surf");
			}
			else if(jump_type[id]!=Type_ladderBhop)
			{
			//if(((oldbuttons&IN_MOVELEFT && buttons&IN_MOVERIGHT) ||  (oldbuttons&IN_MOVERIGHT && buttons&IN_MOVELEFT) ) && (!(buttons&IN_FORWARD) || !(buttons&IN_BACK)))	
			//{
				//first_slide[id]=true;
				
			//}/
				//ColorChat(id,RED,"reset z");
				JumpReset(id);
				set_task(0.8,"JumpReset", id);
				return FMRES_IGNORED;
			}
		}
		else 
		{
			if(slide[id]==true && ((oldbuttons&IN_MOVELEFT && buttons&IN_MOVERIGHT) || (oldbuttons&IN_MOVERIGHT && buttons&IN_MOVELEFT)))
			{
				//if(oldbuttons&IN_MOVELEFT && buttons&IN_MOVERIGHT)
				//slidetype[id]=1;
				//else slidetype[id]=0;
				
				remove_task(id);
				set_task(1.5,"JumpReset", id);
				//ColorChat(id, GREEN, "reset7");
				//ColorChat(id, GREEN, "reset7");
				
				pev(id, pev_origin, origin);
				
				slidim[id]=true;
				jump_type[id]=Type_Slide;
				
				g_Jumped[id]	= true;
				//first_frame[id] = true;
				prestrafe[id]	= speed;
						
				
				
				if(showpre[id]==true)
				{
					set_hudmessage(255,255, 255, -1.0, 0.85, 0, 0.0, 0.7, 0.1, 0.1, 2);
					show_hudmessage(id, "slide pre: %.03f",speed);
				}
				slide[id]=false;
			}
		}
		
		firstorig[id][2]=0.0;
		secorig[id][2]=0.0;
		//ColorChat(id,RED,"reset %f",get_distance_f(firstorig[id],secorig[id]));
		if((slidim[id]==true || slide[id]==true) && get_distance_f(firstorig[id],secorig[id])>20.0)
		{
			//ColorChat(id,RED,"reset %f",get_distance_f(firstorig[id],secorig[id]));
			groundslide[id]=0.0;
			waits[id]=0;
			slidim[id]=false;
			taskslide[id]=0;
			failslide[id]=false;
			slide[id]=false;
			g_Jumped[id]	= false;
			//ColorChat(id, GREEN, "reset3");
			return FMRES_IGNORED;
		}
		//ColorChat(id,GREEN,"sub %f",get_distance_f(firstorig[id],secorig[id]));
		if(g_Jumped[id]==true && get_distance_f(firstorig[id],secorig[id])>6.0)
		{
			
			//ColorChat(id,RED,"reset %f",get_distance_f(firstorig[id],secorig[id]));
			JumpReset(id);
			//ColorChat(id, GREEN, "reset1223");
			return FMRES_IGNORED;
		}
	}
	if(slidim[id]==true)
	{
		
		if(pev(id, pev_maxspeed) != 250.0)
		{
			client_print(id,print_center,"Slide works only withs weapons 250.0 speed"); 
			return FMRES_IGNORED;
		}
		
		pev(id, pev_origin, origin);
		new Float:start[33][3],Float:end[33][3];
		
	
		start[id][0]=origin[0];
		start[id][1]=origin[1]+16.0;
		start[id][2]=origin[2];
		end[id][0]=origin[0];
		end[id][1]=origin[1]+16.0;
		end[id][2]=origin[2]-500.0;
		
		engfunc(EngFunc_TraceLine, start[id], end[id], IGNORE_GLASS, id, 0); 
		get_tr2( 0, TR_vecEndPos, slidez[id][0]);
		//ColorChat(0, RED, "Raznica %f",slidez[0][2]);
		start[id][0]=origin[0];
		start[id][1]=origin[1]-16.0;
		start[id][2]=origin[2];
		end[id][0]=origin[0];
		end[id][1]=origin[1]-16.0;
		end[id][2]=origin[2]-500.0;
		
		engfunc(EngFunc_TraceLine, start[id], end[id], IGNORE_GLASS, id, 0); 
		get_tr2( 0, TR_vecEndPos, slidez[id][1]);
		
		start[id][0]=origin[0]+16.0;
		start[id][1]=origin[1];
		start[id][2]=origin[2];
		end[id][0]=origin[0]+16.0;
		end[id][1]=origin[1];
		end[id][2]=origin[2]-500.0;
		
		engfunc(EngFunc_TraceLine, start[id], end[id], IGNORE_GLASS, id, 0); 
		get_tr2( 0, TR_vecEndPos, slidez[id][2]);
		
		start[id][0]=origin[0]-16.0;
		start[id][1]=origin[1];
		start[id][2]=origin[2];
		end[id][0]=origin[0]-16.0;
		end[id][1]=origin[1];
		end[id][2]=origin[2]-500.0;
		
		engfunc(EngFunc_TraceLine, start[id], end[id], IGNORE_GLASS, id, 0); 
		get_tr2( 0, TR_vecEndPos, slidez[id][3]);
		
		for(new i=0;i<4;i++)
		{
			
					
			if(i!=3)
			{
				if(slidez[id][i][2]>slidez[id][i+1][2])
				{
					
					needslide[id]=slidez[id][i][2];
					groundslide[id]=slidez[id][i+1][2];
				//	ColorChat(0, RED, "Raznica z %f",needslide[id]-groundslide[id]);
					if(needslide[id]-groundslide[id]>149.0 && landslide[id]==false)
					{
						landslide[id]=true;
						pev(id, pev_origin, origin);
						if( !(is_user_ducking(id)) )
						{
							origin[2]-=36.0;
						}
						else origin[2]-=18.0;
						slideland[id]=origin[2];
						slidedist[id]=slideland[id]-groundslide[id];
						maxspeed[id]=speed;
						//last_land_time[id]=get_gametime( );
						//ColorChat(0, RED, "Raznica z %f",slidedist[id]);
					}
				}
				//else failslide[id]=true;
			}
			
			
		}
	
		
		
		if(taskslide[id]==0)
		{
			set_task(0.4,"wait", id+3213);
			//ColorChat(id, GREY, "wat %d",waits[id]);
			taskslide[id]=1;
		}
		pev(id, pev_velocity, velocity);
		//ColorChat(id, GREY, "watzz %f",velocity[1]);
		if(velocity[1]==0.0 && failslide[id]==false && !(flags&FL_ONGROUND) && waits[id]==1 )
		{
			//ColorChat(id, GREY, "frac %f",origin[2]);
			if( !(is_user_ducking(id)) )
			{
				origin[2]-=36.0;
			}
			else origin[2]-=18.0;
			failslidez[id]=origin[2];
			failslide[id]=true;
			//maxspeed[id]=speed;
			//ColorChat(id, RED, "watzz %f",velocity[1]);
			
			
			
		}
		
		
	}
	
	if(flags&FL_ONGROUND && slidim[id]==true && pev(id, pev_maxspeed) == 250.0)
	{
		
		
		for( new i = INFO_ONE; i < 33; i++ )
		{
			if( (i == id || is_user_spectating_player(i, id)) && g_lj_stats[i]==true)
				{
					
					if(needslide[id]-groundslide[id]==slidedist[id])
					{
						client_print(i, print_console, "Distance: %d.xxx Maxspeed: %f^nPrestrafe: %f",floatround(slidedist[id], floatround_floor), maxspeed[id],prestrafe[id]);
						set_hudmessage( get_pcvar_num(kz_stats_red), get_pcvar_num(kz_stats_green), get_pcvar_num(kz_stats_blue), stats_x, stats_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_stats) );	
						show_hudmessage( i, "Slide Distance: %d.xxx^nMaxspeed: %f^nPrestrafe: %f",floatround(slidedist[id], floatround_floor), maxspeed[id],prestrafe[id]);
					}
					else
					{
						client_print(i, print_console, "Distance: %f Maxspeed: %f^nPrestrafe: %f",slidedist[id], maxspeed[id],prestrafe[id]);
						set_hudmessage(get_pcvar_num(kz_stats_red), get_pcvar_num(kz_stats_green), get_pcvar_num(kz_stats_blue), stats_x, stats_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_stats) );	
						show_hudmessage( i, "Slide Distance: %f^nMaxspeed: %f^nPrestrafe: %f",slidedist[id], maxspeed[id],prestrafe[id]);
					
					}
				}
		}
		//^nMaxspeed: %f (%.03f)^nPrestrafe: (%.01f) (%.01f) %f^nStrafes: %d^nSync: %d%%^n", type, distance[id], maxspeed[id], gain[id], prest1[id],prest[id], prestrafe[id],strafe_num[id], sync_[id]);
						
		new iPlayers[32],iNum; 
		get_players ( iPlayers, iNum,"ch") ;
		for(new i=0;i<iNum;i++) 
		{ 
			new ids=iPlayers[i]; 
			if(gHasColorChat[ids] ==true || ids==id)
			{	
				static name[32];
				get_user_name(id, name, 31);
				if(needslide[id]-groundslide[id]==slidedist[id])
				{
					ColorChat(ids, GREY, "[%s] %s jumped %d.xxx units with Slide lj!^x01%s",prefix, name, floatround(slidedist[id], floatround_floor),airacel[id]);
				}
				else 
				ColorChat(ids, GREY, "[%s] %s jumped %.3f units with Slide lj!^x01%s",prefix, name, slidedist[id],airacel[id]);
				
				
			}
		}
							
		slidim[id]=false;
		groundslide[id]=0.0;
		waits[id]=0;
		slidim[id]=false;
		taskslide[id]=0;
		taskslide1[id]=0;
		
		message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id);
		write_byte ( TE_BEAMPOINTS );
		write_coord(floatround(origin[0]));
		write_coord(floatround(origin[1]));
		write_coord(floatround(slideland[id]));
		write_coord(floatround(origin[0]));
		write_coord(floatround(origin[1]+52.0));
		write_coord(floatround(slideland[id]));
	
		write_short(gBeam);
		write_byte(1);
		write_byte(5);
		write_byte(1130);
		write_byte(20);
		write_byte(0);
		write_byte(255);
		write_byte(0);
		write_byte(0);
		
		write_byte(200);
		write_byte(200);
		message_end();
		landslide[id]=false;
		
	}
	if((failslide[id]==true) && slidim[id]==true)
	{
		
		
		for( new i = INFO_ONE; i < 33; i++ )
		{
			if( (i == id || is_user_spectating_player(i, id)) && g_lj_stats[i]==true)
				{
				client_print(i, print_console, "Slide Distance: %f Prestrafe: %f",failslidez[id]-groundslide[id],prestrafe[id]);
		
				set_hudmessage( get_pcvar_num(kz_failstats_red), get_pcvar_num(kz_failstats_green), get_pcvar_num(kz_failstats_blue), stats_x, stats_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_stats) );
				show_hudmessage( i, "Slide Distance: %f^nPrestrafe: %f",failslidez[id]-groundslide[id],prestrafe[id]);
				}
		}
		message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id);
		write_byte ( TE_BEAMPOINTS );
		write_coord(floatround(origin[0]));
		write_coord(floatround(origin[1]));
		write_coord(floatround(failslidez[id]));
		write_coord(floatround(origin[0]));
		write_coord(floatround(origin[1]+52.0));
		write_coord(floatround(failslidez[id]));
		
		write_short(gBeam);
		write_byte(1);
		write_byte(5);
		write_byte(1130);
		write_byte(20);
		write_byte(0);
		write_byte(255);
		write_byte(0);
		write_byte(0);
		
		write_byte(200);
		write_byte(200);
		message_end();
		//ColorChat(id, RED, "zemlya %f",groundslide[id]);
		failslide[id]=false;
		slidim[id]=false;
		groundslide[id]=0.0;
		waits[id]=0;
		taskslide[id]=0;
		taskslide1[id]=0;
		//ColorChat(id, GREY, "watf %d",waits[id]);
	}
	
	
	if( (in_air[id]==true || in_bhop[id] == true) && !(flags&FL_ONGROUND) )
		{
			static i;
			for( i = INFO_ZERO; i < 2; i++ )
			{
				if( (i == 1) 
				|| (frame_origin[id][i][0] == 0
				&& frame_origin[id][i][1] == 0
				&& frame_origin[id][i][2] == 0 
				&& frame_velocity[id][i][0] == 0
				&& frame_velocity[id][i][1] == 0
				&& frame_velocity[id][i][2] == 0 )) 
				{
					//pev(id, pev_origin, vOrigin);
					frame_origin[id][i][0] = origin[0];
					frame_origin[id][i][1] = origin[1];
					frame_origin[id][i][2] = origin[2];
					
					pev(id, pev_velocity, velocity);
					frame_velocity[id][i][0] = velocity[0];
					frame_velocity[id][i][1] = velocity[1];
					frame_velocity[id][i][2] = velocity[2];
					i=2;
				}
			}
			
		}
	
	if( in_air[id] && !( flags & FL_ONGROUND ) && !failed_jump[id] )
	{	
	
		
		
		
		
			
		if( !in_bhop[id] )
		{
			fnSaveBeamPos( id );
			
			
		}
		static Float:old_speed[33];
		if( speed > old_speed[id] )
		{
			frames_gained_speed[id]++;
		}
		frames[id]++;
		
		old_speed[id] = speed;
		
		//stupid streif speed
		/*if( speed > maxspeed[id] )
		{
			maxspeed[id] = speed;
			if (strafe_num[id] < NSTRAFES ) 
			{
			aa[id][strafe_num[id]+1]=maxspeed[id]-prestrafe[id];
			strafe_stat_speed[id][strafe_num[id]][0]=aa[id][strafe_num[id]+1]-aa[id][strafe_num[id]];
			}
		}*/
		
		//dlya stat streifs
		if( speed > maxspeed[id] )
		{
			if (strafe_num[id] < NSTRAFES)
			{
				strafe_stat_speed[id][strafe_num[id]][0] += speed - maxspeed[id];
			}
			maxspeed[id] = speed;
		}
		if ((speed < TempSpeed[id]) && (strafe_num[id] < NSTRAFES))
		{
			strafe_stat_speed[id][strafe_num[id]][1] += TempSpeed[id] - speed;
			
		}
		TempSpeed[id] = speed;
		
		if(strafe_stat_speed[id][strafe_num[id]][0]>40.0 && jump_type[id]!=Type_ladder && jump_type[id]!=Type_Slide)
		{
			//ColorChat(id,GREY,"Surf");
			JumpReset(id);
			//ColorChat(id, GREEN, "reset412");
			return FMRES_IGNORED;
		}
		
		
		//if(jump_type[id] == Type_ladder) 
		//{
			
		//}
		//esli yebalis, todo: kak kill duck pri fail stat??
		//ColorChat(id,RED,"vata= %f",origin[2] + 18.0 - jumpoff_origin[id][2]);
		if( (origin[2] + 18.0 - jumpoff_origin[id][2] < 0))
		{
			failed_jump[id] = true;
			
			failed_ducking[id] = is_user_ducking( id );
			
			static Float:jumpoff_z_origin;
			jumpoff_z_origin = jumpoff_origin[id][2];
			if( failed_ducking[id] )
			{
				jumpoff_z_origin -= 18.0;
				origin[2] -= 18.0;
			}
			
			static Float:temp;
			temp = ( jumpoff_z_origin - failed_origin[id][2] ) / ( origin[2] - failed_origin[id][2] );

			failed_origin[id][0] = temp * ( origin[0] - failed_origin[id][0] ) + failed_origin[id][0];
			failed_origin[id][1] = temp * ( origin[1] - failed_origin[id][1] ) + failed_origin[id][1];
			failed_origin[id][2] = jumpoff_z_origin;
			
			//return FMRES_IGNORED;
		}
		else
		{
				failed_jump[id]= false;
				failed_origin[id] = origin;
				origin[2] = pre_jumpoff_origin[id][2];
				//ColorChat(id, GREY, "da eto bj %f",pre_jumpoff_origin[id][2]);//y orig = y pri tolchke
		}
		if( first_frame[id] ) 
		{
			first_frame[id] = false;
			
			//frame_origin[id][0] = origin;
			frame_velocity[id][0] = velocity; //hz zachem
			
			gBeam_count[id] = 0;
			for( new i = 0; i < 100; i++ ) {
			gBeam_points[id][i][0]	= 0.0;
			gBeam_points[id][i][1]	= 0.0;
			gBeam_points[id][i][2]	= 0.0;
			gBeam_duck[id][i]	= false;
			}
			
			
			if( in_bhop[id] )
			{
				//ColorChat(id, RED, "Bhop&");
				if( velocity[2] < 229.0)
				{
					jump_type[id] = Type_BhopLongJump;
					formatex(Jtype[id],31,"BhopJump");
					formatex(Jtype1[id],31,"bj");
					//ColorChat(id, GREY, "da eto bj %f",velocity[2]);
					
				
				}
				else 
				{
				
					jump_type[id] = Type_StandupBhopLongJump;
					formatex(Jtype[id],31,"StandUp BhopJump");
					formatex(Jtype1[id],31,"sbj");
					//ColorChat(id, GREY, "da eto sbj %f",velocity[2]);
					jumpoff_origin[id][2] = pre_jumpoff_origin[id][2];
				}
				
				
			}
			
			
			
		} 
		else
		{	
						
			//frame_origin[id][1] = origin;
			frame_velocity[id][1] = velocity;//hz zachem
		}
		if( in_bhop[id] )
		fnSaveBeamPos( id );
	}
	
	
	if( flags&FL_ONGROUND )
		{
			//ColorChat(id, GREY, "dgr re2 %f",get_gametime()-doubletime[id]);
		
			surf[id]=0.0;
			if (!pev( id, pev_solid ))
			{
				static ClassName[32];
				pev(pev(id, pev_groundentity), pev_classname, ClassName, 32);
	
				if( equal(ClassName, "func_train")
					|| equal(ClassName, "func_conveyor") 
					|| equal(ClassName, "trigger_push") || equal(ClassName, "trigger_gravity"))
				{
					JumpReset(id);
					//ColorChat(id, GREY, "dgr re2");
					set_task(0.4,"JumpReset", id);
					
					
				}
				else if(equal(ClassName, "func_door") || equal(ClassName, "func_door_rotating") )
				{
					JumpReset(id);
					//ColorChat(id, GREY, "dgr re1");
					set_task(0.4,"JumpReset", id);	
					
				}
			}
			pev(id, pev_origin, origin);
			//ColorChat(id,GREY,"Ground z= %f",origin[2]);
			notjump[id]=true;
			falloriginz[id]=origin[2];
			//ColorChat(id,GREY,"Ground z= %f",falloriginz[id]);
			if( OnGround[id] == false)
			{	
				
				
				if (jump_type[id] == Type_WeirdLongJump || jump_type[id]==Type_Drop_CountJump1 || jump_type[id]==Type_ladderBhop)
				{
					pev(id, pev_origin, vFallAt[id]);
				//	ColorChat(id,GREY,"x= %f y= %f z= %f",vFallAt[id][0],vFallAt[id][1],vFallAt[id][2]);
		
					//ColorChat(id,GREEN,"x= %f y= %f z= %f",vFallAt[id][0],vFallAt[id][1],0.0);
					//client_print(id, print_console,"da etoje WJ");//1111
				}
				if (jump_type[id] == Type_WeirdLongJump || jump_type[id]==Type_Drop_CountJump1 || jump_type[id]==Type_Drop_BhopLongJump || jump_type[id]==Type_Drop_StandBhopLongJump || jump_type[id]==Type_ladderBhop)
				{
					pev(id, pev_origin, vFallAt1[id]);
				}
				OnGround[id] = true;
			}

		}
	
	if( !(flags&FL_ONGROUND) && notjump[id]==true && (movetype[id] != MOVETYPE_FLY) && jump_type[id]!=Type_ladderBhop )//&& jump_type[id] != Type_Drop_CountJump1)
	{	
		//if(oldbuttons&IN_JUMP)
		//{
		//	notjump[id]=false;
		//}
		//ColorChat(id,GREEN,"jump na wj");
		pev(id, pev_origin, origin);
		
		
		OnGround[id] = false;
		//ColorChat(id,GREY,"Ground false1");
		//last_land_time[id] = get_gametime();
		pev(id, pev_velocity, velocity);
		
		
		
		
		//ColorChat(id,GREY,"Hm= %f",falloriginz[id]-origin[2]);
		if(falloriginz[id]-origin[2]>1.0 && jump_type[id] == Type_None)//jump_type[id] != Type_Drop_BhopLongJump && jump_type[id] != Type_Drop_StandBhopLongJump && jump_type[id] != Type_WeirdLongJump && jump_type[id] != Type_Drop_CountJump1 && jump_type[id] != Type_ladder && jump_type[id] != Type_CountJump && jump_type[id] != Type_Multi_Count && jump_type[id] != Type_Multi_CountJump)
		{
			oldjump_type[id]=0;
			//ColorChat(id, GREEN, "oldtype all");
			jump_type[id] = Type_WeirdLongJump;	
			formatex(Jtype[id],31,"WeirdJump");
			formatex(Jtype1[id],31,"wj");
			
			//ColorChat(id,GREY,"DA eto wj");
			//notjump[id]=false;
			//ColorChat(id,GREY,"fall= %f fly z=%f",falloriginz[id],origin[2]);
		}
		//ColorChat(id,GREEN,"Fly z= %f",velocity[2]);
		if (velocity[2] == -240.0)
		{
				
				oldjump_type[id]=0;
				//ColorChat(id, GREEN, "dd+wj");
				ddbeforwj[id]=true;
				jump_type[id] = Type_WeirdLongJump;	
				formatex(Jtype[id],31,"WeirdJump after dd");
				formatex(Jtype1[id],31,"dd+wj");
				//dropcj[id]=true;
				//dropbhop[id]=false;
				//wierdjump[id]=false;
				//first_onground[id]=false;
				//notjump[id]=false;
				//ColorChat(id, GREY, "WeirdJump after dd");
				//jump_type[id] = Type_Drop_CountJump1;
				//formatex(Jtype[id],31,"Drop CountJump");
				//formatex(Jtype1[id],31,"dropcj");
				
			//	drop[id]=get_gametime( );
				
		}
		/*
			{
				//ColorChat(id, GREY, "opachki");
			//if( jumpoff_time[id] - duckoff_time[id] >= 0.3 )
			//{
			//	wierdjump[id]=true;//jump_type[id] = Type_WeirdLongJump;
			//	dropcj[id]=false;
			//	dropbhop[id]=false;
			//	first_onground[id]=false;
				//ColorChat(id, GREY, "opachki2");
			jump_type[id] = Type_WeirdLongJump;	
			formatex(Jtype[id],31,"WeirdJump");
			formatex(Jtype1[id],31,"wj");
			formatex(Jtype1[id],31,"wj");
			//ColorChat(id,GREY,"DA eto wj = %f",velocity[2]);
				
			//}
			}*/
	}
	else if(!(flags&FL_ONGROUND) && notjump[id]==false && jump_type[id] != Type_Drop_CountJump1 && jump_type[id] != Type_WeirdLongJump && jump_type[id] != Type_Drop_CountJump && jump_type[id] != Type_Multi_CountJump && jump_type[id] != Type_Multi_Count && jump_type[id] != Type_CountJump && jump_type[id] != Type_CountJumpafterDrop && (movetype[id] != MOVETYPE_FLY) && jump_type[id]!=Type_ladderBhop && jump_type[id]!=Type_BhopLongJump && jump_type[id]!=Type_StandupBhopLongJump && jump_type[id] != Type_Slide)
	{
		
		oldjump_type[id]=0;
		OnGround[id] = false;
		//ColorChat(id,GREY,"Ground false2");
		//last_land_time[id] = get_gametime();
		pev(id, pev_velocity, velocity);
		pev(id, pev_origin, origin);
		//client_print(id,print_console,"speed=%f",velocity[2]);
		//ColorChat(id,GREEN,"dbj z= %f",dropbjorigin[id][2]);
		//ColorChat(id,GREEN,"aa z= %f",dropbjorigin[id][2]-origin[2]);
		new Float:drbh;
		if(is_user_ducking(id))
		{
			drbh=50.0;
		}
		else drbh=32.0;
		
		if (dropbjorigin[id][2]-origin[2]>drbh)
		{
			jump_type[id] = Type_Drop_BhopLongJump;
			formatex(Jtype[id],31,"Drop Bhop");
			formatex(Jtype1[id],31,"drbj");
			//ColorChat(id, GREY, "da eto drop bj");
			
			
		
			remove_task(id);
			//dropbjorigin[id][0]=origin[0];
			//dropbjorigin[id][1]=origin[1];
			//client_print(id,print_console,"dbj = %f",velocity[2]);
			//dropbhop[id]=true;
			//wierdjump[id]=false;
			//dropcj[id]=false;
			//first_onground[id]=false;
		}
	}
	if(jump_type[id]==Type_Drop_BhopLongJump && flags & FL_ONGROUND)
	{
		dropbjtime[id]=get_gametime();
	}
	if( movetype[id] == MOVETYPE_FLY) 
	{
		OnGround[id] = false;
		firstvel[id]=8.0;
		secvel[id]=0.0;
		//ColorChat(id,GREY,"Ground false3");
	}
	if( (movetype[id] == MOVETYPE_FLY) &&  (button&IN_FORWARD || button&IN_BACK || button&IN_LEFT || button&IN_RIGHT ) )
	{
		//ColorChat(id,RED,"x=%f y=%f z=%f",origin[0],origin[1],origin[2]);
		//ColorChat(id,GREEN,"x=%f y=%f z=%f",ladderxyz[0][0],ladderxyz[0][1],ladderxyz[0][2]);
		
		ladderjump[id]=true;
		for(new i=0;i<nLadder;i++)
		{
			//if((ladderxyz[i][0]+34.0<origin[0] || origin[0]<ladderxyz[i][0]-34.0) && (ladderxyz[i][1]+34.0<origin[1] || origin[1]<ladderxyz[i][1]-34.0) && (ladderxyz[i][2]+34.0<origin[2] || origin[2]<ladderxyz[i][2]-34.0))
			
			if((ladderxyz[i][0]-origin[0]<34.0) && (ladderxyz[i][1]-origin[1]<34.0) && (ladderxyz[i][2]<origin[2]))
			{
				nashladder=i;
			//	ColorChat(id,RED,"Sosisa %d",nashladder);
		
			}
		}
		prestrafe[id]	= speed;
		maxspeed[id]	= speed;
		
			
		
	}
	if( (movetype[id] == MOVETYPE_FLY) &&  button&IN_JUMP )
	{
		
		jump_type[id]=Type_ladderBhop;
		remove_task(id);
		//oldjump_typ1[id]=1;
		formatex(Jtype[id],31,"Ladder BhopJump");
		formatex(Jtype1[id],31,"ldbj");
		ladderjump[id]=false;
		in_air[id]=false;
		bhopaem[id]=false;
		//ColorChat(id,RED,"eto ldbhop ");
		
	}
	if( movetype[id] != MOVETYPE_FLY && ladderjump[id]==true)
	{
		remove_task(id);
		set_task(1.0,"JumpReset", id);
		//ColorChat(id, GREEN, "reset7zz");
		//ColorChat(id, GREEN, "reset7");
		pev(id, pev_origin, origin);
		jumpoff_origin[id] = origin;
		jumpoff_origin[id][2]=ladderxyz[nashladder][2]+35.031250;
		//ColorChat(id,RED,"mm=%f",jumpoff_origin[id][2]);
		
		jumpoff_time[id] = get_gametime( );
		strafecounter_oldbuttons[id] = INFO_ZERO;
		najalw=0;
		
		jump_type[id]=Type_ladder;
		//entity_set_float(id,EV_FL_fuser2,1325.0);
		formatex(Jtype[id],31,"LadderJump");
		formatex(Jtype1[id],31,"ldj");
		//ColorChat(id,RED,"x=%f y=%f z=%f",laddersize[nashladder][0],laddersize[nashladder][1],laddersize[nashladder][2]);
		if(laddersize[nashladder][0]<=laddersize[nashladder][1])
		{
			laddist[id]=laddersize[nashladder][0]+0.0625;
		}
		else if(laddersize[nashladder][0]>laddersize[nashladder][1])
		{
			laddist[id]=laddersize[nashladder][1]+0.0625;
		}
	
		ladderjump[id]=false;	
		TempSpeed[id] = 0.0;
		static i;
		for( i = INFO_ZERO; i < NSTRAFES; i++ )
		{
			strafe_stat_speed[id][i][0] = 0.0;
			strafe_stat_speed[id][i][1] = 0.0;
			strafe_stat_sync[id][i][0] = INFO_ZERO;
			strafe_stat_sync[id][i][1] = INFO_ZERO;
			strafe_stat_time[id][i] = 0.0;
			
		}
		in_air[id]	= true;
		g_Jumped[id]	= true;
		first_frame[id] = true;
		
		//prestrafe[id]	= speed;
		//maxspeed[id]	= speed;
		
		turning_right[id] = false;
		turning_left[id] = false;
		//strafing_aw[id] = false;
		//strafing_sd[id] = false;
		for( i = INFO_ZERO; i < 2; i++ )
		{
			frame_origin[id][i][0] = 0.0;
			frame_origin[id][i][1] = 0.0;
			frame_origin[id][i][2] = 0.0;
			
			frame_velocity[id][i][0] = 0.0;
			frame_velocity[id][i][1] = 0.0;
			frame_velocity[id][i][2] = 0.0;
		}
		for( i = INFO_ONE; i < 33; i++ )
		{
			if( (i == id || is_user_spectating_player(i, id)))
			{
				if(showpre[id]==true && get_pcvar_num(kz_uq_ladder)==1 )
				{
					set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 1.0, 0.1, 0.1, get_pcvar_num(hud_pre));
					show_hudmessage(i, "Ladder Pre: %f",prestrafe[id]);
				}
			}
		}
		//ColorChat(id,RED,"eto ladder");
	}
	if( button & IN_DUCK && !(oldbuttons &IN_DUCK) && flags & FL_ONGROUND)
	{
		doubleduck[id]=true;
		doubletime[id]=get_gametime();
	}
	
	if(flags & FL_ONGROUND)
	{
		if(doubleduck[id]==true && (get_gametime()-doubletime[id]>0.3) && ddbeforwj[id]==false)
		{
		//	ColorChat(id, GREEN, "reset dd");
			set_task(0.2,"ddReset", id+2311);
			doubleduck[id]=false;
			
		
		}
		
			
	}
	
	
	if( !in_air[id] && button & IN_DUCK && !(oldbuttons &IN_DUCK) && flags & FL_ONGROUND && !in_duck[id])
	{	
		
		if( get_gametime( ) - duckoff_time[id] < 0.3 )
		{
		
			started_multicj_pre[id] = true;
			prest[id]= speed; //pre ot 1st ducka
			ducks[id]++;
			statsduckspeed[id][ducks[id]]=speed;
			for( new i = INFO_ONE; i < 33; i++ )
			{
				if( (i == id || is_user_spectating_player(i, id)))
				{
					if(showpre[id]==true && showduck[id]==true )
					{
						set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 0.7, 0.1, 0.1, get_pcvar_num(hud_pre));
						show_hudmessage(i, "Duck Pre: %.03f",speed);
					}
				}
			}
					//dlya vivoda stati po duckam
			//ColorChat(id, GREEN, "%d. duck %f",ducks[id],speed);
		}
		else
		{
			pev(id, pev_origin, origin);
			cjorigin[id][0]=origin[0];
			cjorigin[id][1]=origin[1];
			cjorigin[id][2]=0.0;
			ducks[id]=0;
			prest1[id]= speed; //ground pre
			ducks[id]++;//schetchik duckov
			//ColorChat(id, RED, "prest %f",speed);
			duckstartz[id]=origin[2];
			statsduckspeed[id][ducks[id]]=speed;//dlya vivoda stati po duckam
			//ColorChat(id, GREEN, "%d. duck %f",ducks[id],speed);
			if(speed>=pev( id, pev_maxspeed ) * 1.115) return FMRES_IGNORED; // hyevaya zashita protiv hook+dd
			started_cj_pre[id] = true;
			
			//jump_type[id] = Type_Drop_CountJump1;
			//ColorChat(id, RED, "popali d drop");
		}
		//if( get_gametime( ) - duckoff_time[id] < 0.3 )
		//{
		//	if(jump_type[id]==Type_Drop_BhopLongJump || jump_type[id]==Type_Drop_StandBhopLongJump)
		//	{
		//			pev(id, pev_origin, origin);
					//vFallAt[id][0]=origin[0];
					//vFallAt[id][1]=origin[2];
					
					
		//	}
		//}
		
		in_duck[id] = true;
	}
	else if( !in_air[id] && oldbuttons & IN_DUCK)
	{
		
		
		if( !is_user_ducking( id ) )
		{	
			in_duck[id] = false;
			if( started_cj_pre[id] )
			{
				started_cj_pre[id] = false;
				
				duckoff_time[id] = get_gametime( );
				duckoff_origin[id] = origin;
				
			
				strafe_num[id] = 0;
				TempSpeed[id] = 0.0;
				
				if(jump_type[id] == Type_Drop_CountJump1)
				{
					origin[2]=0.0;
					vFallAt1[id][2]=0.0;
					//ColorChat(id, GREEN, "da eto cj %f",get_distance_f(vFallAt1[id], origin));
					if (get_distance_f(vFallAt1[id], origin) > 115.0)
					{
						//jump_type[id] = Type_None;
						jump_type[id] = Type_CountJump;
						formatex(Jtype[id],31,"CountJump");
						formatex(Jtype1[id],31,"cj");
						
						//ColorChat(id, GREEN, "da eto cj");
					
					}
				
				
				}
				else 
				{
					jump_type[id] = Type_CountJump;
					formatex(Jtype[id],31,"CountJump");
					formatex(Jtype1[id],31,"cj");
					
					//ColorChat(id, GREEN, "da eto cj");
				}
			
			}
			else if( started_multicj_pre[id] )
			{
				started_multicj_pre[id] = false;
				
				duckoff_time[id] = get_gametime( );
				duckoff_origin[id] = origin;
				
				strafe_num[id] = 0;
				TempSpeed[id] = 0.0;
				
				if(jump_type[id] == Type_Drop_CountJump1)
				{
					origin[2]=0.0;
					vFallAt1[id][2]=0.0;
					//ColorChat(id, GREEN, "da eto cj %f",get_distance_f(vFallAt1[id], origin));
					if (get_distance_f(vFallAt1[id], origin) > 100.0)
					{
						//jump_type[id] = Type_None;
						jump_type[id] = Type_Multi_CountJump;
						formatex(Jtype[id],31,"Double CountJump");
						formatex(Jtype1[id],31,"dcj");
						//ColorChat(id, GREEN, "da eto dcj");
					
					}
				
				
				}
				else 
				{
					jump_type[id] = Type_Multi_CountJump;
					formatex(Jtype[id],31,"Double CountJump");
					formatex(Jtype1[id],31,"dcj");
					//ColorChat(id, GREEN, "da eto dcj");
				}
			}
			if(ducks[id]>2)
			{	
				if(ducks[id]>7)
				{
					g_reset[id] = true;
					//ColorChat(id, GREEN, "reset17");
					return FMRES_IGNORED;
				}
				if(jump_type[id] != Type_Drop_CountJump1)
				{
				
					jump_type[id] = Type_Multi_Count; //detect mcj
					formatex(Jtype[id],31,"Multi CountJump");
					formatex(Jtype1[id],31,"mcj");
					//ColorChat(id, GREEN, "da eto mcj");
				}
		
			}
			
		}
	}
	pev(id, pev_origin, origin);
	if(cjjump[id]==false && (button & IN_DUCK || oldbuttons &IN_DUCK) && (jump_type[id]==Type_CountJump || jump_type[id]==Type_Fast_CountJump) && jump_type[id]!=Type_Drop_CountJump1 && ddbeforwj[id]==false && origin[2]-duckoff_origin[id][2]<0.0)
	{
		jump_type[id] = Type_Fast_CountJump;
		formatex(Jtype[id],31,"StandUp CountJump");
		formatex(Jtype1[id],31,"scj");
		//ColorChat(id, GREEN, "da eto fast cj");
		//ColorChat(id, GREEN, "da eto fast cj %f",origin[2]-duckoff_origin[id][2]);
	}
	
	if(((oldbuttons & IN_DUCK && oldbuttons & IN_JUMP) || oldbuttons & IN_JUMP) && bhopaem[id]==false && in_bhop[id] == false && flags & FL_ONGROUND && (jump_type[id] == Type_None || jump_type[id] == Type_LongJump))	
	{
		
		//pev(id, pev_velocity, velocity);
	//ColorChat(id,GREEN,"sorry");
		//ColorChat(id,GREEN,"second %f",velocity[2]);
		static i;
		
		for( i = INFO_ONE; i < 33; i++ )
		{
			if( (i == id || is_user_spectating_player(i, id)))
			{	
				if(showpre[id]==true && failearly[id]==true && (get_pcvar_num(kz_uq_bj)==1 || get_pcvar_num(kz_uq_sbj)==1))
				{
					set_hudmessage(0, 71, 171, -1.0, 0.67, 0, 0.0, 1.5, 0.1, 0.1, get_pcvar_num(hud_pre));
					show_hudmessage(id, "Sorry but you pressed Jump too early");
					
				}
			}
		}
		//remove_task(id);
		//set_task(0.2,"JumpReset", id); 
		
		
		//g_reset[id]=true;
	//	bhopfail[id]=true;
		//in_bhop[id] = true;
		//in_air[id]=true;
		if(multibhoppre[id]!=true)
		bhopaem[id]=true;
		//ColorChat(id, GREEN, "poexali");
		//return FMRES_IGNORED;
	}
	else if( bhopaem[id]==false && in_bhop[id] == false && button & IN_JUMP && !( oldbuttons & IN_JUMP )  && flags & FL_ONGROUND && in_air[id] && (jump_type[id] == Type_None || jump_type[id] == Type_LongJump))
	{	
		
		//pev(id, pev_velocity, velocity);
	//ColorChat(id,GREEN,"jump bhop");
		//ColorChat(id,GREEN,"second %f",velocity[2]);
		if( oldbuttons&IN_BACK )
		{
			
			pre_type[id] = "[Backwards]";
					
		}
		else if(oldbuttons&IN_FORWARD )
		{
				pre_type1[id] = "forward";
				
		}
		remove_task(id);
		set_task(0.81,"JumpReset", id);
		
		if(multibhoppre[id]!=true)
		bhopaem[id]=true;
		
		pev(id, pev_origin, origin);
		//ColorChat(id,RED," bhop res");
		static bool:ducking;
		ducking = is_user_ducking( id ); //nax ne nado hotya hz.. 
		strafecounter_oldbuttons[id] = INFO_ZERO;
		najalw=0;
		//bhopfail[id]=false;
		strafe_num[id] = 0;
		TempSpeed[id] = 0.0;
		in_bhop[id] = true;
		
		pre_jumpoff_origin[id] = jumpoff_origin[id];
		jumpoff_foot_height[id] = ducking ? origin[2] - 18.0 : origin[2] - 36.0; //todo:think about this gavno
		
		jumpoff_time[id] = get_gametime( );
		
		new Float:checkbhop;
		
		if(is_user_ducking(id)==true)
		{
			checkbhop=jumpoff_origin[id][2]-origin[2]-18.0;
			//ColorChat(id, GREEN, "%f %f",jumpoff_origin[id][2],origin[2]+18.0);
			
		}
		else checkbhop=jumpoff_origin[id][2]-origin[2];
		
		if(floatabs(checkbhop)>1.0)
		{
			JumpReset(id);
		//	ColorChat(id, GREEN, "%f ",checkbhop);
			return FMRES_IGNORED;
		}
		//ColorChat(id, GREEN, "%f %f",jumpoff_origin[id][2],origin[2]);
		
		jumpoff_origin[id] = origin;
		if(is_user_ducking( id )==true)
		{
			
			jumpoff_origin[id][2] = origin[2]+18.0;
		}
		else jumpoff_origin[id][2] = origin[2];
		pev(id, pev_velocity, velocity);
		//ColorChat(id, GREEN, "x %f y %f z %f",velocity[0],velocity[1],velocity[2]);
		//ColorChat(id,GREEN,"x= %f y= %f z= %f",jumpoff_origin[id][0],jumpoff_origin[id][1],jumpoff_origin[id][2]);
		first_frame[id] = true;
		
		prestrafe[id] = speed;
		maxspeed[id] = speed;
		
		static i;
		for( i = INFO_ZERO; i < NSTRAFES; i++ )
		{
			strafe_stat_speed[id][i][0] = 0.0;
			strafe_stat_speed[id][i][1] = 0.0;
			strafe_stat_sync[id][i][0] = INFO_ZERO;
			strafe_stat_sync[id][i][1] = INFO_ZERO;
			strafe_stat_time[id][i] = 0.0;
			//aa[id][i]=0.0;
		}
		for( i = INFO_ZERO; i < 2; i++ )
		{
			frame_origin[id][i][0] = 0.0;
			frame_origin[id][i][1] = 0.0;
			frame_origin[id][i][2] = 0.0;
			
			frame_velocity[id][i][0] = 0.0;
			frame_velocity[id][i][1] = 0.0;
			frame_velocity[id][i][2] = 0.0;
		}
		in_air[id]	= true;
		g_Jumped[id]	= true;
		turning_right[id] = false;
		turning_left[id] = false;
		//ColorChat(id, GREEN, "poexali");
		//flajok[id]=true;
		//if(prestrafe[id]<230.0)
		//{
		//	ColorChat(id, RED, "reset early");
		//	JumpReset(id);
			
		//	return FMRES_IGNORED;
		//}
		for( i = INFO_ONE; i < 33; i++ )
		{
			if( (i == id || is_user_spectating_player(i, id)))
			{	
				if(showpre[i]==true )
				{
					if((pev( id, pev_maxspeed ) * 1.2)>prestrafe[id] && (get_pcvar_num(kz_uq_bj)==1 || get_pcvar_num(kz_uq_sbj)==1))
					{
						set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 0.7, 0.1, 0.1, get_pcvar_num(hud_pre));
						show_hudmessage(i, "Prestrafe: %.03f",prestrafe[id]);
					}
					else
					{	if((get_pcvar_num(kz_uq_bj)==1 || get_pcvar_num(kz_uq_sbj)==1))
						{
							set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 1.5, 0.1, 0.1, get_pcvar_num(hud_pre));
							show_hudmessage(i, "Your prestrafe %.01f is too high",prestrafe[id]);
						}
					}
				}	
				
			}
		}
		
		
			
	}
	
	else 
	
	if(bhopaem[id]==false && button & IN_JUMP && !( oldbuttons & IN_JUMP ) && flags & FL_ONGROUND && !in_air[id])
	{	
		
		if(task_exists(id+2311))
		remove_task(id+2311);
		
		if( oldbuttons&IN_BACK )
		{
			
			pre_type[id] = "[Backwards]";
					
		}
		else if(oldbuttons&IN_FORWARD )
		{
				pre_type1[id] = "forward";
				
		}

		pev(id, pev_velocity, velocity);
		//ColorChat(id, GREEN, "re %f",origin[2]);
		
		
		
		if(jump_type[id]==Type_ladderBhop)
		{
			remove_task(id);
		}
		if(jump_type[id]!=Type_ladderBhop)
		{
			if(oldjump_typ1[id]==1)
			{
				jump_type[id]=Type_ladderBhop;
				oldjump_typ1[id]=0;
			}
		}
		pev(id, pev_origin, origin);
		set_task(0.80,"JumpReset", id);
		
		jumpoff_origin[id] = origin;
		
		if(is_user_ducking( id )==true)
		{
			
			jumpoff_origin[id][2] = origin[2]+18.0;
		}
		else jumpoff_origin[id][2] = origin[2];
		
		jumpoff_time[id] = get_gametime( );
		strafecounter_oldbuttons[id] = INFO_ZERO;
		najalw=0;
		//ColorChat(id,RED,"time %f",jumpoff_time[id]-testall[id]);
		//first_onground[id]=false;
		//first_onground[id]=false;
		//if(jump_type[id] == Type_BhopLongJump)
		//ColorChat(id,RED," bhopim");
		
		pev(id, pev_origin, origin);
		dropbjorigin[id][2]=origin[2];
		
		static Float:temp[3],Float:temp2[3],Float:temp1[3];
		temp[0] = vFallAt[id][0];
		temp[1] = vFallAt[id][1];
		temp[2] = 0.0;
		pev(id, pev_velocity, velocity);
		secorig[id]=origin;
		temp1[0] = vFallAt1[id][0];
		temp1[1] = vFallAt1[id][1];
		temp1[2] = 0.0;
		
		temp2[0] = origin[0];
		temp2[1] = origin[1];
		temp2[2] = 0.0;
		//ColorChat(id,GREEN,"x= %f y= %f z= %f",temp[0],temp[1],temp[2]);
		//ColorChat(id,GREY,"xc=%f yc=%f zc=%f",cjorigin[id][0],cjorigin[id][1],cjorigin[2]);
		if((get_gametime()-dropbjtime[id])<0.1 && jump_type[id] == Type_Drop_CountJump1)
		{
			jump_type[id] = Type_Drop_BhopLongJump;
			formatex(Jtype[id],31,"Drop Bhop");
			formatex(Jtype1[id],31,"drbj");
		}
		/*if((jump_type[id] == Type_CountJump || jump_type[id] == Type_Multi_Count || jump_type[id] == Type_Multi_CountJump || jump_type[id] == Type_CountJumpafterDrop || jump_type[id] == Type_Drop_BhopLongJump || jump_type[id] == Type_Drop_StandBhopLongJump))
		{
			flajok[id]=false;
			ColorChat(id,RED," lader-dropbj reset");
			JumpReset(id);
			return FMRES_IGNORED;
		}
		*/
		
		firstdrop[id]=false;
		
		if(get_gametime()-dropstime[id]> 0.05 && (jump_type[id]==Type_Drop_StandBhopLongJump || jump_type[id]==Type_Drop_BhopLongJump))
		{
			jump_type[id] = Type_None;
			//ColorChat(id,RED,"none2");
		}
		if(jump_type[id]==Type_CountJump)
		{
			cjjump[id]=true;
			//ColorChat(id,RED,"none2");
		}
		if ((jump_type[id] == Type_WeirdLongJump || jump_type[id] == Type_Drop_BhopLongJump || jump_type[id] == Type_Drop_StandBhopLongJump || jump_type[id]==Type_ladderBhop ) && get_distance_f(temp1, temp2) > 20.0)
		{
			jump_type[id] = Type_None;
			//ColorChat(id,RED,"none1");
			//ColorChat(id,RED," Wj i drops reset %f",get_distance_f(temp1, temp2));
			
		}
		if ( jump_type[id] == Type_Drop_CountJump1 && get_distance_f(temp1, temp2) > 80.0)
		{
			jump_type[id] = Type_None;
			//ColorChat(id,RED,"none3");
			
		}
		if ( (jump_type[id] == Type_CountJump || jump_type[id] == Type_Multi_Count || jump_type[id] == Type_Multi_CountJump) && floatabs(duckstartz[id]-jumpoff_origin[id][2])>0.0)
		{
			jump_type[id] = Type_WeirdLongJump;	
			formatex(Jtype[id],31,"WeirdJump");
			formatex(Jtype1[id],31,"wj");
			//ColorChat(id, GREEN, "reset10");
		}
		if ( (jump_type[id] == Type_CountJump || jump_type[id] == Type_Multi_Count || jump_type[id] == Type_Multi_CountJump) && get_distance_f(cjorigin[id],temp) < 24.0 )
		{
			//JumpReset(id);
			//ColorChat(id,RED," Wj -cj reset");
			JumpReset(id);
			//ColorChat(id, GREEN, "reset10");
			return FMRES_IGNORED;
			
		}
		
		prestrafe[id]	= speed;
		maxspeed[id]	= speed;
		new Float:kkk;
		if(pev(id, pev_maxspeed) != 250.0)
		{
			kkk=295.0;
		}
		else kkk=278.0;
		
		if(prestrafe[id]<kkk && jump_type[id] != Type_CountJumpafterDrop && jump_type[id] != Type_Drop_StandBhopLongJump && jump_type[id] !=Type_ladderBhop && jump_type[id] != Type_Drop_BhopLongJump && jump_type[id] != Type_WeirdLongJump && jump_type[id] != Type_CountJump && jump_type[id] != Type_Multi_Count && jump_type[id] != Type_Multi_CountJump && jump_type[id] != Type_BhopLongJump && jump_type[id] != Type_StandupBhopLongJump && jump_type[id] != Type_Drop_CountJump1)
		{
			if(jump_type[id] != Type_Drop_CountJump1 && jump_type[id] != Type_Fast_CountJump)
			{
				jump_type[id] = Type_LongJump;
				formatex(Jtype[id],31,"LongJump");
				formatex(Jtype1[id],31,"lj");
				//ColorChat(id,RED," lj 1");
			}
			
		}
		
		
		//ColorChat(id,RED," Wj i drops reset %f",get_gametime()-dropstime[id]);
		
			
		
		
		TempSpeed[id] = 0.0;
		
		
		
		if(jump_type[id] == Type_Drop_CountJump1 || jump_type[id] == Type_CountJump || jump_type[id] == Type_Multi_CountJump || jump_type[id] == Type_Multi_Count) 
		{	
			if( jumpoff_time[id] - duckoff_time[id] > 0.3)
			{
				if(duckoff_origin[id][2]-origin[2]>0.0)
				{
					jump_type[id] = Type_WeirdLongJump;	
					formatex(Jtype[id],31,"WeirdJump");
					formatex(Jtype1[id],31,"wj");
					//ColorChat(id, GREEN, "reset11");
					//ColorChat(id,RED," after cj type");
				//	if(get_distance_f(duckoff_origin[id],origin)>18.0)
					//{
						//jump_type[id] = Type_LongJump;
					//	formatex(Jtype[id],31,"LongJump");
					//	formatex(Jtype1[id],31,"lj");
					//}
				}
				else if(duckoff_origin[id][2]-origin[2]<0.0)
				{
					jump_type[id] = Type_LongJump;
					formatex(Jtype[id],31,"LongJump");
					formatex(Jtype1[id],31,"lj");
					//ColorChat(id,RED," lj2");
					
				}
				else if(duckoff_origin[id][2]-origin[2]==0.0)
				{
					//ColorChat(id,RED," after cj type %f type1 %f",groundorig[id][2],origin[2]);
					if(groundorig[id][2]-origin[2]==0)
					{
						jump_type[id] = Type_LongJump;
						formatex(Jtype[id],31,"LongJump");
						formatex(Jtype1[id],31,"lj");
						//ColorChat(id,RED," lj3");
					}
					else
					{
						jump_type[id] = Type_WeirdLongJump;	
						formatex(Jtype[id],31,"WeirdJump");
						formatex(Jtype1[id],31,"wj");
						//ColorChat(id, GREEN, "reset12");
					}
				}
				
				//ColorChat(id,RED," after cj type %f",);
			
				//ColorChat(id,RED," after cj type %f",jumpoff_time[id] - duckoff_time[id]);
			}
			
		}
				
		
	
		static i;
		for( i = INFO_ZERO; i < NSTRAFES; i++ )
		{
			strafe_stat_speed[id][i][0] = 0.0;
			strafe_stat_speed[id][i][1] = 0.0;
			strafe_stat_sync[id][i][0] = INFO_ZERO;
			strafe_stat_sync[id][i][1] = INFO_ZERO;
			strafe_stat_time[id][i] = 0.0;
			//aa[id][i]=0.0;
		}
		in_air[id]	= true;
		g_Jumped[id]	= true;
		first_frame[id] = true;
		
		prestrafe[id]	= speed;
		maxspeed[id]	= speed;
		
		turning_right[id] = false;
		turning_left[id] = false;
		//strafing_aw[id] = false;
		//strafing_sd[id] = false;
		for( i = INFO_ZERO; i < 2; i++ )
		{
			frame_origin[id][i][0] = 0.0;
			frame_origin[id][i][1] = 0.0;
			frame_origin[id][i][2] = 0.0;
			
			frame_velocity[id][i][0] = 0.0;
			frame_velocity[id][i][1] = 0.0;
			frame_velocity[id][i][2] = 0.0;
		}
		vFallAt[id][0] = 0.0;
		vFallAt[id][1] = 0.0;
		vFallAt[id][2] = 0.0;	
		
		if(jump_type[id]==Type_LongJump && prestrafe[id]>278)
		{
			jump_type[id] = Type_WeirdLongJump;
			formatex(Jtype[id],31,"WeirdJump");
			formatex(Jtype1[id],31,"wj");
			
		}
		
		//zamutim showpre
		for( i = INFO_ONE; i < 33; i++ )
		{
			if( (i == id || is_user_spectating_player(i, id)))
			{
				if((pev( id, pev_maxspeed ) * 1.2)>prestrafe[id])
				{	
					if(jump_type[id] == Type_Multi_CountJump && showpre[id]==true && get_pcvar_num(kz_uq_dcj)==1)
					{
					set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 0.7, 0.1, 0.1, get_pcvar_num(hud_pre));
					show_hudmessage(i, "DCJ Pre: %.03f",prestrafe[id]);
					}
					if(jump_type[id] == Type_CountJump && showpre[id]==true && get_pcvar_num(kz_uq_cj)==1)
					{
					set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 0.7, 0.1, 0.1, get_pcvar_num(hud_pre));
					show_hudmessage(i, "CJ Pre: %.03f",prestrafe[id]);
					}
					if(jump_type[id] == Type_Multi_Count  && showpre[id]==true  && get_pcvar_num(kz_uq_mcj)==1)
					{
					set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 0.7, 0.1, 0.1, get_pcvar_num(hud_pre));
					show_hudmessage(i, "MCJ Pre: %.03f",prestrafe[id]);
					}
					if(jump_type[id] == Type_LongJump && showpre[id]==true && ljpre[id]==true && get_pcvar_num(kz_uq_lj)==1)
					{
					set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 0.7, 0.1, 0.1, get_pcvar_num(hud_pre));
					show_hudmessage(i, "Prestrafe: %f",prestrafe[id]);
					}
					if(jump_type[id] == Type_WeirdLongJump && showpre[id]==true && ddbeforwj[id]==true  && get_pcvar_num(kz_uq_wj)==1)
					{
					set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 0.7, 0.1, 0.1, get_pcvar_num(hud_pre));
					show_hudmessage(i, "DD+WJ Pre: %.03f",prestrafe[id]);
					}
					if(jump_type[id] == Type_WeirdLongJump && showpre[id]==true && ddbeforwj[id]==false && get_pcvar_num(kz_uq_wj)==1)
					{
					set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 0.7, 0.1, 0.1, get_pcvar_num(hud_pre));
					show_hudmessage(i, "WJ Pre: %.03f",prestrafe[id]);
					}
					if((jump_type[id] == Type_Drop_BhopLongJump)&& showpre[id]==true && get_pcvar_num(kz_uq_drbj)==1 )
					{
					set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 0.7, 0.1, 0.1, get_pcvar_num(hud_pre));
					show_hudmessage(i, "Drop BJ Pre: %.03f",prestrafe[id]);
					}
					if((jump_type[id] == Type_Drop_StandBhopLongJump)&& showpre[id]==true  && get_pcvar_num(kz_uq_drsbj)==1)
					{
					set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 0.7, 0.1, 0.1,get_pcvar_num(hud_pre));
					show_hudmessage(i, "Drop SBJ Pre: %.03f",prestrafe[id]);
					}
					if((jump_type[id] == Type_ladderBhop)&& showpre[id]==true && get_pcvar_num(kz_uq_ldbj)==1 )
					{
					set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 0.7, 0.1, 0.1, get_pcvar_num(hud_pre));
					show_hudmessage(i, "Ladder Bhop Pre: %.03f",prestrafe[id]);
					}
					if((jump_type[id]==Type_Drop_CountJump1)&& showpre[id]==true && get_pcvar_num(kz_uq_drcj)==1)
					{
					set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 0.7, 0.1, 0.1, get_pcvar_num(hud_pre));
					show_hudmessage(i, "Drop CJ Pre: %.03f",prestrafe[id]);
					}
					if((jump_type[id]==Type_Fast_CountJump) && showpre[id]==true && get_pcvar_num(kz_uq_drsbj)==1)
					{
					set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 0.7, 0.1, 0.1, get_pcvar_num(hud_pre));
					show_hudmessage(i, "SCJ Pre: %.03f",prestrafe[id]);
					}
					
				}
				else 
				{
					set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 1.5, 0.1, 0.1, get_pcvar_num(hud_pre));
					show_hudmessage(i, "Your prestrafe %.03f is too high",prestrafe[id]);
				}
				
			}
		}
		
		//if(jump_type[id]==Type_None)
		//ColorChat(id,RED,"type");
	}

	else if( ( failed_jump[id] || flags&FL_ONGROUND)&& in_air[id] ) {
		
		
		static bool:ducking;
		
		
		
		//dropbhop[id]=false;
		static type[32];
		type[0] = '^0';
		
		if (failed_jump[id] == true)
		{
		formatex( type, 31, "" );
		origin[0]= failed_origin[id][0];
		origin[1]= failed_origin[id][1];
		origin[2]= failed_origin[id][2];
		ducking = failed_ducking[id];
		}
		else
		{
		pev(id, pev_origin, origin);
		ducking = is_user_ducking( id );
		}
		//ColorChat(id,RED,"x=%f y=%f",origin[2],jumpoff_origin[id][2]);
		
		//ColorChat(id, RED, "orig %f %f",jumpoff_origin[id][2],origin[2]);
		
		
		//if(jump_type[id] == Type_ladder)
		//{
		//	if( is_user_ducking(id) )
		//	jumpoff_origin[id][2]=origin[2]+18.0;
		//	else
		//	jumpoff_origin[id][2]=origin[2];
		//}
		//ColorChat(id,RED,"mmmm=%f",origin[2]);
		
		
		//ColorChat(id,RED,"opa=%f",jumpoff_origin[id][2]-org[2]);
		ducking = is_user_ducking( id );
		
		
		height_difference[id] =  ducking ? jumpoff_origin[id][2] - origin[2] - 18.0 : jumpoff_origin[id][2] - origin[2];
		//ColorChat(id,RED,"mm=%f",height_difference);
		
		//new Float:testt;
		
		if(jump_type[id] == Type_BhopLongJump || jump_type[id] == Type_StandupBhopLongJump)
		{
			if(height_difference[id] <-22.0)
			{
				g_reset[id] = true;
				//ColorChat(id, GREEN, "reset112");
				return FMRES_IGNORED;
			}
			
			if(height_difference[id] > -18.0)
			{
				if(height_difference[id] <= -1.0)
				{
					g_reset[id] = true;
					//ColorChat(id, GREEN, "reset113");
					return FMRES_IGNORED;
				}
				
			}
		}
		else
		{
			if(height_difference[id] < -1.0)
			{
				if((jump_type[id]==Type_Drop_BhopLongJump || jump_type[id]==Type_Fast_CountJump) && height_difference[id]==-18.0)
				{
					//ColorChat(id, GREEN, "ne reset");
				}
				else
				{	
				
					g_reset[id] = true;
					//ColorChat(id,RED," after %d",jump_type[id]);
				
					return FMRES_IGNORED;
					
				}
			}	
		}
		if(jump_type[id]==Type_StandupBhopLongJump)
		{
			if(height_difference[id] > 1.0)
			failed_jump[id]=true; 
		}
		else if(height_difference[id] > 0.0 && jump_type[id]!=Type_Drop_BhopLongJump )
		{
			failed_jump[id]=true; 
		}
		else if(height_difference[id] > 0.02 && jump_type[id]==Type_Drop_BhopLongJump )
		{
			failed_jump[id]=true; 
		}
		if(g_lastfps[id]>110 && (get_pcvar_num(kz_uq_fps)==1))
		{
			failed_jump[id]=true;
			static i;
			for( i = INFO_ONE; i < 33; i++ )
			{
				if( (i == id || is_user_spectating_player(i, id)))
				{
					//client_print(i,print_center,"Hey man, you fps is under 101");
				}
			}
		}
		//last_land_time[id] = get_gametime( );//hz nax tyt
		//krivoi schet distance kill, zasunul ot kz_ljs_xm
		static Float:distance1;
		if(jump_type[id] == Type_ladder)
		{
			distance1 = get_distance_f( jumpoff_origin[id], origin )+laddist[id];
		}
		else distance1 = get_distance_f( jumpoff_origin[id], origin ) + 32.0625;
		//ColorChat(id, GREEN, "x= %f y= %f z= %f",jumpoff_origin[id][0],jumpoff_origin[id][1],jumpoff_origin[id][2]);	
		//ColorChat(id, RED, "xo= %f yo= %f zo= %f",origin[0],origin[1],origin[2]);	
		//ColorChat(id, RED, "dist1uq %f",distance1);
		if( frame_velocity[id][1][0] < 0.0 ) frame_velocity[id][1][0] *= -1.0;
		if( frame_velocity[id][1][1] < 0.0 ) frame_velocity[id][1][1] *= -1.0;
		
		static Float:land_origin[3];
		//land_origin[0] = frame_origin[id][1][0] < origin[0] ? frame_origin[id][1][0] + x_difference : frame_origin[id][1][0] - x_difference;
		//land_origin[1] = frame_origin[id][1][1] < origin[1] ? frame_origin[id][1][1] + y_difference : frame_origin[id][1][1] - y_difference;
		//land_origin[2] = ducking ? origin[2] + 18.0 : origin[2];
		
		land_origin[2] = frame_velocity[id][0][2] * frame_velocity[id][0][2] + (2 * get_pcvar_float(sv_gravity) * (frame_origin[id][0][2] - origin[2]));
		//ColorChat(id, RED, "land1 %f",frame_origin[id][0][2]);
		//ColorChat(id, GREEN, "xu %f yu %f zu %f cu %f ",frame_velocity[id][0][2],2 * get_pcvar_float(sv_gravity),frame_origin[id][0][2],origin[2]);			
	
		rDistance[0] = (floatsqroot(land_origin[2]) * -1) - frame_velocity[id][1][2];

		rDistance[1] = get_pcvar_float(sv_gravity)*-1;
		
		frame2time = floatdiv(rDistance[0], rDistance[1]);
		if(frame_velocity[id][1][0] < 0 )
		frame_velocity[id][1][0] = frame_velocity[id][1][0]*-1;
		rDistance[0] = frame2time*frame_velocity[id][1][0];
			
		if( frame_velocity[id][1][1] < 0 )
		frame_velocity[id][1][1] = frame_velocity[id][1][1]*-1;
		rDistance[1] = frame2time*frame_velocity[id][1][1];

		if( frame_velocity[id][1][2] < 0 )
		frame_velocity[id][1][2] = frame_velocity[id][1][2]*-1;
		rDistance[2] = frame2time*frame_velocity[id][1][2];
		
		if( frame_origin[id][1][0] < origin[0] )
		land_origin[0] = frame_origin[id][1][0] + rDistance[0];
		else
		land_origin[0] = frame_origin[id][1][0] - rDistance[0];
		if( frame_origin[id][1][1] < origin[1] )
		land_origin[1] = frame_origin[id][1][1] + rDistance[1];
		else
		land_origin[1] = frame_origin[id][1][1] - rDistance[1];
		
		if( is_user_ducking(id) )
		{
			origin[2]+=18.0;
			duckstring[id]=true;
		}

		land_origin[2] = origin[2];
		
		frame2time += (last_land_time[id]-jumpoff_time[id]);
		
		static Float:distance2;
		if(jump_type[id] == Type_ladder)
		{
			distance2 = get_distance_f( jumpoff_origin[id], land_origin ) +laddist[id];
		}
		else distance2 = get_distance_f( jumpoff_origin[id], land_origin ) + 32.0625;
		//ColorChat(id, RED, "dist2uq %f",distance2);	
		
		static Float:distance[33];
		
		distance[id] = distance1 > distance2 ? distance2 : distance1; //distance
		
		
		
	
		//if(jump_type[id]==Type_BhopLongJump)
		
		if(entity_get_float(id,EV_FL_fuser2)==0.0 && jump_type[id] != Type_ladder)
		{
			failed_jump[id]=true;
			//client_print(id,print_center,"Auto bhop or axn mod is on");
		
		}
		
		if(jump_type[id] != Type_ladder)
		{
			if( distance[id] < get_pcvar_num(kz_min_dcj) || MAX_DISTANCE < distance[id] ) {
				g_reset[id] = true;
				//ColorChat(id, GREEN, "reset115");
				return FMRES_IGNORED;
			}
		}
		else 
		if( distance[id] > 220.0 || distance[id] < 100.0)
		{
			g_reset[id] = true;
			//ColorChat(id, GREEN, "reset4");
			//ColorChat(id, GREEN, "reset116");
			return FMRES_IGNORED;
		}
		if( jump_type[id] == Type_LongJump ) 
		{
			
			oldjump_type[id]=1;
			//ColorChat(id, GREEN, "oldtype lj");
			
		}
		else oldjump_type[id]=0;
		
		
		
		if( jump_type[id] == Type_LongJump ) 
		{
			
			
			static Float:start[3];
			static Float:vVel[3];
	
	
			
			
			if( engfunc( EngFunc_PointContents, start ) == CONTENTS_EMPTY ) {
				static Float:stop[3], Float:fraction;
				pev(id, pev_velocity, vVel);
			//start[0] = ( jumpoff_origin[id][0] + land_origin[0] ) * 0.5;
			//start[1] = ( jumpoff_origin[id][1] + land_origin[1] ) * 0.5;
			//start[2] = ducking ? origin[2] - 18.1 : origin[2] - 36.1;
				start[0] = stop[0] = jumpoff_origin[id][0] + vVel[0]/speed*16.03125;
				start[1] = stop[1] = jumpoff_origin[id][1] + vVel[1]/speed*16.03125;
				start[2] = jumpoff_origin[id][2];
				stop[2] = start[2] - 69.0; 
			/*	stop[0] = jumpoff_origin[id][0];
				stop[1] = jumpoff_origin[id][1];
				if( start[0] < stop[0] )
					stop[0] += stop[0] - start[0];
				else
					stop[0] -= start[0] - stop[0];
				
				if( start[1] < stop[1] )
					stop[1] += stop[1] - start[1];
				else
					stop[1] -= start[1] - stop[1];
				
				stop[2] = start[2];
				
				//jumpoff_origin[id][2] -= 0.1;*/
				
				//static Float:temp;
				//temp = get_distance_f( jumpoff_origin[id], start );
				//max_fraction = floatdiv( temp + 16.03125, temp * 2.0 );
					
				//engfunc( EngFunc_TraceHull, start, stop, IGNORE_MONSTERS, HULL_HUMAN, id, 0 );
				//get_tr2( 0, TR_flFraction, fraction );
				//ColorChat(id,RED,"fraction %f",max_fraction);
				//if( fraction < max_fraction ) {
				//	get_tr2( 0, TR_vecEndPos, start );
					
					
					
					//stop[0] = start[0];
					//stop[1] = start[1];
					//stop[2] = start[2] - 69.9;
					
					
				engfunc( EngFunc_TraceLine, start, stop, IGNORE_MONSTERS, id, 0 );
				get_tr2( 0, TR_flFraction, fraction );
				
				
				if( fraction == 1.0 )
				{
					jump_type[id] = Type_HighJump;
					formatex(Jtype[id],31,"HighJump");
					formatex(Jtype1[id],31,"hj");
				}
				
				//}
			}
			
		}
			//OnGround[id] = false;
			
		

		//streifs stat
		sync_[id] = INFO_ZERO;
		strMess[0] = '^0'; //unnecessary?
		strMessBuf[0] = '^0'; //unnecessary?
		strLen = INFO_ZERO;
		badSyncTemp = INFO_ZERO;
		goodSyncTemp = INFO_ZERO;
		
		Fulltime = last_land_time[id]-jumpoff_time[id];
		if(strafe_num[id] < NSTRAFES)
		{
				strafe_stat_time[id][0] = jumpoff_time[id];//jumptime[id];
				strafe_stat_time[id][strafe_num[id]] =last_land_time[id];// lasttime[id];
				for(jj = 1;jj <= strafe_num[id]; jj++)
				{
					time_ = ((strafe_stat_time[id][jj] - strafe_stat_time[id][jj-1])*100) / (Fulltime);
					if ((strafe_stat_sync[id][jj][0]+strafe_stat_sync[id][jj][1]) > 0)
					{
						sync_[id] =(strafe_stat_sync[id][jj][0] * 100)/(strafe_stat_sync[id][jj][0]+strafe_stat_sync[id][jj][1]); //using like a buffer		
					}				
					else
					{
						sync_[id] = 0;
					}
					strLen += format(strMess[strLen],(40*NSTRAFES)-strLen-1, "^t%2d^t%4.3f^t%4.3f^t%3.1f%%^t%3d%%^n", jj, strafe_stat_speed[id][jj][0], strafe_stat_speed[id][jj][1], time_, sync_[id]);
					goodSyncTemp += strafe_stat_sync[id][jj][0];
					badSyncTemp += strafe_stat_sync[id][jj][1];
				}
				if(strafe_num[id]!=0)
				{
					if (jump_type[id]==Type_ladder && strafe_stat_speed[id][0][0]!=0)
					{	//new Float:summma=0;
						//for(new l=0;l<=strafe_num[id];l++)
						//{
						//	summma=summma+strafe_stat_speed[id][l][0];
						//}
						
						strLen += format(strMess[strLen],(40*NSTRAFES)-strLen-1, "^t^tTurn speed: %4.3f",strafe_stat_speed[id][0][0]);
					}
					if (duckstring[id]==false)
					{							
						strLen += format(strMess[strLen],(40*NSTRAFES)-strLen-1, "^t^tNo duck");
					}
					if (jump_type[id]==Type_StandupBhopLongJump)
					{
						strLen += format(strMess[strLen],(40*NSTRAFES)-strLen-1, "^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^tStand-Up");
					}
					/*if(jump_type[id]!=Type_Slide && jumpoff_edge[id]<30 && jumpoff_edge[id]!=0.0 && block[id]>100 && block[id]<280)
					{
						
						strLen += format(strMess[strLen],(40*NSTRAFES)-strLen-1, "^n^n^nJumpoff %f^nBlock %i",jumpoff_edge[id],block[id]);
						
					}*/
					
				}
		}
		if(strafe_stat_speed[id][strafe_num[id]][0]>30.0 && jump_type[id]!=Type_ladder)
		{
			//ColorChat(id,GREY,"Surf");
			JumpReset(id);
			//ColorChat(id, GREEN, "reset 12233");
			return FMRES_IGNORED;
		}
		//Sync
		if( goodSyncTemp > 0 )
		sync_[id]= (goodSyncTemp*100/(goodSyncTemp+badSyncTemp));
		else
		sync_[id] = INFO_ZERO;
		//types
		switch( jump_type[id] )
		{
			case 0: add( type, 31, "LJ", 25 ); //Lj
			case 1: add( type, 31, "HJ", 25 ); //hj
			case 2: add( type, 31, "CJ", 25 ); //cj
			case 3: add( type, 31, "BJ", 25 );//bj
			case 4: add( type, 31, "Slide", 25 );//??
			case 5: add( type, 31, "SBJ", 25 );//sbj
			
			case 6: 
			{
				if(ddbeforwj[id]==false)
				add( type, 31, "WJ", 25 ); //wj
				else add( type, 31, "DD+WJ", 25 );
			}
			case 7: add( type, 31, "Drop BJ", 25 );
			case 8: add( type, 31, "Drop CJ", 25 );
			case 9: add( type, 31, "DCJ", 25 ); //dcj
			case 11: add( type, 31, "Multi CJ", 25 );//mcj
			case 12: add( type, 31, "Ladder Drop Bhop", 25 );//nothing
			case 13: add( type, 31, "Ladder", 25 );//ld
			case 15: add( type, 31, "Ladder Bhop", 25 );
			case 16: add( type, 31, "Drop SBJ", 25 );
			case 17: add( type, 31, "CJ after Drop", 25 );
			case 18: add( type, 31, "Drop CJ", 25 );
			case 19: add( type, 31, "SCJ", 25 );
		}
		//gain
		new Float:gain[33];
		gain[id] = floatsub( maxspeed[id], prestrafe[id] );
			//ColorChat(id,RED,"%s",pre_type[id]);
			
		if(jump_type[id]==Type_Fast_CountJump && get_pcvar_num(kz_uq_drsbj)==0)
		{
			g_reset[id] = true;
			return FMRES_IGNORED;
		}
		if(jump_type[id]==Type_Multi_CountJump&& get_pcvar_num(kz_uq_dcj)==0)
		{
			g_reset[id] = true;
			return FMRES_IGNORED;
		}
		if(jump_type[id]==Type_Multi_Count && get_pcvar_num(kz_uq_mcj)==0)
		{
			g_reset[id] = true;
			return FMRES_IGNORED;
		}
		if(jump_type[id]==Type_CountJump && get_pcvar_num(kz_uq_cj)==0)
		{
			g_reset[id] = true;
			return FMRES_IGNORED;
		}
		if((jump_type[id]==Type_LongJump || jump_type[id]==Type_HighJump) && get_pcvar_num(kz_uq_lj)==0)
		{
			g_reset[id] = true;
			return FMRES_IGNORED;
		}
		if(jump_type[id]==Type_ladder && get_pcvar_num(kz_uq_ladder)==0)
		{
			g_reset[id] = true;
			return FMRES_IGNORED;
		}
		if(jump_type[id]==Type_BhopLongJump && get_pcvar_num(kz_uq_bj)==0) 
		{
			g_reset[id] = true;
			return FMRES_IGNORED;
		}
		if(jump_type[id]==Type_ladderBhop && get_pcvar_num(kz_uq_ldbj)==0)
		{
			g_reset[id] = true;
			return FMRES_IGNORED;
		}
		if(jump_type[id]==Type_WeirdLongJump && get_pcvar_num(kz_uq_wj)==0) 
		{
			g_reset[id] = true;
			return FMRES_IGNORED;
		}
		if(jump_type[id]==Type_Drop_CountJump1 && get_pcvar_num(kz_uq_drcj)==0)
		{
			g_reset[id] = true;
			return FMRES_IGNORED;
		}
		if(jump_type[id]==Type_Drop_BhopLongJump && get_pcvar_num(kz_uq_drbj)==0)
		{
			g_reset[id] = true;
			return FMRES_IGNORED;
		}
		if(jump_type[id]==Type_StandupBhopLongJump && get_pcvar_num(kz_uq_sbj)==0)
		{
			g_reset[id] = true;
			return FMRES_IGNORED;
		}	
		
		if(!failed_jump[id] && pev( id, pev_maxspeed )==250.0 )
		{
			//light after some jumps
			//if(distance>=leet_dcj) krasnota(id); //red+blue light 
			//if(distance>=holy_dcj && distance<god_dcj) sineva(id);//blue light
			//if(distance>=god_dcj) krasnota(id);//red light 
			
			//saving tops
			if(get_pcvar_num(kz_uq_top)==1 && get_pcvar_num(kz_uq_maptop)==1) cheksmap( id, distance[id], maxspeed[id], prestrafe[id], strafe_num[id], sync_[id],Jtype1[id]); 
			
			if(jump_type[id]==Type_Fast_CountJump && get_pcvar_num(kz_uq_top)==1 && get_pcvar_num(kz_uq_drsbj)==1) chekdropsbj( id, distance[id], maxspeed[id], prestrafe[id], strafe_num[id], sync_[id]); 
			if(jump_type[id]==Type_Multi_CountJump && get_pcvar_num(kz_uq_top)==1 && get_pcvar_num(kz_uq_dcj)==1) chekdcj( id, distance[id], maxspeed[id], prestrafe[id], strafe_num[id], sync_[id]); 
			if(jump_type[id]==Type_Multi_Count && get_pcvar_num(kz_uq_top)==1 && get_pcvar_num(kz_uq_mcj)==1) chekmcj( id, distance[id], maxspeed[id], prestrafe[id], strafe_num[id], sync_[id],ducks[id]); 
			if(jump_type[id]==Type_CountJump && get_pcvar_num(kz_uq_top)==1 && get_pcvar_num(kz_uq_cj)==1) chekcj( id, distance[id], maxspeed[id], prestrafe[id], strafe_num[id], sync_[id]); 
			if((jump_type[id]==Type_LongJump || jump_type[id]==Type_HighJump) && get_pcvar_num(kz_uq_top)==1 && get_pcvar_num(kz_uq_lj)==1) cheklj( id, distance[id], maxspeed[id], prestrafe[id], strafe_num[id], sync_[id]); 
			if(jump_type[id]==Type_ladder && get_pcvar_num(kz_uq_top)==1 && get_pcvar_num(kz_uq_ladder)==1) cheksladder( id, distance[id], maxspeed[id], prestrafe[id], strafe_num[id], sync_[id]); 
			if(jump_type[id]==Type_BhopLongJump && get_pcvar_num(kz_uq_top)==1 && get_pcvar_num(kz_uq_bj)==1) chekbj( id, distance[id], maxspeed[id], prestrafe[id], strafe_num[id], sync_[id]); 
			if(jump_type[id]==Type_ladderBhop && get_pcvar_num(kz_uq_top)==1 && get_pcvar_num(kz_uq_ldbj)==1) cheksldbhop( id, distance[id], maxspeed[id], prestrafe[id], strafe_num[id], sync_[id]); 
			if(jump_type[id]==Type_WeirdLongJump && get_pcvar_num(kz_uq_top)==1 && get_pcvar_num(kz_uq_wj)==1) chekswj( id, distance[id], maxspeed[id], prestrafe[id], strafe_num[id], sync_[id]); 
			if(jump_type[id]==Type_Drop_CountJump1 && get_pcvar_num(kz_uq_top)==1 && get_pcvar_num(kz_uq_drcj)==1) cheksdropcj( id, distance[id], maxspeed[id], prestrafe[id], strafe_num[id], sync_[id]); 
			if(jump_type[id]==Type_Drop_BhopLongJump && get_pcvar_num(kz_uq_top)==1 && get_pcvar_num(kz_uq_drbj)==1) cheksdropbj( id, distance[id], maxspeed[id], prestrafe[id], strafe_num[id], sync_[id]); 
			if(jump_type[id]==Type_StandupBhopLongJump && get_pcvar_num(kz_uq_top)==1 && get_pcvar_num(kz_uq_sbj)==1) cheksbj( id, distance[id], maxspeed[id], prestrafe[id], strafe_num[id], sync_[id]); 
			
		}
		
		
		
		//ducks stat for mcj
		strM[0] = '^0'; 
		strMBuf[0] = '^0'; 
		strL = INFO_ZERO;
		for(jj = 2;jj <= ducks[id]; jj++)
		{
			strL += format(strM[strL],(40*NSTRAFES)-strL-1, "^t%2d^tduck: (%0.3f)^n", jj-1,statsduckspeed[id][jj]);
		}
		copy(strMBuf,strL,strM);//dlya stat ducks
		
		//copy(strMessBuf,strLen,strMess);//dlya stat streifs
		//ColorChat(id, GREY, "distanciya %f",distance[id]);
		for( new i = INFO_ONE; i < 33; i++ )
			{
				if( (i == id || is_user_spectating_player(i, id)) && g_lj_stats[i]==true)
					{	
						copy(strMessBuf,strLen,strMess);
						//stats
					
						if(jump_type[id]==Type_Multi_CountJump &&!failed_jump[id] && pev( id, pev_maxspeed )==250.0)
						{
							set_hudmessage(get_pcvar_num(kz_stats_red), get_pcvar_num(kz_stats_green), get_pcvar_num(kz_stats_blue), stats_x, stats_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_stats) );	
							show_hudmessage( i, "%s Distance: %f^nMaxspeed: %f (%.03f)^nPrestrafe: (%.01f) (%.01f) %f^nStrafes: %d^nSync: %d%%^n", type, distance[id], maxspeed[id], gain[id], prest1[id],prest[id], prestrafe[id],strafe_num[id], sync_[id]);
						}
						if((jump_type[id]==Type_Fast_CountJump || jump_type[id] == Type_Drop_CountJump1 || jump_type[id]==Type_CountJumpafterDrop || jump_type[id]==Type_Drop_StandBhopLongJump || jump_type[id]==Type_ladderBhop || jump_type[id]==Type_ladder || jump_type[id]==Type_Drop_BhopLongJump || jump_type[id]==Type_Drop_CountJump || jump_type[id]==Type_WeirdLongJump || jump_type[id]==Type_LongJump || jump_type[id]==Type_HighJump) &&!failed_jump[id] && pev( id, pev_maxspeed )==250.0)
						{
							set_hudmessage(get_pcvar_num(kz_stats_red), get_pcvar_num(kz_stats_green), get_pcvar_num(kz_stats_blue), stats_x, stats_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_stats)  );	
							show_hudmessage( i, "%s Distance: %f^nMaxspeed: %f (%.03f)^nPrestrafe: %f^nStrafes: %d^nSync: %d%%^n", type, distance[id], maxspeed[id], gain[id], prestrafe[id],strafe_num[id], sync_[id]);
						}
						if(jump_type[id]==Type_CountJump && !failed_jump[id] && pev( id, pev_maxspeed )==250.0)
						{
							set_hudmessage(get_pcvar_num(kz_stats_red), get_pcvar_num(kz_stats_green), get_pcvar_num(kz_stats_blue), stats_x, stats_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_stats));
							show_hudmessage( i, "%s Distance: %f^nMaxspeed: %f (%.03f)^nPrestrafe: (%.03f) %f^nStrafes: %d^nSync: %d%%^n", type, distance[id], maxspeed[id], gain[id], prest1[id],prestrafe[id],strafe_num[id], sync_[id]);
						}
						if((jump_type[id] == Type_BhopLongJump || jump_type[id] == Type_StandupBhopLongJump ) && !failed_jump[id] && pev( id, pev_maxspeed )==250.0)
						{
							set_hudmessage(get_pcvar_num(kz_stats_red), get_pcvar_num(kz_stats_green), get_pcvar_num(kz_stats_blue), stats_x, stats_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_pre));
							show_hudmessage( i, "%s Distance: %f^nMaxspeed: %f (%.03f)^nPrestrafe: %f^nStrafes: %d^nSync: %d%%^n", type, distance[id], maxspeed[id], gain[id],prestrafe[id],strafe_num[id], sync_[id]);
						}
						if(jump_type[id]==Type_Multi_Count && !failed_jump[id] && pev( id, pev_maxspeed )==250.0)
						{
							set_hudmessage(get_pcvar_num(kz_stats_red), get_pcvar_num(kz_stats_green), get_pcvar_num(kz_stats_blue), stats_x, stats_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_stats) );
							show_hudmessage( i, "%s Distance: %f^nMaxspeed: %f (%.03f)^nPrestrafe: (%.03f) %f^nDucks: %d%^nStrafes: %d^nSync: %d%%^n", type, distance[id], maxspeed[id], gain[id], prest1[id],prestrafe[id],ducks[id], strafe_num[id], sync_[id]);
						}
						
						if(jump_type[id] != Type_Slide && streifstat[id]==true && jump_type[id]!=Type_None && !failed_jump[id] && pev( id, pev_maxspeed )==250.0)
						{
							set_hudmessage(get_pcvar_num(kz_stats_red), get_pcvar_num(kz_stats_green), get_pcvar_num(kz_stats_blue), strafe_x, strafe_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_streif));
							show_hudmessage(i,"%s",strMessBuf); //stata streifof
						}
						
						if(kz_stats_pre[id]==true && jump_type[id]==Type_Multi_Count && !failed_jump[id] && pev( id, pev_maxspeed )==250.0)
						{
							set_hudmessage(get_pcvar_num(kz_stats_red), get_pcvar_num(kz_stats_green), get_pcvar_num(kz_stats_blue), duck_x,duck_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_duck));	
							show_hudmessage(i, "%s",strMBuf);//stata duckov
						}
						
						//failstats
						if((jump_type[id]==Type_Fast_CountJump || jump_type[id] == Type_Drop_CountJump1 || jump_type[id]==Type_CountJumpafterDrop || jump_type[id]==Type_Drop_StandBhopLongJump || jump_type[id]==Type_ladderBhop || jump_type[id]==Type_ladder || jump_type[id]==Type_Drop_BhopLongJump || jump_type[id]==Type_Drop_CountJump || jump_type[id]==Type_WeirdLongJump || jump_type[id]==Type_LongJump || jump_type[id]==Type_HighJump)  && (failed_jump[id] || pev( id, pev_maxspeed )!=250.0))
						{
							set_hudmessage( get_pcvar_num(kz_failstats_red), get_pcvar_num(kz_failstats_green), get_pcvar_num(kz_failstats_blue), stats_x, stats_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_stats) );
							show_hudmessage( i, "%s Distance: %f^nMaxspeed: %f (%.03f)^nPrestrafe: %f^nStrafes: %d^nSync: %d%%^n", type, distance[id], maxspeed[id], gain[id], prestrafe[id],strafe_num[id], sync_[id]);
						}
						if(jump_type[id]==Type_CountJump && (failed_jump[id] || pev( id, pev_maxspeed )!=250.0))
						{
							set_hudmessage(get_pcvar_num(kz_failstats_red), get_pcvar_num(kz_failstats_green), get_pcvar_num(kz_failstats_blue), stats_x, stats_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_stats) );
							show_hudmessage( i, "%s Distance: %f^nMaxspeed: %f (%.03f)^nPrestrafe: (%.03f) %f^nStrafes: %d^nSync: %d%%^n", type, distance[id], maxspeed[id], gain[id], prest1[id],prestrafe[id],strafe_num[id], sync_[id]);
						}
						if((jump_type[id] == Type_BhopLongJump || jump_type[id] == Type_StandupBhopLongJump ) && (failed_jump[id] || pev( id, pev_maxspeed )!=250.0))
						{
							set_hudmessage(get_pcvar_num(kz_failstats_red), get_pcvar_num(kz_failstats_green), get_pcvar_num(kz_failstats_blue), stats_x, stats_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_pre) );
							show_hudmessage( i, "%s Distance: %f^nMaxspeed: %f (%.03f)^nPrestrafe: %f^nStrafes: %d^nSynca: %d%%^n", type, distance[id], maxspeed[id], gain[id], prestrafe[id],strafe_num[id], sync_[id]);
						}
						if(jump_type[id]==Type_Multi_CountJump && (failed_jump[id] || pev( id, pev_maxspeed )!=250.0))
						{
							set_hudmessage( get_pcvar_num(kz_failstats_red), get_pcvar_num(kz_failstats_green), get_pcvar_num(kz_failstats_blue), stats_x, stats_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_stats) );
							show_hudmessage( i, "%s Distance: %f^nMaxspeed: %f (%.03f)^nPrestrafe: (%.01f) (%.01f) %f^nStrafes: %d^nSync: %d%%^n", type, distance[id], maxspeed[id], gain[id], prest1[id],prest[id], prestrafe[id],strafe_num[id], sync_[id]);
						}
						
						if(jump_type[id]==Type_Multi_Count && (failed_jump[id] || pev( id, pev_maxspeed )!=250.0))
						{
							set_hudmessage(get_pcvar_num(kz_failstats_red), get_pcvar_num(kz_failstats_green), get_pcvar_num(kz_failstats_blue), stats_x, stats_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_stats) );
							show_hudmessage( i, "%s Distance: %f^nMaxspeed: %f (%.03f)^nPrestrafe: (%.03f) %f^nDucks: %d%^nStrafes: %d^nSync: %d%%^n", type, distance[id], maxspeed[id], gain[id], prest1[id],prestrafe[id],ducks[id],strafe_num[id], sync_[id]);
						}
												
						if(jump_type[id] != Type_Slide && streifstat[id]==true && jump_type[id]!=Type_None && (failed_jump[id] || pev( id, pev_maxspeed )!=250.0))
						{
							set_hudmessage(get_pcvar_num(kz_failstats_red), get_pcvar_num(kz_failstats_green), get_pcvar_num(kz_failstats_blue), strafe_x, strafe_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_streif) );
							show_hudmessage(i,"%s",strMessBuf);  //stata streifof fail
						}
						
						if(kz_stats_pre[id]==true && jump_type[id]==Type_Multi_Count && (failed_jump[id] || pev( id, pev_maxspeed )!=250.0))
						{
							set_hudmessage(get_pcvar_num(kz_failstats_red), get_pcvar_num(kz_failstats_green), get_pcvar_num(kz_failstats_blue), duck_x,duck_y, 0, 6.0, 2.5, 0.1, 0.3, get_pcvar_num(hud_duck));	
							show_hudmessage(i, "%s",strMBuf); //stata duckov fail
						}
						
											
					}
			}
		//console prints
		for( new i = INFO_ONE; i < 33; i++ )
		{
			if( (i == id || is_user_spectating_player(i, id)) && g_lj_stats[i]==true)
				{
						copy(strMessBuf,strLen,strMess);
						if((jump_type[id]==Type_Fast_CountJump || jump_type[id] == Type_Drop_CountJump1 || jump_type[id]==Type_CountJumpafterDrop || jump_type[id]==Type_Drop_StandBhopLongJump || jump_type[id]==Type_ladderBhop || jump_type[id]==Type_ladder || jump_type[id]==Type_Drop_BhopLongJump|| jump_type[id]==Type_Drop_CountJump || jump_type[id]==Type_WeirdLongJump || jump_type[id]==Type_LongJump || jump_type[id]==Type_HighJump) )
						{
							client_print( i, print_console, " ");
							client_print( i, print_console, "%s Distance: %f Maxspeed: %f (%.03f) Prestrafe: %f Strafes: %d Sync: %d%%", type, distance[id], maxspeed[id], gain[id], prestrafe[id], strafe_num[id],sync_[id] );
						}
						if(jump_type[id]==Type_CountJump )
						{
							client_print( i, print_console, " ");
							client_print( i, print_console, "%s Distance: %f Maxspeed: %f (%.03f) Prestrafe: (%.03f) %f Strafes: %d Sync: %d%%", type, distance[id], maxspeed[id], gain[id], prest1[id], prestrafe[id], strafe_num[id],sync_[id] );
						}
						if(jump_type[id] == Type_BhopLongJump || jump_type[id] == Type_StandupBhopLongJump)
						{
							client_print( i, print_console, " ");
							client_print( i, print_console, "%s Distance: %f Maxspeed: %f (%.03f) Prestrafe: (%.03f) %f Strafes: %d Sync: %d%%", type, distance[id], maxspeed[id], gain[id], prest1[id], prestrafe[id], strafe_num[id],sync_[id] );
						}
						if(jump_type[id]==Type_Multi_CountJump)
						{
							client_print( i, print_console, " ");
							client_print( i, print_console, "%s Distance: %f Maxspeed: %f (%.03f) Prestrafe: (%.01f) (%.01f) %f Strafes: %d Sync: %d%%", type, distance[id], maxspeed[id], gain[id], prest1[id],prest[id], prestrafe[id], strafe_num[id],sync_[id] );
						}
						if(jump_type[id]==Type_Multi_Count)
						{
							client_print( i, print_console, " ");
							client_print( i, print_console, "%s Distance: %f Maxspeed: %f (%.03f) Prestrafe: (%.03f) %f Ducks: %d% Strafes: %d Sync: %d%%", type, distance[id], maxspeed[id], gain[id], prest1[id],prestrafe[id],ducks[id],strafe_num[id], sync_[id]);
						}
						
						if(jump_type[id]!=Type_None)
						{
							static strMessHalf[40];
							for(jj=INFO_ONE; (jj <= strafe_num[id]) && (jj < NSTRAFES);jj++)
							{
									strtok(strMessBuf,strMessHalf,40,strMessBuf,40*NSTRAFES,'^n');
									replace(strMessHalf,40,"^n","");
									client_print(i, print_console, "%s", strMessHalf);
							}
						}
						if(jump_type[id]==Type_ladder)
						client_print(i, print_console, "Turn speed: %.03f", strafe_stat_speed[id][0][0]);
						/*if(failed_jump[id]==true && jump_type[id]!=Type_Slide && jumpoff_edge[id]<30 && jumpoff_edge[id]!=0.0 && block[id]>100 && block[id]<280)
						{
							client_print( i,print_console,"Fail!! Jumpoff %f-----Block %i",jumpoff_edge[id],block[id]);
						}
						if(failed_jump[id]==false && jump_type[id]!=Type_Slide && jumpoff_edge[id]<30 && jumpoff_edge[id]!=0.0 && block[id]>100 && block[id]<280)
						{
							client_print( i,print_console,"Jumpoff %f-----Block %i",jumpoff_edge[id],block[id]);
						}*/
						if(jump_type[id]==Type_Multi_Count)
						{
							client_print( i, print_console, "..................................................");
							client_print( i, print_console, "Prestrafe before ducking: %.03f",prest1[id]);
							for(new ss=2;ss<=ducks[id];ss++)
							client_print( i, print_console, "Prestrafe after #%d duck: %.03f",ss-1,statsduckspeed[id][ss]);
							client_print( i, print_console, "Prestrafe before jumping: %.03f",prestrafe[id]);
							client_print( i, print_console, "..................................................");
						}
						if(jump_type[id]==Type_Multi_CountJump )
						{
							client_print( i, print_console, "..................................................");
							client_print( i, print_console, "Prestrafe before ducking: %.03f",prest1[id]);
							client_print( i, print_console, "Prestrafe after 1st duck: %.03f",prest[id]);
							client_print( i, print_console, "Prestrafe before jumping: %.03f",prestrafe[id]);
							client_print( i, print_console, "..................................................");
						}
						
				}
		}
			
		get_pcvar_string(kz_prefix, prefix, 63);	
		
		//Msgs with sounds
		for( new i = INFO_ONE; i < 33; i++ )
			{
				if( (i == id || is_user_spectating_player(i, id)))
				{
					if( !failed_jump[id] && pev(id, pev_maxspeed) == 250.0)
					{
						if(jump_type[id]==Type_Multi_CountJump || jump_type[id]==Type_Multi_Count )
						{	
							
							static name[32];
							get_user_name(id, name, 31);
						
							if ( distance[id] >= get_pcvar_num(kz_god_dcj) ) {
								
							if( get_pcvar_num( kz_sounds ) ) client_cmd(0, "speak misc/mod_godlike");
							}
							else if ( distance[id] >= get_pcvar_num(kz_leet_dcj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/mod_wickedsick");
							}
							else if ( distance[id] >= get_pcvar_num(kz_holy_dcj)) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/holyshit");
							}
							else if ( distance[id] >= get_pcvar_num(kz_pro_dcj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/perfect");
							}
							else if ( distance[id] >= get_pcvar_num(kz_good_dcj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/impressive");
							}
						}
						if(jump_type[id]==Type_LongJump || jump_type[id]==Type_HighJump )
						{
							if ( distance[id] >= get_pcvar_num(kz_god_lj) ) {
								
							if( get_pcvar_num( kz_sounds ) ) client_cmd(0, "speak misc/mod_godlike");
							}
							else if ( distance[id] >= get_pcvar_num(kz_leet_lj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/mod_wickedsick");
							}
							else if ( distance[id] >= get_pcvar_num(kz_holy_lj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/holyshit");
							}
							else if ( distance[id] >= get_pcvar_num(kz_pro_lj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/perfect");
							}
							else if ( distance[id] >= get_pcvar_num(kz_good_lj)) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/impressive");
							}
						}
						if(jump_type[id]==Type_ladder)
						{
							if ( distance[id] >= get_pcvar_num(kz_god_ladder)) {
								
							if( get_pcvar_num( kz_sounds ) ) client_cmd(0, "speak misc/mod_godlike");
							}
							else if ( distance[id] >= get_pcvar_num(kz_leet_ladder)) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/mod_wickedsick");
							}
							else if ( distance[id] >= get_pcvar_num(kz_holy_ladder) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/holyshit");
							}
							else if ( distance[id] >= get_pcvar_num(kz_pro_ladder) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/perfect");
							}
							else if ( distance[id] >= get_pcvar_num(kz_good_ladder) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/impressive");
							}
						}
						if((jump_type[id]==Type_WeirdLongJump || jump_type[id]==Type_Drop_CountJump1 || jump_type[id]==Type_ladderBhop))
						{
							if ( distance[id] >= get_pcvar_num(kz_god_wj) ) {
								
							if( get_pcvar_num( kz_sounds ) ) client_cmd(0, "speak misc/mod_godlike");
							}
							else if ( distance[id] >= get_pcvar_num(kz_leet_wj)) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/mod_wickedsick");
							}
							else if ( distance[id] >= get_pcvar_num(kz_holy_wj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/holyshit");
							}
							else if ( distance[id] >= get_pcvar_num(kz_pro_wj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/perfect");
							}
							else if ( distance[id] >= get_pcvar_num(kz_good_wj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/impressive");
							}
						}
						if((jump_type[id]==Type_BhopLongJump || jump_type[id]==Type_StandupBhopLongJump))
						{
							if ( distance[id] >= get_pcvar_num(kz_god_bj)) {
								
							if( get_pcvar_num( kz_sounds ) ) client_cmd(0, "speak misc/mod_godlike");
							}
							else if ( distance[id] >= get_pcvar_num(kz_leet_bj)) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/mod_wickedsick");
							}
							else if ( distance[id] >= get_pcvar_num(kz_holy_bj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/holyshit");
							}
							else if ( distance[id] >= get_pcvar_num(kz_pro_bj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/perfect");
							}
							else if ( distance[id] >= get_pcvar_num(kz_good_bj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/impressive");
							}
							
						}
						if(jump_type[id]==Type_CountJump)
						{
							if ( distance[id] >= get_pcvar_num(kz_god_cj) ) {
								
							if( get_pcvar_num( kz_sounds ) ) client_cmd(0, "speak misc/mod_godlike");
							}
							else if ( distance[id] >= get_pcvar_num(kz_leet_cj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/mod_wickedsick");
							}
							else if ( distance[id] >= get_pcvar_num(kz_holy_cj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/holyshit");
							}
							else if ( distance[id] >= get_pcvar_num(kz_pro_cj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/perfect");
							}
							else if ( distance[id] >= get_pcvar_num(kz_good_cj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/impressive");
							}
							
						}
						if(jump_type[id]==Type_Drop_BhopLongJump || jump_type[id]==Type_Drop_StandBhopLongJump)
						{
							if ( distance[id] >= get_pcvar_num(kz_god_dbj) ) {
								
							if( get_pcvar_num( kz_sounds ) ) client_cmd(0, "speak misc/mod_godlike");
							}
							else if ( distance[id] >= get_pcvar_num(kz_leet_dbj)) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/mod_wickedsick");
							}
							else if ( distance[id] >= get_pcvar_num(kz_holy_dbj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/holyshit");
							}
							else if ( distance[id] >= get_pcvar_num(kz_pro_dbj)) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/perfect");
							}
							else if ( distance[id] >= get_pcvar_num(kz_good_dbj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/impressive");
							}
						}
						if(jump_type[id]==Type_Fast_CountJump)
						{
							if ( distance[id] >= (get_pcvar_num(kz_god_scj)+aircj) ) {
								
							if( get_pcvar_num( kz_sounds ) ) client_cmd(0, "speak misc/mod_godlike");
							}
							else if ( distance[id] >= (get_pcvar_num(kz_leet_scj)+aircj)) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/mod_wickedsick");
							}
							else if ( distance[id] >= (get_pcvar_num(kz_holy_scj)+aircj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/holyshit");
							}
							else if ( distance[id] >= (get_pcvar_num(kz_pro_scj)+aircj)) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/perfect");
							}
							else if ( distance[id] >= (get_pcvar_num(kz_good_scj)+aircj) ) {
								if( get_pcvar_num( kz_sounds ) ) client_cmd(i, "speak misc/impressive");
							}
						}
						
					}
				}
			}
		new iPlayers[32],iNum; 
		get_players( iPlayers, iNum,"ch") ;
		for(new i=0;i<iNum;i++) 
		{ 
			new ids=iPlayers[i]; 
			if(gHasColorChat[ids] ==true || ids==id)
			{	
				if( !failed_jump[id] && pev(id, pev_maxspeed) == 250.0)
					{
						if(jump_type[id]==Type_Multi_CountJump || jump_type[id]==Type_Multi_Count )
						{	
							
							static name[32];
							get_user_name(id, name, 31);
						
							if ( distance[id] >= get_pcvar_num(kz_god_dcj) ) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								if(jump_type[id]==Type_Multi_CountJump ) ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
								if(jump_type[id]==Type_Multi_Count) ColorChat(ids, RED, "[%s] %s jumped %.3f units with Multi CountJump!(%d ducks)^x01%s",prefix, name, distance[id], ducks[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_leet_dcj) ) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								if(jump_type[id]==Type_Multi_CountJump) ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
								if(jump_type[id]==Type_Multi_Count) ColorChat(ids, RED, "[%s] %s jumped %.3f units with Multi CountJump!(%d ducks)^x01%s",prefix, name, distance[id], ducks[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_holy_dcj) ) {
								if( get_pcvar_num( kz_uq_light) ) sineva(id);
								if(jump_type[id]==Type_Multi_CountJump) ColorChat(ids, BLUE, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
								if(jump_type[id]==Type_Multi_Count) ColorChat(ids, BLUE, "[%s] %s jumped %.3f units with Multi CountJump!(%d ducks)^x01%s" ,prefix, name, distance[id], ducks[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_pro_dcj) ) {
								if(jump_type[id]==Type_Multi_CountJump) ColorChat(ids, GREEN, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
								if(jump_type[id]==Type_Multi_Count) ColorChat(ids, GREEN, "[%s] %s jumped %.3f units with Multi CountJump!(%d ducks)^x01%s",prefix, name, distance[id], ducks[id],airacel[id]);
							}
							else if ( distance[id]>= get_pcvar_num(kz_good_dcj) ) {
								if(jump_type[id]==Type_Multi_CountJump) ColorChat(ids, GREY, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
								if(jump_type[id]==Type_Multi_Count) ColorChat(ids, GREY, "[%s] %s jumped %.3f units with Multi CountJump!(%d ducks)^x01%s",prefix, name, distance[id], ducks[id],airacel[id]);
							}
						}
						if(jump_type[id]==Type_LongJump || jump_type[id]==Type_HighJump )
						{	
							static name[32];
							get_user_name(id, name, 31);
							if ( distance[id] >= get_pcvar_num(kz_god_lj) ) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s ^x03%s",prefix, name, distance[id],Jtype[id],pre_type[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_leet_lj)  ) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s ^x03%s",prefix, name, distance[id],Jtype[id],pre_type[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_holy_lj) ) {
								if( get_pcvar_num( kz_uq_light) ) sineva(id);
								ColorChat(ids, BLUE, "[%s] %s jumped %.3f units with %s!^x01%s ^x03%s",prefix, name, distance[id],Jtype[id],pre_type[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_pro_lj) ) {
								
								ColorChat(ids, GREEN, "[%s] %s jumped %.3f units with %s!^x01%s ^x04%s",prefix, name, distance[id],Jtype[id],pre_type[id],airacel[id]);
							}
							else if ( distance[id] >=get_pcvar_num(kz_good_lj) ) {
								 ColorChat(ids, GREY, "[%s] %s jumped %.3f units with %s!^x01%s ^x03%s",prefix, name, distance[id],Jtype[id],pre_type[id],airacel[id]);
							}
						}
						if(jump_type[id]==Type_ladder)
						{	
							static name[32];
							get_user_name(id, name, 31);
							if ( distance[id] >= get_pcvar_num(kz_god_ladder) ) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_leet_ladder)) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_holy_ladder) ) {
								if( get_pcvar_num( kz_uq_light) ) sineva(id);
								ColorChat(ids, BLUE, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_pro_ladder) ) {
								ColorChat(ids, GREEN, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_good_ladder) ) {
								 ColorChat(ids, GREY, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
						}
						if((jump_type[id]==Type_WeirdLongJump || jump_type[id]==Type_Drop_CountJump1 || jump_type[id]==Type_ladderBhop))
						{	
							static name[32];
							get_user_name(id, name, 31);
							if ( distance[id] >= get_pcvar_num(kz_god_wj) ) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_leet_wj) ) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_holy_wj) ) {
								if( get_pcvar_num( kz_uq_light) ) sineva(id);
								ColorChat(ids, BLUE, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_pro_wj) ) {
								ColorChat(ids, GREEN, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_good_wj) ) {
								 ColorChat(ids, GREY, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
						}
						if((jump_type[id]==Type_BhopLongJump || jump_type[id]==Type_StandupBhopLongJump))
						{	
							static name[32];
							get_user_name(id, name, 31);
							if ( distance[id] >= get_pcvar_num(kz_god_bj)  ) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s ^x03%s",prefix, name, distance[id],Jtype[id],pre_type[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_leet_bj)) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s ^x03%s",prefix, name, distance[id],Jtype[id],pre_type[id],airacel[id]);
							}
							else if ( distance[id]>= get_pcvar_num(kz_holy_bj)) {
								if( get_pcvar_num( kz_uq_light) ) sineva(id);
								ColorChat(ids, BLUE, "[%s] %s jumped %.3f units with %s!^x01%s ^x03%s",prefix, name, distance[id],Jtype[id],pre_type[id],airacel[id]);
							}
							else if ( distance[id]>= get_pcvar_num(kz_pro_bj) ) {
								
								ColorChat(ids, GREEN, "[%s] %s jumped %.3f units with %s!^x01%s ^x04%s",prefix, name, distance[id],Jtype[id],pre_type[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_good_bj)) {
								 ColorChat(ids, GREY, "[%s] %s jumped %.3f units with %s!^x01%s ^x03%s",prefix, name, distance[id],Jtype[id],pre_type[id],airacel[id]);
							}
						}
						if(jump_type[id]==Type_CountJump)
						{	
							static name[32];
							get_user_name(id, name, 31);
							if ( distance[id] >=  get_pcvar_num(kz_god_cj) ) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s ^x03%s",prefix, name, distance[id],Jtype[id],pre_type[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_leet_cj) ) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s ^x03%s",prefix, name, distance[id],Jtype[id],pre_type[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_holy_cj)  ) {
								if( get_pcvar_num( kz_uq_light) ) sineva(id);
								ColorChat(ids, BLUE, "[%s] %s jumped %.3f units with %s!^x01%s ^x03%s",prefix, name, distance[id],Jtype[id],pre_type[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_pro_cj)  ) {
								ColorChat(ids, GREEN, "[%s] %s jumped %.3f units with %s!^x01%s ^x04%s",prefix, name, distance[id],Jtype[id],pre_type[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_good_cj)  ) {
								 ColorChat(ids, GREY, "[%s] %s jumped %.3f units with %s!^x01%s ^x03%s",prefix, name, distance[id],Jtype[id],pre_type[id],airacel[id]);
							}
						}
						if(jump_type[id]==Type_Drop_BhopLongJump || jump_type[id]==Type_Drop_StandBhopLongJump)
						{	
							static name[32];
							get_user_name(id, name, 31);
							if ( distance[id] >= get_pcvar_num(kz_god_dbj)  ) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_leet_dbj) ) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_holy_dbj) ) {
								if( get_pcvar_num( kz_uq_light) ) sineva(id);
								ColorChat(ids, BLUE, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_pro_dbj)) {
								ColorChat(ids, GREEN, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_good_dbj) ) {
								 ColorChat(ids, GREY, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
						}
						if(jump_type[id]==Type_Fast_CountJump)
						{	
							static name[32];
							get_user_name(id, name, 31);
							if ( distance[id] >= (get_pcvar_num(kz_god_scj)+aircj)) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >= (get_pcvar_num(kz_leet_scj)+aircj)) {
								if( get_pcvar_num( kz_uq_light) ) krasnota(id);
								ColorChat(ids, RED, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >= get_pcvar_num(kz_holy_scj)+aircj ) {
								if( get_pcvar_num( kz_uq_light) ) sineva(id);
								ColorChat(ids, BLUE, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >=( get_pcvar_num(kz_pro_scj)+aircj)){
								ColorChat(ids, GREEN, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
							else if ( distance[id] >= (get_pcvar_num(kz_good_scj)+aircj)) {
								 ColorChat(ids, GREY, "[%s] %s jumped %.3f units with %s!^x01%s",prefix, name, distance[id],Jtype[id],airacel[id]);
							}
						}
						
					}
				}
			}	
		
		
		// UberBeam start
		if( kz_beam[id]==true)
			{
			for( new i = 0; i < 100; i++ ) {
				if( gBeam_points[id][i][0] == 0.0
				&& gBeam_points[id][i][1] == 0.0
				&& gBeam_points[id][i][2] == 0.0 ) {
					continue;
				}
			
				message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id);
				write_byte ( TE_BEAMPOINTS );
				if( i == 100 ) {
					write_coord(floatround(gBeam_points[id][i][0]));
					write_coord(floatround(gBeam_points[id][i][1]));
					write_coord(floatround(jumpoff_origin[id][2]-34.0));
					write_coord(floatround(land_origin[0]));
					write_coord(floatround(land_origin[1]));
					write_coord(floatround(jumpoff_origin[id][2]-34.0));
				} else {
					if ( i > 2 ) {
						write_coord(floatround(gBeam_points[id][i-1][0]));
						write_coord(floatround(gBeam_points[id][i-1][1]));
						write_coord(floatround(jumpoff_origin[id][2]-34.0));
					} else {
						write_coord(floatround(jumpoff_origin[id][0]));
						write_coord(floatround(jumpoff_origin[id][1]));
						write_coord(floatround(jumpoff_origin[id][2]-34.0));
					}
					write_coord(floatround(gBeam_points[id][i][0]));
					write_coord(floatround(gBeam_points[id][i][1]));
					write_coord(floatround(jumpoff_origin[id][2]-34.0));
				}
				write_short(gBeam);
				write_byte(1);
				write_byte(5);
				write_byte(30);
				write_byte(20);
				write_byte(0);
				if(gBeam_duck[id][i]) {
					write_byte(255);
					write_byte(0);
					write_byte(0);
				} else {
					write_byte(255);
					write_byte(255);
					write_byte(0);
				}
				write_byte(200);
				write_byte(200);
				message_end();
			}
		}
		//UberBeam end.
		
		g_reset[id] = true;
		
		//ColorChat(id, GREEN, "reset5 ");
	}
	
	
	if((jump_type[id]==Type_WeirdLongJump || (jump_type[id]==Type_Drop_BhopLongJump && get_gametime( )-dropbjtime[id]==0)) && (button & IN_DUCK || oldbuttons &IN_DUCK) && flags & FL_ONGROUND && jump_type[id] != Type_Drop_CountJump1 && oldjump_type[id]==0)
	{
		
		
		jump_type[id] = Type_Drop_CountJump1;
		formatex(Jtype[id],31,"Drop CJ");
		formatex(Jtype1[id],31,"drcj");
		remove_task(id);
		
		origin[2]=0.0;
		vFallAt1[id][2]=0.0;
		
		
		if (get_distance_f(vFallAt1[id], origin) > 32.0)
		{
			jump_type[id] = Type_None;
			//ColorChat(id, RED, "popali ne drop");
				
				
		}
		
		duckoff_time[id] = get_gametime( );
		//ColorChat(id, RED, "popali d drop");
		//ColorChat(id,GREY," drop cj reset %f",get_distance_f(vFallAt1[id], origin));
		//ColorChat(id,RED," x %f  y %f  z %f",vFallAt1[id][0],vFallAt1[id][1],vFallAt1[id][2]);
		//ColorChat(id,GREEN," xo %f  yo %f  zo %f",origin[0],origin[1],origin[2]);
			
		
		//set_task(0.81,"JumpReset", id);
	}
	else if( !in_air[id] && oldbuttons & IN_DUCK && !(buttons & IN_DUCK) && jump_type[id] == Type_Drop_CountJump1)
	{
		for( new i = INFO_ONE; i < 33; i++ )
			{
				if( (i == id || is_user_spectating_player(i, id)))
				{
					if(showpre[id]==true && showduck[id]==true )
					{
						set_hudmessage(get_pcvar_num(kz_prest_r),get_pcvar_num(kz_prest_g), get_pcvar_num(kz_prest_b), get_pcvar_float(kz_prest_x), get_pcvar_float(kz_prest_y), 0, 0.0, 0.7, 0.1, 0.1, get_pcvar_num(hud_pre));
						show_hudmessage(i, "Duck Pre: %.03f",speed);
					}
				}
			}
		
	}
	
	
	if( flags&FL_ONGROUND && get_gametime( ) - duckoff_time[id] < 0.3)
	{
		pev(id, pev_origin, groundorig[id]);
		//ColorChat(id, GREEN, "origin %f",groundorig[id][2]);
	}
	
}
}
return FMRES_IGNORED;
}



public save_toplj()
{
	new profile[128];
	formatex(profile, 127, "%s/Top10_lj.dat", ljsDir);
	
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	new Data[256];
	new f = fopen(profile, "at");
	for(new i = 0; i < 20; i++)
	{
		formatex(Data, 255, "^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^"^n",lj_names[i],lj_ip[i], lj_dist[i],lj_maxsped[i],lj_prestr[i],lj_streif[i],lj_syncc[i]);
		fputs(f, Data);
	}
	fclose(f);
}
public save_topdropsbj()
{
	new profile[128];
	formatex(profile, 127, "%s/Top10_scj.dat", ljsDir);
	
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	new Data[256];
	new f = fopen(profile, "at");
	for(new i = 0; i < 20; i++)
	{
		formatex(Data, 255, "^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^"^n",dropsbj_names[i],dropsbj_ip[i], dropsbj_dist[i],dropsbj_maxsped[i],dropsbj_prestr[i],dropsbj_streif[i],dropsbj_syncc[i]);
		fputs(f, Data);
	}
	fclose(f);
}
public save_topcj()
{
	new profile[128];
	formatex(profile, 127, "%s/Top10_cj.dat", ljsDir);
	
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	new Data[256];
	new f = fopen(profile, "at");
	for(new i = 0; i < 20; i++)
	{
		formatex(Data, 255, "^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^"^n",cj_names[i],cj_ip[i], cj_dist[i],cj_maxsped[i],cj_prestr[i],cj_streif[i],cj_syncc[i]);
		fputs(f, Data);
	}
	fclose(f);
}
public save_topladder()
{
	new profile[128];
	formatex(profile, 127, "%s/Top10_ladder.dat", ljsDir);
	
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	new Data[256];
	new f = fopen(profile, "at");
	for(new i = 0; i < 20; i++)
	{
		formatex(Data, 255, "^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^"^n",ladder_names[i],ladder_ip[i], ladder_dist[i],ladder_maxsped[i],ladder_prestr[i],ladder_streif[i],ladder_syncc[i]);
		fputs(f, Data);
	}
	fclose(f);
}
public save_topbj()
{
	new profile[128];
	formatex(profile, 127, "%s/Top10_bj.dat", ljsDir);
	
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	new Data[256];
	new f = fopen(profile, "at");
	for(new i = 0; i < 20; i++)
	{
		formatex(Data, 255, "^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^"^n",bj_names[i],bj_ip[i], bj_dist[i],bj_maxsped[i],bj_prestr[i],bj_streif[i],bj_syncc[i]);
		fputs(f, Data);
	}
	fclose(f);
}
public save_topsbj()
{
	new profile[128];
	formatex(profile, 127, "%s/Top10_sbj.dat", ljsDir);
	
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	new Data[256];
	new f = fopen(profile, "at");
	for(new i = 0; i < 20; i++)
	{
		formatex(Data, 255, "^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^"^n",sbj_names[i],sbj_ip[i], sbj_dist[i],sbj_maxsped[i],sbj_prestr[i],sbj_streif[i],sbj_syncc[i]);
		fputs(f, Data);
	}
	fclose(f);
}
public save_topwj()
{
	new profile[128];
	formatex(profile, 127, "%s/Top10_wj.dat", ljsDir);
	
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	new Data[256];
	new f = fopen(profile, "at");
	for(new i = 0; i < 20; i++)
	{
		formatex(Data, 255, "^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^"^n",wj_names[i],wj_ip[i], wj_dist[i],wj_maxsped[i],wj_prestr[i],wj_streif[i],wj_syncc[i]);
		fputs(f, Data);
	}
	fclose(f);
}
public save_topdropcj()
{
	new profile[128];
	formatex(profile, 127, "%s/Top10_dropcj.dat", ljsDir);
	
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	new Data[256];
	new f = fopen(profile, "at");
	for(new i = 0; i < 20; i++)
	{
		formatex(Data, 255, "^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^"^n",dropcj_names[i],dropcj_ip[i], dropcj_dist[i],dropcj_maxsped[i],dropcj_prestr[i],dropcj_streif[i],dropcj_syncc[i]);
		fputs(f, Data);
	}
	fclose(f);
}
public save_topdropbj()
{
	new profile[128];
	formatex(profile, 127, "%s/Top10_dropbj.dat", ljsDir);
	
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	new Data[256];
	new f = fopen(profile, "at");
	for(new i = 0; i < 20; i++)
	{
		formatex(Data, 255, "^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^"^n",dropbj_names[i],dropbj_ip[i], dropbj_dist[i],dropbj_maxsped[i],dropbj_prestr[i],dropbj_streif[i],dropbj_syncc[i]);
		fputs(f, Data);
	}
	fclose(f);
}
public save_topldbhop()
{
	new profile[128];
	formatex(profile, 127, "%s/Top10_ldbhop.dat", ljsDir);
	
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	new Data[256];
	new f = fopen(profile, "at");
	for(new i = 0; i < 20; i++)
	{
		formatex(Data, 255, "^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^"^n",ldbhop_names[i],ldbhop_ip[i], ldbhop_dist[i],ldbhop_maxsped[i],ldbhop_prestr[i],ldbhop_streif[i],ldbhop_syncc[i]);
		fputs(f, Data);
	}
	fclose(f);
}
public save_topdcj()
{
	new profile[128];
	formatex(profile, 127, "%s/Top10_dcj.dat", ljsDir);
	
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	new Data[256];
	new f = fopen(profile, "at");
	for(new i = 0; i < 20; i++)
	{
		formatex(Data, 255, "^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^"^n",dcj_names[i],dcj_ip[i], dist[i],maxsped[i],prestr[i],streif[i],syncc[i]);
		fputs(f, Data);
	}
	fclose(f);
}


public save_topmcj()
{
	new profile[128];
	formatex(profile, 127, "%s/Top10_mcj.dat", ljsDir);
	
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	new Data[256];
	new f = fopen(profile, "at");
	for(new i = 0; i < 20; i++)
	{
		formatex(Data, 255, "^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^"^n",mcj_names[i],mcj_ip[i], mcj_dist[i],mcj_maxsped[i],mcj_prestr[i],mcj_streif[i],mcj_syncc[i],mcj_ducks[i]);
		fputs(f, Data);
	}
	fclose(f);
}
public read_toplj()
{
	new profile[128],prodata[256];
	formatex(profile, 127, "%s/Top10_lj.dat", ljsDir);
	
	new f = fopen(profile, "rt" );
	new i = 0;
	while( !feof(f) && i < 21)
	{
		fgets(f, prodata, 255);
		new d[25], m[25], p[25], sf[25],s[25];
		parse(prodata, lj_names[i], 31, lj_ip[i], 31,  d, 25, m, 25, p, 25, sf, 25,s, 25);
		lj_dist[i]= str_to_num(d);
		lj_maxsped[i]= str_to_num(m);
		lj_prestr[i] = str_to_num(p);
		lj_streif[i] = str_to_num(sf);
		lj_syncc[i] = str_to_num(s);
		i++;
	}
	fclose(f);
}
public read_topdropsbj()
{
	new profile[128],prodata[256];
	formatex(profile, 127, "%s/Top10_scj.dat", ljsDir);
	
	new f = fopen(profile, "rt" );
	new i = 0;
	while( !feof(f) && i < 21)
	{
		fgets(f, prodata, 255);
		new d[25], m[25], p[25], sf[25],s[25];
		parse(prodata, dropsbj_names[i], 31, dropsbj_ip[i], 31,  d, 25, m, 25, p, 25, sf, 25,s, 25);
		dropsbj_dist[i]= str_to_num(d);
		dropsbj_maxsped[i]= str_to_num(m);
		dropsbj_prestr[i] = str_to_num(p);
		dropsbj_streif[i] = str_to_num(sf);
		dropsbj_syncc[i] = str_to_num(s);
		i++;
	}
	fclose(f);
}
public read_topcj()
{
	new profile[128],prodata[256];
	formatex(profile, 127, "%s/Top10_cj.dat", ljsDir);
	
	new f = fopen(profile, "rt" );
	new i = 0;
	while( !feof(f) && i < 21)
	{
		fgets(f, prodata, 255);
		new d[25], m[25], p[25], sf[25],s[25];
		parse(prodata, cj_names[i], 31, cj_ip[i], 31,  d, 25, m, 25, p, 25, sf, 25,s, 25);
		cj_dist[i]= str_to_num(d);
		cj_maxsped[i]= str_to_num(m);
		cj_prestr[i] = str_to_num(p);
		cj_streif[i] = str_to_num(sf);
		cj_syncc[i] = str_to_num(s);
		i++;
	}
	fclose(f);
}
public read_topwj()
{
	new profile[128],prodata[256];
	formatex(profile, 127, "%s/Top10_wj.dat", ljsDir);
	
	new f = fopen(profile, "rt" );
	new i = 0;
	while( !feof(f) && i < 21)
	{
		fgets(f, prodata, 255);
		new d[25], m[25], p[25], sf[25],s[25];
		parse(prodata, wj_names[i], 31, wj_ip[i], 31,  d, 25, m, 25, p, 25, sf, 25,s, 25);
		wj_dist[i]= str_to_num(d);
		wj_maxsped[i]= str_to_num(m);
		wj_prestr[i] = str_to_num(p);
		wj_streif[i] = str_to_num(sf);
		wj_syncc[i] = str_to_num(s);
		i++;
	}
	fclose(f);
}
public read_topbj()
{
	new profile[128],prodata[256];
	formatex(profile, 127, "%s/Top10_bj.dat", ljsDir);
	
	new f = fopen(profile, "rt" );
	new i = 0;
	while( !feof(f) && i < 21)
	{
		fgets(f, prodata, 255);
		new d[25], m[25], p[25], sf[25],s[25];
		parse(prodata, bj_names[i], 31, bj_ip[i], 31,  d, 25, m, 25, p, 25, sf, 25,s, 25);
		bj_dist[i]= str_to_num(d);
		bj_maxsped[i]= str_to_num(m);
		bj_prestr[i] = str_to_num(p);
		bj_streif[i] = str_to_num(sf);
		bj_syncc[i] = str_to_num(s);
		i++;
	}
	fclose(f);
}
public read_topsbj()
{
	new profile[128],prodata[256];
	formatex(profile, 127, "%s/Top10_sbj.dat", ljsDir);
	
	new f = fopen(profile, "rt" );
	new i = 0;
	while( !feof(f) && i < 21)
	{
		fgets(f, prodata, 255);
		new d[25], m[25], p[25], sf[25],s[25];
		parse(prodata, sbj_names[i], 31, sbj_ip[i], 31,  d, 25, m, 25, p, 25, sf, 25,s, 25);
		sbj_dist[i]= str_to_num(d);
		sbj_maxsped[i]= str_to_num(m);
		sbj_prestr[i] = str_to_num(p);
		sbj_streif[i] = str_to_num(sf);
		sbj_syncc[i] = str_to_num(s);
		i++;
	}
	fclose(f);
}
public read_topladder()
{
	new profile[128],prodata[256];
	formatex(profile, 127, "%s/Top10_ladder.dat", ljsDir);
	
	new f = fopen(profile, "rt" );
	new i = 0;
	while( !feof(f) && i < 21)
	{
		fgets(f, prodata, 255);
		new d[25], m[25], p[25], sf[25],s[25];
		parse(prodata, ladder_names[i], 31, ladder_ip[i], 31,  d, 25, m, 25, p, 25, sf, 25,s, 25);
		ladder_dist[i]= str_to_num(d);
		ladder_maxsped[i]= str_to_num(m);
		ladder_prestr[i] = str_to_num(p);
		ladder_streif[i] = str_to_num(sf);
		ladder_syncc[i] = str_to_num(s);
		i++;
	}
	fclose(f);
}
public read_topldbhop()
{
	new profile[128],prodata[256];
	formatex(profile, 127, "%s/Top10_ldbhop.dat", ljsDir);
	
	new f = fopen(profile, "rt" );
	new i = 0;
	while( !feof(f) && i < 21)
	{
		fgets(f, prodata, 255);
		new d[25], m[25], p[25], sf[25],s[25];
		parse(prodata, ldbhop_names[i], 31, ldbhop_ip[i], 31,  d, 25, m, 25, p, 25, sf, 25,s, 25);
		ldbhop_dist[i]= str_to_num(d);
		ldbhop_maxsped[i]= str_to_num(m);
		ldbhop_prestr[i] = str_to_num(p);
		ldbhop_streif[i] = str_to_num(sf);
		ldbhop_syncc[i] = str_to_num(s);
		i++;
	}
	fclose(f);
}
public read_topdropcj()
{
	new profile[128],prodata[256];
	formatex(profile, 127, "%s/Top10_dropcj.dat", ljsDir);
	
	new f = fopen(profile, "rt" );
	new i = 0;
	while( !feof(f) && i < 21)
	{
		fgets(f, prodata, 255);
		new d[25], m[25], p[25], sf[25],s[25];
		parse(prodata, dropcj_names[i], 31, dropcj_ip[i], 31,  d, 25, m, 25, p, 25, sf, 25,s, 25);
		dropcj_dist[i]= str_to_num(d);
		dropcj_maxsped[i]= str_to_num(m);
		dropcj_prestr[i] = str_to_num(p);
		dropcj_streif[i] = str_to_num(sf);
		dropcj_syncc[i] = str_to_num(s);
		i++;
	}
	fclose(f);
}
public read_topdropbj()
{
	new profile[128],prodata[256];
	formatex(profile, 127, "%s/Top10_dropbj.dat", ljsDir);
	
	new f = fopen(profile, "rt" );
	new i = 0;
	while( !feof(f) && i < 21)
	{
		fgets(f, prodata, 255);
		new d[25], m[25], p[25], sf[25],s[25];
		parse(prodata, dropbj_names[i], 31, dropbj_ip[i], 31,  d, 25, m, 25, p, 25, sf, 25,s, 25);
		dropbj_dist[i]= str_to_num(d);
		dropbj_maxsped[i]= str_to_num(m);
		dropbj_prestr[i] = str_to_num(p);
		dropbj_streif[i] = str_to_num(sf);
		dropbj_syncc[i] = str_to_num(s);
		i++;
	}
	fclose(f);
}
public read_topdcj()
{
	new profile[128],prodata[256];
	formatex(profile, 127, "%s/Top10_dcj.dat", ljsDir);
	
	new f = fopen(profile, "rt" );
	new i = 0;
	while( !feof(f) && i < 21)
	{
		fgets(f, prodata, 255);
		new d[25], m[25], p[25], sf[25],s[25];
		parse(prodata, dcj_names[i], 31, dcj_ip[i], 31,  d, 25, m, 25, p, 25, sf, 25,s, 25);
		dist[i]= str_to_num(d);
		maxsped[i]= str_to_num(m);
		prestr[i] = str_to_num(p);
		streif[i] = str_to_num(sf);
		syncc[i] = str_to_num(s);
		i++;
	}
	fclose(f);
}
public read_topmcj()
{
	new profile[128],prodata[256];
	formatex(profile, 127, "%s/Top10_mcj.dat", ljsDir);
	
	new f = fopen(profile, "rt" );
	new i = 0;
	while( !feof(f) && i < 21)
	{
		fgets(f, prodata, 255);
		new d[25], m[25], p[25], sf[25],s[25],duc[25];
		parse(prodata, mcj_names[i], 31, mcj_ip[i], 31,  d, 25, m, 25, p, 25, sf, 25,s, 25,duc,25);
		mcj_dist[i]= str_to_num(d);
		mcj_maxsped[i]= str_to_num(m);
		mcj_prestr[i] = str_to_num(p);
		mcj_streif[i] = str_to_num(sf);
		mcj_syncc[i] = str_to_num(s);
		mcj_ducks[i] =str_to_num(duc);
		i++;
	}
	fclose(f);
}
public chekdcj(id,Float:dd,Float:mm,Float:pp,sf,s) 
{	new d,m,p;
	static rankby;
	rankby = get_pcvar_num(kz_top_rank_by);
	get_pcvar_string(kz_prefix, prefix, 63);

	new authid[32],name[32];
	get_user_name(id, name, 31);
	if( rankby == 0 )
		get_user_name(id, authid, 31);
	if( rankby == 1 )
		get_user_ip(id, authid, 31, 1);
	if( rankby == 2 )
		get_user_authid(id, authid ,32);
	
	d=floatround(dd*1000000);// todo: zdelat poproshe)
	m=floatround(mm*1000000);
	p=floatround(pp*1000000);

	for (new i = 0; i < 20; i++)
	{
		if( d > dist[i] )
		{
			new pos = i;	
			while( !equal(dcj_ip[pos],authid) && pos < 20 )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(dcj_ip[j], 31, dcj_ip[j-1]);
				formatex(dcj_names[j], 31, dcj_names[j-1]);
				dist[j] = dist[j-1];
				maxsped[j] = maxsped[j-1];
				prestr[j] = prestr[j-1];
				streif[j] = streif[j-1];
				syncc[j] = syncc[j-1];
			}
			
			formatex(dcj_ip[i], 31, authid);
			formatex(dcj_names[i], 31, name);
			dist[i]=d;
			maxsped[i] = m;
			prestr[i] = p;
			streif[i] = sf;
			syncc[i] = s;
			save_topdcj();
			client_print(0,print_chat,"[%s] %s is now %i in dcj top with %f ",prefix,name,(i+1),dd);				
			break;
		}
		else if( equal(dcj_ip[i], authid)) break;	
	}
}
public cheklj(id,Float:dd,Float:mm,Float:pp,sf,s) 
{	new d,m,p;
	static rankby;
	rankby = get_pcvar_num(kz_top_rank_by);
	get_pcvar_string(kz_prefix, prefix, 63);

	new authid[32],name[32];
	get_user_name(id, name, 31);
	if( rankby == 0 )
		get_user_name(id, authid, 31);
	if( rankby == 1 )
		get_user_ip(id, authid, 31, 1);
	if( rankby == 2 )
		get_user_authid(id, authid ,32);
	
	d=floatround(dd*1000000);// todo: zdelat poproshe)
	m=floatround(mm*1000000);
	p=floatround(pp*1000000);

	for (new i = 0; i < 20; i++)
	{
		if( d > lj_dist[i] )
		{
			new pos = i;	
			while( !equal(lj_ip[pos],authid) && pos < 20 )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(lj_ip[j], 31, lj_ip[j-1]);
				formatex(lj_names[j], 31, lj_names[j-1]);
				lj_dist[j] = lj_dist[j-1];
				lj_maxsped[j] =lj_maxsped[j-1];
				lj_prestr[j] = lj_prestr[j-1];
				lj_streif[j] = lj_streif[j-1];
				lj_syncc[j] = lj_syncc[j-1];
			}
			
			formatex(lj_ip[i], 31, authid);
			formatex(lj_names[i], 31, name);
			lj_dist[i]=d;
			lj_maxsped[i] = m;
			lj_prestr[i] = p;
			lj_streif[i] = sf;
			lj_syncc[i] = s;
			save_toplj();
			client_print(0,print_chat,"[%s] %s is now %i in lj top with %f ",prefix,name,(i+1),dd);				
			break;
		}
		else if( equal(lj_ip[i], authid)) break;	
	}
}
public chekdropsbj(id,Float:dd,Float:mm,Float:pp,sf,s) 
{	new d,m,p;
	static rankby;
	rankby = get_pcvar_num(kz_top_rank_by);
	get_pcvar_string(kz_prefix, prefix, 63);

	new authid[32],name[32];
	get_user_name(id, name, 31);
	if( rankby == 0 )
		get_user_name(id, authid, 31);
	if( rankby == 1 )
		get_user_ip(id, authid, 31, 1);
	if( rankby == 2 )
		get_user_authid(id, authid ,32);
	
	d=floatround(dd*1000000);// todo: zdelat poproshe)
	m=floatround(mm*1000000);
	p=floatround(pp*1000000);

	for (new i = 0; i < 20; i++)
	{
		if( d > dropsbj_dist[i] )
		{
			new pos = i;	
			while( !equal(dropsbj_ip[pos],authid) && pos < 20 )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(dropsbj_ip[j], 31, dropsbj_ip[j-1]);
				formatex(dropsbj_names[j], 31, dropsbj_names[j-1]);
				dropsbj_dist[j] = dropsbj_dist[j-1];
				dropsbj_maxsped[j] =dropsbj_maxsped[j-1];
				dropsbj_prestr[j] = dropsbj_prestr[j-1];
				dropsbj_streif[j] = dropsbj_streif[j-1];
				dropsbj_syncc[j] = dropsbj_syncc[j-1];
			}
			
			formatex(dropsbj_ip[i], 31, authid);
			formatex(dropsbj_names[i], 31, name);
			dropsbj_dist[i]=d;
			dropsbj_maxsped[i] = m;
			dropsbj_prestr[i] = p;
			dropsbj_streif[i] = sf;
			dropsbj_syncc[i] = s;
			save_topdropsbj();
			client_print(0,print_chat,"[%s] %s is now %i in scj top with %f ",prefix,name,(i+1),dd);				
			break;
		}
		else if( equal(dropsbj_ip[i], authid)) break;	
	}
}
public chekcj(id,Float:dd,Float:mm,Float:pp,sf,s) 
{	new d,m,p;
	static rankby;
	rankby = get_pcvar_num(kz_top_rank_by);
	get_pcvar_string(kz_prefix, prefix, 63);

	new authid[32],name[32];
	get_user_name(id, name, 31);
	if( rankby == 0 )
		get_user_name(id, authid, 31);
	if( rankby == 1 )
		get_user_ip(id, authid, 31, 1);
	if( rankby == 2 )
		get_user_authid(id, authid ,32);
	
	d=floatround(dd*1000000);// todo: zdelat poproshe)
	m=floatround(mm*1000000);
	p=floatround(pp*1000000);

	for (new i = 0; i < 20; i++)
	{
		if( d > cj_dist[i] )
		{
			new pos = i;	
			while( !equal(cj_ip[pos],authid) && pos < 20 )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(cj_ip[j], 31, cj_ip[j-1]);
				formatex(cj_names[j], 31, cj_names[j-1]);
				cj_dist[j] = cj_dist[j-1];
				cj_maxsped[j] =cj_maxsped[j-1];
				cj_prestr[j] = cj_prestr[j-1];
				cj_streif[j] = cj_streif[j-1];
				cj_syncc[j] = cj_syncc[j-1];
			}
			
			formatex(cj_ip[i], 31, authid);
			formatex(cj_names[i], 31, name);
			cj_dist[i]=d;
			cj_maxsped[i] = m;
			cj_prestr[i] = p;
			cj_streif[i] = sf;
			cj_syncc[i] = s;
			save_topcj();
			client_print(0,print_chat,"[%s] %s is now %i in cj top with %f ",prefix,name,(i+1),dd);				
			break;
		}
		else if( equal(cj_ip[i], authid)) break;	
	}
}
public chekbj(id,Float:dd,Float:mm,Float:pp,sf,s) 
{	new d,m,p;
	static rankby;
	rankby = get_pcvar_num(kz_top_rank_by);
	get_pcvar_string(kz_prefix, prefix, 63);

	new authid[32],name[32];
	get_user_name(id, name, 31);
	if( rankby == 0 )
		get_user_name(id, authid, 31);
	if( rankby == 1 )
		get_user_ip(id, authid, 31, 1);
	if( rankby == 2 )
		get_user_authid(id, authid ,32);
	
	d=floatround(dd*1000000);// todo: zdelat poproshe)
	m=floatround(mm*1000000);
	p=floatround(pp*1000000);

	for (new i = 0; i < 20; i++)
	{
		if( d > bj_dist[i] )
		{
			new pos = i;	
			while( !equal(bj_ip[pos],authid) && pos < 20 )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(bj_ip[j], 31, bj_ip[j-1]);
				formatex(bj_names[j], 31, bj_names[j-1]);
				bj_dist[j] = bj_dist[j-1];
				bj_maxsped[j] =bj_maxsped[j-1];
				bj_prestr[j] = bj_prestr[j-1];
				bj_streif[j] = bj_streif[j-1];
				bj_syncc[j] = bj_syncc[j-1];
			}
			
			formatex(bj_ip[i], 31, authid);
			formatex(bj_names[i], 31, name);
			bj_dist[i]=d;
			bj_maxsped[i] = m;
			bj_prestr[i] = p;
			bj_streif[i] = sf;
			bj_syncc[i] = s;
			save_topbj();
			client_print(0,print_chat,"[%s] %s is now %i in bj top with %f ",prefix,name,(i+1),dd);				
			break;
		}
		else if( equal(bj_ip[i], authid)) break;	
	}
}
public cheksbj(id,Float:dd,Float:mm,Float:pp,sf,s) 
{	new d,m,p;
	static rankby;
	rankby = get_pcvar_num(kz_top_rank_by);
	get_pcvar_string(kz_prefix, prefix, 63);

	new authid[32],name[32];
	get_user_name(id, name, 31);
	if( rankby == 0 )
		get_user_name(id, authid, 31);
	if( rankby == 1 )
		get_user_ip(id, authid, 31, 1);
	if( rankby == 2 )
		get_user_authid(id, authid ,32);
	
	d=floatround(dd*1000000);// todo: zdelat poproshe)
	m=floatround(mm*1000000);
	p=floatround(pp*1000000);

	for (new i = 0; i < 20; i++)
	{
		if( d > sbj_dist[i] )
		{
			new pos = i;	
			while( !equal(sbj_ip[pos],authid) && pos < 20 )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(sbj_ip[j], 31, sbj_ip[j-1]);
				formatex(sbj_names[j], 31, sbj_names[j-1]);
				sbj_dist[j] = sbj_dist[j-1];
				sbj_maxsped[j] =sbj_maxsped[j-1];
				sbj_prestr[j] = sbj_prestr[j-1];
				sbj_streif[j] = sbj_streif[j-1];
				sbj_syncc[j] = sbj_syncc[j-1];
			}
			
			formatex(sbj_ip[i], 31, authid);
			formatex(sbj_names[i], 31, name);
			sbj_dist[i]=d;
			sbj_maxsped[i] = m;
			sbj_prestr[i] = p;
			sbj_streif[i] = sf;
			sbj_syncc[i] = s;
			save_topsbj();
			client_print(0,print_chat,"[%s] %s is now %i in sbj top with %f ",prefix,name,(i+1),dd);				
			break;
		}
		else if( equal(sbj_ip[i], authid)) break;	
	}
}
public chekswj(id,Float:dd,Float:mm,Float:pp,sf,s) 
{	new d,m,p;
	static rankby;
	rankby = get_pcvar_num(kz_top_rank_by);
	get_pcvar_string(kz_prefix, prefix, 63);

	new authid[32],name[32];
	get_user_name(id, name, 31);
	if( rankby == 0 )
		get_user_name(id, authid, 31);
	if( rankby == 1 )
		get_user_ip(id, authid, 31, 1);
	if( rankby == 2 )
		get_user_authid(id, authid ,32);
	
	d=floatround(dd*1000000);// todo: zdelat poproshe)
	m=floatround(mm*1000000);
	p=floatround(pp*1000000);

	for (new i = 0; i < 20; i++)
	{
		if( d > wj_dist[i] )
		{
			new pos = i;	
			while( !equal(wj_ip[pos],authid) && pos < 20 )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(wj_ip[j], 31, wj_ip[j-1]);
				formatex(wj_names[j], 31, wj_names[j-1]);
				wj_dist[j] = wj_dist[j-1];
				wj_maxsped[j] =wj_maxsped[j-1];
				wj_prestr[j] = wj_prestr[j-1];
				wj_streif[j] = wj_streif[j-1];
				wj_syncc[j] = wj_syncc[j-1];
			}
			
			formatex(wj_ip[i], 31, authid);
			formatex(wj_names[i], 31, name);
			wj_dist[i]=d;
			wj_maxsped[i] = m;
			wj_prestr[i] = p;
			wj_streif[i] = sf;
			wj_syncc[i] = s;
			save_topwj();
			client_print(0,print_chat,"[%s] %s is now %i in wj top with %f ",prefix,name,(i+1),dd);				
			break;
		}
		else if( equal(wj_ip[i], authid)) break;	
	}
}
public cheksdropcj(id,Float:dd,Float:mm,Float:pp,sf,s) 
{	new d,m,p;
	static rankby;
	rankby = get_pcvar_num(kz_top_rank_by);
	get_pcvar_string(kz_prefix, prefix, 63);

	new authid[32],name[32];
	get_user_name(id, name, 31);
	if( rankby == 0 )
		get_user_name(id, authid, 31);
	if( rankby == 1 )
		get_user_ip(id, authid, 31, 1);
	if( rankby == 2 )
		get_user_authid(id, authid ,32);
	
	d=floatround(dd*1000000);// todo: zdelat poproshe)
	m=floatround(mm*1000000);
	p=floatround(pp*1000000);

	for (new i = 0; i < 20; i++)
	{
		if( d > dropcj_dist[i] )
		{
			new pos = i;	
			while( !equal(dropcj_ip[pos],authid) && pos < 20 )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(dropcj_ip[j], 31, dropcj_ip[j-1]);
				formatex(dropcj_names[j], 31, dropcj_names[j-1]);
				dropcj_dist[j] = dropcj_dist[j-1];
				dropcj_maxsped[j] =dropcj_maxsped[j-1];
				dropcj_prestr[j] = dropcj_prestr[j-1];
				dropcj_streif[j] = dropcj_streif[j-1];
				dropcj_syncc[j] = dropcj_syncc[j-1];
			}
			
			formatex(dropcj_ip[i], 31, authid);
			formatex(dropcj_names[i], 31, name);
			dropcj_dist[i]=d;
			dropcj_maxsped[i] = m;
			dropcj_prestr[i] = p;
			dropcj_streif[i] = sf;
			dropcj_syncc[i] = s;
			save_topdropcj();
			client_print(0,print_chat,"[%s] %s is now %i in drop cj top with %f ",prefix,name,(i+1),dd);				
			break;
		}
		else if( equal(dropcj_ip[i], authid)) break;	
	}
}
public cheksdropbj(id,Float:dd,Float:mm,Float:pp,sf,s) 
{	new d,m,p;
	static rankby;
	rankby = get_pcvar_num(kz_top_rank_by);
	get_pcvar_string(kz_prefix, prefix, 63);

	new authid[32],name[32];
	get_user_name(id, name, 31);
	if( rankby == 0 )
		get_user_name(id, authid, 31);
	if( rankby == 1 )
		get_user_ip(id, authid, 31, 1);
	if( rankby == 2 )
		get_user_authid(id, authid ,32);
	
	d=floatround(dd*1000000);// todo: zdelat poproshe)
	m=floatround(mm*1000000);
	p=floatround(pp*1000000);

	for (new i = 0; i < 20; i++)
	{
		if( d > dropbj_dist[i] )
		{
			new pos = i;	
			while( !equal(dropbj_ip[pos],authid) && pos < 20 )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(dropbj_ip[j], 31, dropbj_ip[j-1]);
				formatex(dropbj_names[j], 31, dropbj_names[j-1]);
				dropbj_dist[j] = dropbj_dist[j-1];
				dropbj_maxsped[j] =dropbj_maxsped[j-1];
				dropbj_prestr[j] = dropbj_prestr[j-1];
				dropbj_streif[j] = dropbj_streif[j-1];
				dropbj_syncc[j] = dropbj_syncc[j-1];
			}
			
			formatex(dropbj_ip[i], 31, authid);
			formatex(dropbj_names[i], 31, name);
			dropbj_dist[i]=d;
			dropbj_maxsped[i] = m;
			dropbj_prestr[i] = p;
			dropbj_streif[i] = sf;
			dropbj_syncc[i] = s;
			save_topdropbj();
			client_print(0,print_chat,"[%s] %s is now %i in drop bj top with %f ",prefix,name,(i+1),dd);				
			break;
		}
		else if( equal(dropbj_ip[i], authid)) break;	
	}
}
public cheksldbhop(id,Float:dd,Float:mm,Float:pp,sf,s) 
{	new d,m,p;
	static rankby;
	rankby = get_pcvar_num(kz_top_rank_by);
	get_pcvar_string(kz_prefix, prefix, 63);

	new authid[32],name[32];
	get_user_name(id, name, 31);
	if( rankby == 0 )
		get_user_name(id, authid, 31);
	if( rankby == 1 )
		get_user_ip(id, authid, 31, 1);
	if( rankby == 2 )
		get_user_authid(id, authid ,32);
	
	d=floatround(dd*1000000);// todo: zdelat poproshe)
	m=floatround(mm*1000000);
	p=floatround(pp*1000000);

	for (new i = 0; i < 20; i++)
	{
		if( d > ldbhop_dist[i] )
		{
			new pos = i;	
			while( !equal(ldbhop_ip[pos],authid) && pos < 20 )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(ldbhop_ip[j], 31, ldbhop_ip[j-1]);
				formatex(ldbhop_names[j], 31, ldbhop_names[j-1]);
				ldbhop_dist[j] = ldbhop_dist[j-1];
				ldbhop_maxsped[j] =ldbhop_maxsped[j-1];
				ldbhop_prestr[j] = ldbhop_prestr[j-1];
				ldbhop_streif[j] = ldbhop_streif[j-1];
				ldbhop_syncc[j] = ldbhop_syncc[j-1];
			}
			
			formatex(ldbhop_ip[i], 31, authid);
			formatex(ldbhop_names[i], 31, name);
			ldbhop_dist[i]=d;
			ldbhop_maxsped[i] = m;
			ldbhop_prestr[i] = p;
			ldbhop_streif[i] = sf;
			ldbhop_syncc[i] = s;
			save_topldbhop();
			client_print(0,print_chat,"[%s] %s is now %i in ladder bj top with %f ",prefix,name,(i+1),dd);				
			break;
		}
		else if( equal(ldbhop_ip[i], authid)) break;	
	}
}
public cheksmap(id,Float:dd,Float:mm,Float:pp,sf,s,typ[33]) 
{	new d,m,p;
	static rankby;
	rankby = get_pcvar_num(kz_top_rank_by);
	get_pcvar_string(kz_prefix, prefix, 63);

	new authid[32],name[32];
	get_user_name(id, name, 31);
	if( rankby == 0 )
		get_user_name(id, authid, 31);
	if( rankby == 1 )
		get_user_ip(id, authid, 31, 1);
	if( rankby == 2 )
		get_user_authid(id, authid ,32);
	
	d=floatround(dd*1000000);// todo: zdelat poproshe)
	m=floatround(mm*1000000);
	p=floatround(pp*1000000);

	for (new i = 0; i < 20; i++)
	{
		if( d > map_dist[i] )
		{
			new pos = i;	
			while( !equal(map_ip[pos],authid) && pos < 20 )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(map_ip[j], 31, map_ip[j-1]);
				formatex(map_names[j], 31, map_names[j-1]);
				map_dist[j] = map_dist[j-1];
				map_maxsped[j] =map_maxsped[j-1];
				map_prestr[j] = map_prestr[j-1];
				map_streif[j] = map_streif[j-1];
				map_syncc[j] = map_syncc[j-1];
				formatex(map_type[j], 31, map_type[j-1]);
			}
			
			formatex(map_ip[i], 31, authid);
			formatex(map_names[i], 31, name);
			map_dist[i]=d;
			map_maxsped[i] = m;
			map_prestr[i] = p;
			map_streif[i] = sf;
			map_syncc[i] = s;
			formatex(map_type[i], 31, typ);
			//save_topladder();
			
			client_print(0,print_chat,"[%s] %s is now %i in map top with %.03f type %s",prefix,name,(i+1),dd,typ);				
			break;
		}
		else if( equal(map_ip[i], authid)) break;	
	}
}
public cheksladder(id,Float:dd,Float:mm,Float:pp,sf,s) 
{	new d,m,p;
	static rankby;
	rankby = get_pcvar_num(kz_top_rank_by);
	get_pcvar_string(kz_prefix, prefix, 63);

	new authid[32],name[32];
	get_user_name(id, name, 31);
	if( rankby == 0 )
		get_user_name(id, authid, 31);
	if( rankby == 1 )
		get_user_ip(id, authid, 31, 1);
	if( rankby == 2 )
		get_user_authid(id, authid ,32);
	
	d=floatround(dd*1000000);// todo: zdelat poproshe)
	m=floatround(mm*1000000);
	p=floatround(pp*1000000);

	for (new i = 0; i < 20; i++)
	{
		if( d > ladder_dist[i] )
		{
			new pos = i;	
			while( !equal(ladder_ip[pos],authid) && pos < 20 )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(ladder_ip[j], 31, ladder_ip[j-1]);
				formatex(ladder_names[j], 31, ladder_names[j-1]);
				ladder_dist[j] = ladder_dist[j-1];
				ladder_maxsped[j] =ladder_maxsped[j-1];
				ladder_prestr[j] = ladder_prestr[j-1];
				ladder_streif[j] = ladder_streif[j-1];
				ladder_syncc[j] = ladder_syncc[j-1];
			}
			
			formatex(ladder_ip[i], 31, authid);
			formatex(ladder_names[i], 31, name);
			ladder_dist[i]=d;
			ladder_maxsped[i] = m;
			ladder_prestr[i] = p;
			ladder_streif[i] = sf;
			ladder_syncc[i] = s;
			save_topladder();
			client_print(0,print_chat,"[%s] %s is now %i in ladder top with %f ",prefix,name,(i+1),dd);				
			break;
		}
		else if( equal(ladder_ip[i], authid)) break;	
	}
}
public chekmcj(id,Float:dd,Float:mm,Float:pp,sf,s,duckss) 
{	new d,m,p;
	static rankby;
	rankby = get_pcvar_num(kz_top_rank_by);
	get_pcvar_string(kz_prefix, prefix, 63);
	
	new authid[32],name[32];
	get_user_name(id, name, 31);
	if( rankby == 0 )
		get_user_name(id, authid, 31);
	if( rankby == 1 )
		get_user_ip(id, authid, 31, 1);
	if( rankby == 2 )
		get_user_authid(id, authid ,32);
	
	d=floatround(dd*1000000);// todo: zdelat poproshe)
	m=floatround(mm*1000000);
	p=floatround(pp*1000000);

	for (new i = 0; i < 20; i++)
	{
		if( d > mcj_dist[i] )
		{
			new pos = i;	
			while( !equal(mcj_ip[pos],authid) && pos < 20 )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(mcj_ip[j], 31, mcj_ip[j-1]);
				formatex(mcj_names[j], 31, mcj_names[j-1]);
				mcj_dist[j] = mcj_dist[j-1];
				mcj_maxsped[j] = mcj_maxsped[j-1];
				mcj_prestr[j] = mcj_prestr[j-1];
				mcj_streif[j] = mcj_streif[j-1];
				mcj_syncc[j] = mcj_syncc[j-1];
				mcj_ducks[j] = mcj_ducks[j-1];
			}
			
			formatex(mcj_ip[i], 31, authid);
			formatex(mcj_names[i], 31, name);
			mcj_dist[i]=d;
			mcj_maxsped[i] = m;
			mcj_prestr[i] = p;
			mcj_streif[i] = sf;
			mcj_syncc[i] = s;
			mcj_ducks[i] = duckss;
			save_topmcj();
			client_print(0,print_chat,"[%s] %s is now %i in mcj top with %f ",prefix,name,(i+1),dd);			
			break;
		}
		else if( equal(mcj_ip[i], authid)) break;
			
	}
}
//dcj top
public show_topdcj(id)
{	
	static buffer[2368], name[131], len, i;
	
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{width:100%%;line-height:160%%;font-size:12px}.q{border:1px solid #4a4945}.b{background:#2a2a2a}</STYLE><table cellpadding=2 cellspacing=0 border=0>");
	len += format(buffer[len], 2367-len, "<tr  align=center bgcolor=#52697B><th width=5%%> # <th width=34%% align=left> Name <th width=10%%> Distance <th  width=10%%> MaxSpeed <th  width=11%%> PreStrafe <th  width=9%%> Strafes <th  width=6%%> Sync");
		
	for( i = INFO_ZERO; i < NSHOW; i++ )
		{		
			if( dist[i] == 0)
			{
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), "-", "-", "-", "-", "-", "-");
				i=NSHOW;
			}
			else
			{
				name = dcj_names[i];
				while( containi(name, "<") != -1 )
					replace(name, 129, "<", "&lt;");
				while( containi(name, ">") != -1 )
					replace(name, 129, ">", "&gt;");
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %d.%01d <td> %d.%01d <td> %d.%01d <td> %d <td> %d", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), name, (dist[i]/1000000), (dist[i]%1000000/100000), (maxsped[i]/1000000), (maxsped[i]%1000000/100000), (prestr[i]/1000000), (prestr[i]%1000000/100000), streif[i],syncc[i] );
		
			}
		}
	len += format(buffer[len], 2367-len, "</table></body>");
	static strin[20];
	format(strin,19, "Top %d Double CJ's", NSHOW);
	show_motd(id, buffer, strin);
}
public show_toplj(id)
{	
	static buffer[2368], name[131], len, i;
	
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{width:100%%;line-height:160%%;font-size:12px}.q{border:1px solid #4a4945}.b{background:#2a2a2a}</STYLE><table cellpadding=2 cellspacing=0 border=0>");
	len += format(buffer[len], 2367-len, "<tr  align=center bgcolor=#52697B><th width=5%%> # <th width=34%% align=left> Name <th width=10%%> Distance <th  width=10%%> MaxSpeed <th  width=11%%> PreStrafe <th  width=9%%> Strafes <th  width=6%%> Sync");
		
	for( i = INFO_ZERO; i < NSHOW; i++ )
		{		
			if( lj_dist[i] == 0)
			{
				len += format(buffer[len], 2367-len, "<tr%s align=center><td> %d <td align=left> %s <td> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), "-", "-", "-", "-", "-", "-");
				i=NSHOW;
			}
			else
			{
				name = lj_names[i];
				while( containi(name, "<") != -1 )
					replace(name, 129, "<", "&lt;");
				while( containi(name, ">") != -1 )
					replace(name, 129, ">", "&gt;");
				len += format(buffer[len], 2367-len, "<tr%s align=center><td> %d <td align=left> %s <td> %d.%01d <td> %d.%01d <td> %d.%01d <td> %d <td> %d", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), name, (lj_dist[i]/1000000), (lj_dist[i]%1000000/100000), (lj_maxsped[i]/1000000), (lj_maxsped[i]%1000000/100000), (lj_prestr[i]/1000000), (lj_prestr[i]%1000000/100000), lj_streif[i],lj_syncc[i] );
		
			}
		}
	len += format(buffer[len], 2367-len, "</table></body>");
	//len += formatex(buffer[len], 2367-len, "<tr align=bottom><Center>JumpStats by kzuq#BorJomi<BR>© 2010");
	static strin[20];
	format(strin,19, "Top %d LJ's", NSHOW);
	show_motd(id, buffer, strin);
}
public show_topdropsbj(id)
{	
	static buffer[2368], name[131], len, i;
	
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{width:100%%;line-height:160%%;font-size:12px}.q{border:1px solid #4a4945}.b{background:#2a2a2a}</STYLE><table cellpadding=2 cellspacing=0 border=0>");
	len += format(buffer[len], 2367-len, "<tr  align=center bgcolor=#52697B><th width=5%%> # <th width=34%% align=left> Name <th width=10%%> Distance <th  width=10%%> MaxSpeed <th  width=11%%> PreStrafe <th  width=9%%> Strafes <th  width=6%%> Sync");
		
	for( i = INFO_ZERO; i < NSHOW; i++ )
		{		
			if( dropsbj_dist[i] == 0)
			{
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), "-", "-", "-", "-", "-", "-");
				i=NSHOW;
			}
			else
			{
				name = dropsbj_names[i];
				while( containi(name, "<") != -1 )
					replace(name, 129, "<", "&lt;");
				while( containi(name, ">") != -1 )
					replace(name, 129, ">", "&gt;");
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %d.%01d <td> %d.%01d <td> %d.%01d <td> %d <td> %d", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), name, (dropsbj_dist[i]/1000000), (dropsbj_dist[i]%1000000/100000), (dropsbj_maxsped[i]/1000000), (dropsbj_maxsped[i]%1000000/100000), (dropsbj_prestr[i]/1000000), (dropsbj_prestr[i]%1000000/100000), dropsbj_streif[i],dropsbj_syncc[i] );
		
			}
		}
	len += format(buffer[len], 2367-len, "</table></body>");
	static strin[20];
	format(strin,19, "Top %d SCJ's", NSHOW);
	show_motd(id, buffer, strin);
}
public show_topcj(id)
{	
	static buffer[2368], name[131], len, i;
	
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{width:100%%;line-height:160%%;font-size:12px}.q{border:1px solid #4a4945}.b{background:#2a2a2a}</STYLE><table cellpadding=2 cellspacing=0 border=0>");
	len += format(buffer[len], 2367-len, "<tr  align=center bgcolor=#52697B><th width=5%%> # <th width=34%% align=left> Name <th width=10%%> Distance <th  width=10%%> MaxSpeed <th  width=11%%> PreStrafe <th  width=9%%> Strafes <th  width=6%%> Sync");
		
	for( i = INFO_ZERO; i < NSHOW; i++ )
		{		
			if( cj_dist[i] == 0)
			{
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), "-", "-", "-", "-", "-", "-");
				i=NSHOW;
			}
			else
			{
				name = cj_names[i];
				while( containi(name, "<") != -1 )
					replace(name, 129, "<", "&lt;");
				while( containi(name, ">") != -1 )
					replace(name, 129, ">", "&gt;");
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %d.%01d <td> %d.%01d <td> %d.%01d <td> %d <td> %d", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), name, (cj_dist[i]/1000000), (cj_dist[i]%1000000/100000), (cj_maxsped[i]/1000000), (cj_maxsped[i]%1000000/100000), (cj_prestr[i]/1000000), (cj_prestr[i]%1000000/100000), cj_streif[i],cj_syncc[i] );
		
			}
		}
	len += format(buffer[len], 2367-len, "</table></body>");
	static strin[20];
	format(strin,19, "Top %d CJ's", NSHOW);
	show_motd(id, buffer, strin);
}
public show_topwj(id)
{	
	static buffer[2368], name[131], len, i;
	
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{width:100%%;line-height:160%%;font-size:12px}.q{border:1px solid #4a4945}.b{background:#2a2a2a}</STYLE><table cellpadding=2 cellspacing=0 border=0>");
	len += format(buffer[len], 2367-len, "<tr  align=center bgcolor=#52697B><th width=5%%> # <th width=34%% align=left> Name <th width=10%%> Distance <th  width=10%%> MaxSpeed <th  width=11%%> PreStrafe <th  width=9%%> Strafes <th  width=6%%> Sync");
		
	for( i = INFO_ZERO; i < NSHOW; i++ )
		{		
			if( wj_dist[i] == 0)
			{
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), "-", "-", "-", "-", "-", "-");
				i=NSHOW;
			}
			else
			{
				name = wj_names[i];
				while( containi(name, "<") != -1 )
					replace(name, 129, "<", "&lt;");
				while( containi(name, ">") != -1 )
					replace(name, 129, ">", "&gt;");
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %d.%01d <td> %d.%01d <td> %d.%01d <td> %d <td> %d", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), name, (wj_dist[i]/1000000), (wj_dist[i]%1000000/100000), (wj_maxsped[i]/1000000), (wj_maxsped[i]%1000000/100000), (wj_prestr[i]/1000000), (wj_prestr[i]%1000000/100000), wj_streif[i],wj_syncc[i] );
		
			}
		}
	len += format(buffer[len], 2367-len, "</table></body>");
	static strin[20];
	format(strin,19, "Top %d WJ's", NSHOW);
	show_motd(id, buffer, strin);
}
public show_topbj(id)
{	
	static buffer[2368], name[131], len, i;
	
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{width:100%%;line-height:160%%;font-size:12px}.q{border:1px solid #4a4945}.b{background:#2a2a2a}</STYLE><table cellpadding=2 cellspacing=0 border=0>");
	len += format(buffer[len], 2367-len, "<tr  align=center bgcolor=#52697B><th width=5%%> # <th width=34%% align=left> Name <th width=10%%> Distance <th  width=10%%> MaxSpeed <th  width=11%%> PreStrafe <th  width=9%%> Strafes <th  width=6%%> Sync");
		
	for( i = INFO_ZERO; i < NSHOW; i++ )
		{		
			if( bj_dist[i] == 0)
			{
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), "-", "-", "-", "-", "-", "-");
				i=NSHOW;
			}
			else
			{
				name = bj_names[i];
				while( containi(name, "<") != -1 )
					replace(name, 129, "<", "&lt;");
				while( containi(name, ">") != -1 )
					replace(name, 129, ">", "&gt;");
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %d.%01d <td> %d.%01d <td> %d.%01d <td> %d <td> %d", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), name, (bj_dist[i]/1000000), (bj_dist[i]%1000000/100000), (bj_maxsped[i]/1000000), (bj_maxsped[i]%1000000/100000), (bj_prestr[i]/1000000), (bj_prestr[i]%1000000/100000), bj_streif[i],bj_syncc[i] );
		
			}
		}
	len += format(buffer[len], 2367-len, "</table></body>");
	static strin[20];
	format(strin,19, "Top %d BJ's", NSHOW);
	show_motd(id, buffer, strin);
}
public show_topsbj(id)
{	
	static buffer[2368], name[131], len, i;
	
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{width:100%%;line-height:160%%;font-size:12px}.q{border:1px solid #4a4945}.b{background:#2a2a2a}</STYLE><table cellpadding=2 cellspacing=0 border=0>");
	len += format(buffer[len], 2367-len, "<tr  align=center bgcolor=#52697B><th width=5%%> # <th width=34%% align=left> Name <th width=10%%> Distance <th  width=10%%> MaxSpeed <th  width=11%%> PreStrafe <th  width=9%%> Strafes <th  width=6%%> Sync");
		
	for( i = INFO_ZERO; i < NSHOW; i++ )
		{		
			if( sbj_dist[i] == 0)
			{
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), "-", "-", "-", "-", "-", "-");
				i=NSHOW;
			}
			else
			{
				name = sbj_names[i];
				while( containi(name, "<") != -1 )
					replace(name, 129, "<", "&lt;");
				while( containi(name, ">") != -1 )
					replace(name, 129, ">", "&gt;");
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %d.%01d <td> %d.%01d <td> %d.%01d <td> %d <td> %d", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), name, (sbj_dist[i]/1000000), (sbj_dist[i]%1000000/100000), (sbj_maxsped[i]/1000000), (sbj_maxsped[i]%1000000/100000), (sbj_prestr[i]/1000000), (sbj_prestr[i]%1000000/100000), sbj_streif[i],sbj_syncc[i] );
		
			}
		}
	len += format(buffer[len], 2367-len, "</table></body>");
	static strin[20];
	format(strin,19, "Top %d StandUp BJ's", NSHOW);
	show_motd(id, buffer, strin);
}
public show_topladder(id)
{	
	static buffer[2368], name[131], len, i;
	
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{width:100%%;line-height:160%%;font-size:12px}.q{border:1px solid #4a4945}.b{background:#2a2a2a}</STYLE><table cellpadding=2 cellspacing=0 border=0>");
	len += format(buffer[len], 2367-len, "<tr  align=center bgcolor=#52697B><th width=5%%> # <th width=34%% align=left> Name <th width=10%%> Distance <th  width=10%%> MaxSpeed <th  width=11%%> PreStrafe <th  width=9%%> Strafes <th  width=6%%> Sync");
		
	for( i = INFO_ZERO; i < NSHOW; i++ )
		{		
			if( ladder_dist[i] == 0)
			{
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), "-", "-", "-", "-", "-", "-");
				i=NSHOW;
			}
			else
			{
				name = ladder_names[i];
				while( containi(name, "<") != -1 )
					replace(name, 129, "<", "&lt;");
				while( containi(name, ">") != -1 )
					replace(name, 129, ">", "&gt;");
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %d.%01d <td> %d.%01d <td> %d.%01d <td> %d <td> %d", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), name, (ladder_dist[i]/1000000), (ladder_dist[i]%1000000/100000), (ladder_maxsped[i]/1000000), (ladder_maxsped[i]%1000000/100000), (ladder_prestr[i]/1000000), (ladder_prestr[i]%1000000/100000), ladder_streif[i],ladder_syncc[i] );
		
			}
		}
	len += format(buffer[len], 2367-len, "</table></body>");
	static strin[20];
	format(strin,19, "Top %d Ladder Jumps", NSHOW);
	show_motd(id, buffer, strin);
}
public show_topdropcj(id)
{	
	static buffer[2368], name[131], len, i;
	
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{width:100%%;line-height:160%%;font-size:12px}.q{border:1px solid #4a4945}.b{background:#2a2a2a}</STYLE><table cellpadding=2 cellspacing=0 border=0>");
	len += format(buffer[len], 2367-len, "<tr  align=center bgcolor=#52697B><th width=5%%> # <th width=34%% align=left> Name <th width=10%%> Distance <th  width=10%%> MaxSpeed <th  width=11%%> PreStrafe <th  width=9%%> Strafes <th  width=6%%> Sync");
		
	for( i = INFO_ZERO; i < NSHOW; i++ )
		{		
			if( dropcj_dist[i] == 0)
			{
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), "-", "-", "-", "-", "-", "-");
				i=NSHOW;
			}
			else
			{
				name = dropcj_names[i];
				while( containi(name, "<") != -1 )
					replace(name, 129, "<", "&lt;");
				while( containi(name, ">") != -1 )
					replace(name, 129, ">", "&gt;");
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %d.%01d <td> %d.%01d <td> %d.%01d <td> %d <td> %d", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), name, (dropcj_dist[i]/1000000), (dropcj_dist[i]%1000000/100000), (dropcj_maxsped[i]/1000000), (dropcj_maxsped[i]%1000000/100000), (dropcj_prestr[i]/1000000), (dropcj_prestr[i]%1000000/100000), dropcj_streif[i],dropcj_syncc[i] );
		
			}
		}
	len += format(buffer[len], 2367-len, "</table></body>");
	static strin[20];
	format(strin,19, "Top %d Drop CJ's", NSHOW);
	show_motd(id, buffer, strin);
}
public show_topdropbj(id)
{	
	static buffer[2368], name[131], len, i;
	
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{width:100%%;line-height:160%%;font-size:12px}.q{border:1px solid #4a4945}.b{background:#2a2a2a}</STYLE><table cellpadding=2 cellspacing=0 border=0>");
	len += format(buffer[len], 2367-len, "<tr  align=center bgcolor=#52697B><th width=5%%> # <th width=34%% align=left> Name <th width=10%%> Distance <th  width=10%%> MaxSpeed <th  width=11%%> PreStrafe <th  width=9%%> Strafes <th  width=6%%> Sync");
		
	for( i = INFO_ZERO; i < NSHOW; i++ )
		{		
			if( dropbj_dist[i] == 0)
			{
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), "-", "-", "-", "-", "-", "-");
				i=NSHOW;
			}
			else
			{
				name = dropbj_names[i];
				while( containi(name, "<") != -1 )
					replace(name, 129, "<", "&lt;");
				while( containi(name, ">") != -1 )
					replace(name, 129, ">", "&gt;");
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %d.%01d <td> %d.%01d <td> %d.%01d <td> %d <td> %d", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), name, (dropbj_dist[i]/1000000), (dropbj_dist[i]%1000000/100000), (dropbj_maxsped[i]/1000000), (dropbj_maxsped[i]%1000000/100000), (dropbj_prestr[i]/1000000), (dropbj_prestr[i]%1000000/100000), dropbj_streif[i],dropbj_syncc[i] );
		
			}
		}
	len += format(buffer[len], 2367-len, "</table></body>");
	static strin[20];
	format(strin,19, "Top %d Drop BJ's", NSHOW);
	show_motd(id, buffer, strin);
}
public show_topldbhop(id)
{	
	static buffer[2368], name[131], len, i;
	
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{width:100%%;line-height:160%%;font-size:12px}.q{border:1px solid #4a4945}.b{background:#2a2a2a}</STYLE><table cellpadding=2 cellspacing=0 border=0>");
	len += format(buffer[len], 2367-len, "<tr  align=center bgcolor=#52697B><th width=5%%> # <th width=34%% align=left> Name <th width=10%%> Distance <th  width=10%%> MaxSpeed <th  width=11%%> PreStrafe <th  width=9%%> Strafes <th  width=6%%> Sync");
		
	for( i = INFO_ZERO; i < NSHOW; i++ )
		{		
			if( ldbhop_dist[i] == 0)
			{
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), "-", "-", "-", "-", "-", "-");
				i=NSHOW;
			}
			else
			{
				name = ldbhop_names[i];
				while( containi(name, "<") != -1 )
					replace(name, 129, "<", "&lt;");
				while( containi(name, ">") != -1 )
					replace(name, 129, ">", "&gt;");
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %d.%01d <td> %d.%01d <td> %d.%01d <td> %d <td> %d", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), name, (ldbhop_dist[i]/1000000), (ldbhop_dist[i]%1000000/100000), (ldbhop_maxsped[i]/1000000), (ldbhop_maxsped[i]%1000000/100000), (ldbhop_prestr[i]/1000000), (ldbhop_prestr[i]%1000000/100000), ldbhop_streif[i],ldbhop_syncc[i] );
		
			}
		}
	len += format(buffer[len], 2367-len, "</table></body>");
	static strin[20];
	format(strin,19, "Top %d Ladder BJ's", NSHOW);
	show_motd(id, buffer, strin);
}
public show_topmap(id)
{	
	static buffer[2368], name[131], len, i;
	
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{width:100%%;font-size:12px}</STYLE><table cellpadding=2 cellspacing=0 border=0>");
	len += format(buffer[len], 2367-len, "<tr  align=center bgcolor=#52697B><th width=5%%> # <th width=34%% align=left> Name <th width=10%%> Distance <th  width=10%%> MaxSpeed <th  width=11%%> PreStrafe <th  width=9%%> Strafes <th  width=6%%> Sync <th  width=10%%> Type");
		
	for( i = INFO_ZERO; i < NSHOW; i++ )
		{		
			if( map_dist[i] == 0)
			{
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), "-", "-", "-", "-", "-", "-", "-");
				i=NSHOW;
			}
			else
			{
				name = map_names[i];
				while( containi(name, "<") != -1 )
					replace(name, 129, "<", "&lt;");
				while( containi(name, ">") != -1 )
					replace(name, 129, ">", "&gt;");
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %d.%01d <td> %d.%01d <td> %d.%01d <td> %d <td> %d <td> %s", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), name, (map_dist[i]/1000000), (map_dist[i]%1000000/100000), (map_maxsped[i]/1000000), (map_maxsped[i]%1000000/100000), (map_prestr[i]/1000000), (map_prestr[i]%1000000/100000), map_streif[i],map_syncc[i],map_type[i]);
		
			}
		}
	len += format(buffer[len], 2367-len, "</table></body>");
	static strin[20];
	format(strin,19, "Top %d Map", NSHOW);
	show_motd(id, buffer, strin);
}
//mcj top
public show_topmcj(id)
{	
	static buffer[2368], name[131], len, i;
	
	len = format(buffer[len], 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{width:100%%;font-size:12px}</STYLE><table cellpadding=2 cellspacing=0 border=0>");
	len += format(buffer[len], 2367-len, "<tr  align=center bgcolor=#52697B><th width=5%%> # <th width=34%% align=left> Name <th width=10%%> Distance <th  width=10%%> MaxSpeed <th  width=11%%> PreStrafe <th  width=9%%> Strafes <th  width=6%%> Sync <th  width=6%%> Ducks");

		
	for( i = INFO_ZERO; i < NSHOW; i++ )
		{		
			if( mcj_dist[i] == 0)
			{
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), "-", "-", "-", "-", "-", "-","-");
				i=NSHOW;
			}
			else
			{
				name = mcj_names[i];
				while( containi(name, "<") != -1 )
					replace(name, 129, "<", "&lt;");
				while( containi(name, ">") != -1 )
					replace(name, 129, ">", "&gt;");
				len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %d.%01d <td> %d.%01d <td> %d.%01d <td> %d <td> %d <td> %d", ((i%2)==0) ? "" : " bgcolor=#2f3030", (i+1), name, (mcj_dist[i]/1000000), (mcj_dist[i]%1000000/100000), (mcj_maxsped[i]/1000000), (mcj_maxsped[i]%1000000/100000), (mcj_prestr[i]/1000000), (mcj_prestr[i]%1000000/100000), mcj_streif[i],mcj_syncc[i],mcj_ducks[i] );
		
			}
		}
	len += format(buffer[len], 2367-len, "</table></body>");
	static strin[20];
	format(strin,19, "Top %d Multi CJ's", NSHOW);
	show_motd(id, buffer, strin);
}

public fwdPlayerPostThink( id ) 
{
	if( is_user_alive(id) )
	{
		if( g_Jumped[id] ) {
		
		
		
		static buttonsNew;
		static Float:angle[3];
		
		//flags = pev(id, pev_flags);
		buttonsNew = pev(id, pev_button);
		buttons = pev(id, pev_button);
		pev(id, pev_angles, angle);
		pev(id, pev_velocity, velocity);
		velocity[2] = 0.0;
		
		fSpeed = vector_length(velocity);
		
		
		if( old_angle1[id] > angle[1] ) {
			turning_left[id] = false;
			turning_right[id] = true;
		}
		else if( old_angle1[id] < angle[1] ) {
			turning_left[id] = true;
			turning_right[id] = false;
		} else {
			turning_left[id] = false;
			turning_right[id] = false;
		}
		//schetchik streifof
		if( !(strafecounter_oldbuttons[id]&IN_MOVELEFT) && buttonsNew&IN_MOVELEFT
		&& !(buttonsNew&IN_MOVERIGHT) && !(buttonsNew&IN_BACK) && !(buttonsNew&IN_FORWARD)
		&& (turning_left[id] || turning_right[id]) )
		{
			//pre_type1[id] = "forward";
			if(strafe_num[id] < NSTRAFES)
				strafe_stat_time[id][strafe_num[id]] = get_gametime();
			strafe_num[id] += INFO_ONE;
		}
		else if( !(strafecounter_oldbuttons[id]&IN_MOVERIGHT) && buttonsNew&IN_MOVERIGHT
		&& !(buttonsNew&IN_MOVELEFT) && !(buttonsNew&IN_BACK) && !(buttonsNew&IN_FORWARD)
		&& (turning_left[id] || turning_right[id]) )
		{
			//pre_type1[id] = "forward";
			if(strafe_num[id] < NSTRAFES)
				strafe_stat_time[id][strafe_num[id]] = get_gametime();
			strafe_num[id] += INFO_ONE;
		}
		else if( !(strafecounter_oldbuttons[id]&IN_BACK) && buttonsNew&IN_BACK
		&& !(buttonsNew&IN_MOVELEFT) && !(buttonsNew&IN_MOVERIGHT) && !(buttonsNew&IN_FORWARD)
		&& (turning_left[id] || turning_right[id]) )
		{
			
			if(!equal(pre_type[id],"[Backwards]") && equal(pre_type1[id],"forward"))
			{
				pre_type[id] = "[Sideways]";
			}
			
			if(strafe_num[id] < NSTRAFES)
				strafe_stat_time[id][strafe_num[id]] = get_gametime();
			strafe_num[id] += INFO_ONE;
		}
		else if( !(strafecounter_oldbuttons[id]&IN_FORWARD) && buttonsNew&IN_FORWARD
		&& !(buttonsNew&IN_MOVELEFT) && !(buttonsNew&IN_MOVERIGHT) && !(buttonsNew&IN_BACK)
		&& (turning_left[id] || turning_right[id]) )
		{
			najalw++;
			
			if(!equal(pre_type[id],"[Backwards]") && equal(pre_type1[id],"forward") && najalw>2)
			{
				pre_type[id] = "[Sideways]";
			}
			
			
			if(strafe_num[id] < NSTRAFES)
				strafe_stat_time[id][strafe_num[id]] = get_gametime();
			strafe_num[id] += INFO_ONE;
		}
		
		if( buttonsNew&IN_MOVERIGHT
		|| buttonsNew&IN_MOVELEFT
		|| buttonsNew&IN_FORWARD
		|| buttonsNew&IN_BACK )
		{	
			//tskFps(id);
			if(strafe_num[id] < NSTRAFES)
			{
				if( fSpeed > speed)
					strafe_stat_sync[id][strafe_num[id]][0] += INFO_ONE;
				else
					strafe_stat_sync[id][strafe_num[id]][1] += INFO_ONE;
			}
			
		}
		if( buttons&IN_MOVERIGHT && (buttons&IN_MOVELEFT || buttons&IN_FORWARD || buttons&IN_BACK) )
			strafecounter_oldbuttons[id] = INFO_ZERO;
		else if( buttons&IN_MOVELEFT && (buttons&IN_FORWARD || buttons&IN_BACK || buttons&IN_MOVERIGHT) )
			strafecounter_oldbuttons[id] = INFO_ZERO;
		else if( buttons&IN_FORWARD && (buttons&IN_BACK || buttons&IN_MOVERIGHT || buttons&IN_MOVELEFT) )
			strafecounter_oldbuttons[id] = INFO_ZERO;
		else if( buttons&IN_BACK && (buttons&IN_MOVERIGHT || buttons&IN_MOVELEFT || buttons&IN_FORWARD) )
			strafecounter_oldbuttons[id] = INFO_ZERO;
		else if( turning_left[id] || turning_right[id] )
			strafecounter_oldbuttons[id] = buttons;
		}
		static flags;
		flags = pev(id, pev_flags);
		if((buttons&IN_RIGHT || buttons&IN_LEFT) && !(flags&FL_ONGROUND))
		{
			for(new i = INFO_ONE; i < 33; i++ )
			{
				if( (i == id || is_user_spectating_player(i, id)))
				{
				client_print(i,print_center,"Script or you use left(right) key");
				g_reset[id]=true;
				//ColorChat(id, GREEN, "reset18");
				
				}
			}
		}
	}
}

public fnSaveBeamPos( client ) {
	if( g_Jumped[client] ) {
		new Float:vOrigin[3];
		pev(client, pev_origin, vOrigin);
		
		if( gBeam_count[client] < 100 ) {
			gBeam_points[client][gBeam_count[client]][0] = vOrigin[0];
			gBeam_points[client][gBeam_count[client]][1] = vOrigin[1];
			gBeam_points[client][gBeam_count[client]][2] = vOrigin[2];
			
			if(is_user_ducking( client ))
				gBeam_duck[client][gBeam_count[client]] = true;
			
			gBeam_count[client]++;
		}
	}
}


public JumpReset(id)
{
	g_reset[id] = true;
	//ColorChat(id,GREEN,"jump reset");
	//resetJump[id] = true;
	
}
public ddReset(id)
{
	id=id-2311;
	g_reset[id] = true;
	//ColorChat(id,GREEN,"jump reset %d",lll++);
	//resetJump[id] = true;
	
}

public resethook(id)
{

	donehook[id]=true;
	groundslide[id]=0.0;
	waits[id]=0;
	slidim[id]=false;
	taskslide[id]=0;
	failslide[id]=false;
}


public cmdColorChat(id)
{	
	get_pcvar_string(kz_prefix, prefix, 63);
	if( !gHasColorChat[id] )
	{
		gHasColorChat[id] = true;
		ColorChat(id, GREEN, "^x04[%s]^x01 ColorChat enabled. To disable, type /colorchat.", prefix);
	}
	else 
	{
		gHasColorChat[id] = false;
		ColorChat(id, GREEN, "^x04[%s]^x01 ColorChat disabled. To enable, type /colorchat.", prefix);
	}
	
	return PLUGIN_CONTINUE;
}
public cmdljStats( id ) {
	
	get_pcvar_string(kz_prefix, prefix, 63);
	if(g_lj_stats[id]==true) 
	{
	ColorChat(id, RED, "^x04[%s]^x01 Stats:^x03 disabled",prefix);
	g_lj_stats[id]=false;
	}
	else 
	{
	g_lj_stats[id]=true;
	ColorChat(id, BLUE, "^x04[%s]^x01 Stats:^x03 enabled",prefix);
	}
	
}


public cmdVersion( id ) {
	get_pcvar_string(kz_prefix, prefix, 63);		
	ColorChat(id, GREY, "^x01[%s]^x04 Plugin:^x01 Jump Stats^x04 by^x03 [kzuq]BorJomi ^x04Version:^x01 1.64",prefix);
	ColorChat(id, BLUE, "^x01[%s]^x04 Visit^x03 http://unique-kz.com",prefix);
}
public pre_stats(id)
{	
	get_pcvar_string(kz_prefix, prefix, 63);
	if(kz_stats_pre[id]==true) 
	{
		ColorChat(id, RED, "^x04[%s]^x01 Prestreif stats:^x03 disabled",prefix);
		kz_stats_pre[id]=false;
	}
	else 
	{
		kz_stats_pre[id]=true;
		ColorChat(id, BLUE, "^x04[%s]^x01 Prestreif stats:^x03 enabled",prefix);
	}
}
public streif_stats(id)
{	
	get_pcvar_string(kz_prefix, prefix, 63);
	if(streifstat[id]==true) 
	{
		ColorChat(id, RED, "^x04[%s]^x01 Strafe's stats:^x03 disabled",prefix);
		streifstat[id]=false;
	}
	else 
	{
		streifstat[id]=true;
		ColorChat(id, BLUE, "^x04[%s]^x01 Strafe's stats:^x03 enabled",prefix);
	}
}
public cmdljbeam(id)
{
	get_pcvar_string(kz_prefix, prefix, 63);
	if(kz_beam[id]==true) 
	{
		ColorChat(id, RED, "^x04[%s]^x01 Beam:^x03 disabled",prefix);
		kz_beam[id]=false;
	}
	else 
	{
		kz_beam[id]=true;
		ColorChat(id, BLUE, "^x04[%s]^x01 Beam:^x03 enabled",prefix);
	}
}
public show_pre(id)
{
	get_pcvar_string(kz_prefix, prefix, 63);
	if(showpre[id]==true) 
	{
		ColorChat(id, RED, "^x04[%s]^x01 ShowPre:^x03 disabled",prefix);
		showpre[id]=false;
	}
	else 
	{
		showpre[id]=true;
		ColorChat(id, BLUE, "^x04[%s]^x01 ShowPre:^x03 enabled",prefix);
	}
}
public show_speed(id)
{
	get_pcvar_string(kz_prefix, prefix, 63);
	if(speedon[id]==false) 
	{
		ColorChat(id, BLUE, "^x04[%s]^x01 Speed:^x03 enabled",prefix);
		speedon[id]=true;
		
	}
	else 
	{
		speedon[id]=false;
		
		ColorChat(id, RED, "^x04[%s]^x01 Speed:^x03 disabled",prefix);
	
	}
}
public show_early(id)
{
	get_pcvar_string(kz_prefix, prefix, 63);
	if(failearly[id]==false) 
	{
	ColorChat(id, BLUE, "^x04[%s]^x01 Bhop fail warn:^x03 enabled",prefix);
	failearly[id]=true;
	}
	else 
	{
	failearly[id]=false;
	ColorChat(id, RED, "^x04[%s]^x01 Bhop fail warn:^x03 disabled",prefix);
	
	}
}
public multi_bhop(id)
{
	get_pcvar_string(kz_prefix, prefix, 63);
	if(multibhoppre[id]==false) 
	{
	ColorChat(id, BLUE, "^x04[%s]^x01 Multi Bhop Prestrafe:^x03 enabled",prefix);
	multibhoppre[id]=true;
	}
	else 
	{
	multibhoppre[id]=false;
	ColorChat(id, RED, "^x04[%s]^x01 Multi Bhop Prestrafe:^x03 disabled",prefix);
	
	}
}
public duck_show(id)
{
	get_pcvar_string(kz_prefix, prefix, 63);
	if(showduck[id]==false) 
	{
	ColorChat(id, BLUE, "^x04[%s]^x01 Ducks Prestrafe:^x03 enabled",prefix);
	showduck[id]=true;
	}
	else 
	{
	showduck[id]=false;
	ColorChat(id, RED, "^x04[%s]^x01 Ducks Prestrafe:^x03 disabled",prefix);
	
	}
}
public lj_show(id)
{
	get_pcvar_string(kz_prefix, prefix, 63);
	if(ljpre[id]==false) 
	{
	ColorChat(id, BLUE, "^x04[%s]^x01 LJ Prestrafe:^x03 enabled",prefix);
	ljpre[id]=true;
	}
	else 
	{
	ljpre[id]=false;
	ColorChat(id, RED, "^x04[%s]^x01 LJ Prestrafe:^x03 disabled",prefix);
	
	}
}

public client_connect( id )
{
	
	
	
	
	static connectt[10];
	get_pcvar_string(kz_uq_connect, connectt, 9);
	format(connectt, 9, "_%s", connectt);

	if( contain(connectt, "a") > 0 )
		gHasColorChat[id] =true;
	else
		gHasColorChat[id] = false;
	if( contain(connectt, "b") > 0 )
		g_lj_stats[id] = true;
	else
		g_lj_stats[id] = false;
	if( contain(connectt, "c") > 0 )
	{
		speedon[id]=true;
	}
	else
		speedon[id]=false;
	if( contain(connectt, "d") > 0 )
		showpre[id]=true;
	else
		showpre[id]=false;
	if( contain(connectt, "e") > 0 )
		streifstat[id]=true;
	else
		streifstat[id]=false;
	if( contain(connectt, "f") > 0 )
		kz_beam[id]=true;
	else
		kz_beam[id]=false;
	if( contain(connectt, "g") > 0 )
		kz_stats_pre[id]=true;
	else
		kz_stats_pre[id]=false;
	if( contain(connectt, "h") > 0 )
		failearly[id]=true;
	else
		failearly[id]=false;
	if( contain(connectt, "i") > 0 )
		multibhoppre[id]=true;
	else
		multibhoppre[id]=false;
	if( contain(connectt, "j") > 0 )
		showduck[id]=true;
	else
		showduck[id]=false;
	if( contain(connectt, "k") > 0 )
		ljpre[id]=true;
	else
		ljpre[id]=false;
	
	edgeshow[id]=true;	
	//failearly[id]=true;	
	bhopfail[id]=false;
	flajok[id]=false;
	vFallAt[id][0] = 0.0;
	vFallAt[id][1] = 0.0;
	vFallAt[id][2] = 0.0;
	OnGround[id]=false;
	serf_reset[id]=false;
	first_onground[id]=false;
	duckstring[id]=false;
	g_nc[id] = get_gametime();
	firstshow[id]=false;
		
}

public ResetHUD(id)
{
	if( is_user_alive(id) && firstshow[id]==false)
	{
		get_pcvar_string(kz_prefix, prefix, 63);
		if( get_pcvar_num( kz_airaccelerate ) )
		{
			ColorChat(id, RED, "^x01[%s]^x01 Server runs:^x03 100aa.^x01 Type /ljtop to show Tops Menu. Type /ljsmenu to show Options Menu",prefix);
		}
		else 
		{
			ColorChat(id, BLUE, "^x01[%s]^x01 Server runs:^x03 10aa.^x01^x01 Type /ljtop to show Tops Menu. Type /ljsmenu to show Options Menu ",prefix);		
		}
		firstshow[id]=true;
		
		if(equal(mapname,"slide_gs_longjumps") || equal(mapname,"b2j_slide_longjumps"))
		{
			ColorChat(id, RED, "^x01[%s]^x03 Slide stats:^x04 Enable",prefix);
		}
	}
	
	if( is_user_alive(id))
	{
		
		set_task(1.0, "tskFps", id+434490, "", 0, "b", 0);
	
		
	}
	

}
public client_disconnect(id)
{
	OnGround[id]=false;//remove_task(id);
	if( task_exists(id, 0) )
	remove_task(id);
	
	if( task_exists(id+434490, 0) )
		remove_task(id+434490, 0);
}
is_user_spectating_player(spectator, player)
{
	if( !pev_valid(spectator) || !pev_valid(player) )
		return 0;
	if( !is_user_connected(spectator) || !is_user_connected(player) )
		return 0;
	if( is_user_alive(spectator) || !is_user_alive(player) )
		return 0;
	if( pev(spectator, pev_deadflag) != 2 )
		return 0;
	
	static specmode;
	specmode = pev(spectator, pev_iuser1);
	if( !(specmode == 1 || specmode == 2 || specmode == 4) )
		return 0;
	
	if( pev(spectator, pev_iuser2) == player )
		return 1;
	
	return 0;
}



//Float:get_speed1( Float:velocity[3] )
//	return floatsqroot( floatpower( velocity[0], 2.0 ) + floatpower( velocity[1], 2.0 ) );
//stock bool:IsUserOnGround(client)
//{
	
	//exolent's anti surf
//	return !!(pev(client, pev_flags) & FL_ONGROUND2);
	
//}
bool:is_user_ducking( id ) {
	if( !pev_valid( id )  )
		return false;
	
	new Float:abs_min[3], Float:abs_max[3];
	
	pev( id, pev_absmin, abs_min );
	pev( id, pev_absmax, abs_max );
	
	abs_min[2] += 64.0;
	
	if( abs_min[2] < abs_max[2] )
		return false;
	
	return true;
}
public reset_tops(id)
{	client_print(id,print_console,"[uq_JumpStats] Tops reseted!!!");
	new profile[128];
	
	formatex(profile, 127, "%s/Top10_lj.dat", ljsDir);
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	
	
	
	formatex(profile, 127, "%s/Top10_cj.dat", ljsDir);
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	
	formatex(profile, 127, "%s/Top10_bj.dat", ljsDir);
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	
	formatex(profile, 127, "%s/Top10_sbj.dat", ljsDir);
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	
	formatex(profile, 127, "%s/Top10_wj.dat", ljsDir);
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	
	formatex(profile, 127, "%s/Top10_dropbj.dat", ljsDir);
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	
	formatex(profile, 127, "%s/Top10_scj.dat", ljsDir);
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	
	formatex(profile, 127, "%s/Top10_dropcj.dat", ljsDir);
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	
	formatex(profile, 127, "%s/Top10_ladder.dat", ljsDir);
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	
	formatex(profile, 127, "%s/Top10_ldbhop.dat", ljsDir);
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	
	formatex(profile, 127, "%s/Top10_mcj.dat", ljsDir);
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	
	formatex(profile, 127, "%s/Top10_dcj.dat", ljsDir);
	if( file_exists(profile) )
	{
		delete_file(profile);
	}
	
	read_topdcj();
	read_topmcj();
	read_topcj();
	read_toplj();
	read_topdropsbj();
	read_topwj();
	read_topbj();
	read_topsbj();
	read_topldbhop();
	read_topladder();
	read_topdropcj();
	read_topdropbj();
}

public uqTopmenu1(id)
{
	get_pcvar_string(kz_prefix, prefix, 63);
	if(get_pcvar_num(kz_uq_top)==1)
	{
		read_topdcj(); //if you erase or write *.dat (no need restat map)
		read_topmcj();
		read_topcj();
		read_toplj();
		read_topdropsbj();
		read_topwj();
		read_topbj();
		read_topsbj();
		read_topldbhop();
		read_topladder();
		read_topdropcj();
		read_topdropbj();
			
			
		new MenuBody[512], len, keys;
		len = format(MenuBody, 511, "\yStats Top Menu 1/2^n");
		if(get_pcvar_num(kz_uq_maptop)==0)
		{
			len += format(MenuBody[len], 511-len, "^n\r1. \dMap Top disable by server");
		}
		else if(get_pcvar_num(kz_uq_maptop)==1 && map_dist[0]!=0)
		{
			len += format(MenuBody[len], 511-len, "^n\r1. \wMap Top");
			keys = (1<<0);
		}
		else len += format(MenuBody[len], 511-len, "^n\r1. \dMap Top(no jumps)");
			
		if(get_pcvar_num(kz_uq_lj)==1)
		{
			if(lj_dist[0]!=0)
			{
				len += format(MenuBody[len], 511-len, "^n\r2. \wLongJump Top");
				keys |= (1<<1);
			}
			else len += format(MenuBody[len], 511-len, "^n\r2. \dLongJump Top(no jumps)");
		}
		else len += format(MenuBody[len], 511-len, "^n\r2. \dLongJump Top disable by server");
		
		if(get_pcvar_num(kz_uq_cj)==1)
		{
			if(cj_dist[0]!=0)
			{
				len += format(MenuBody[len], 511-len, "^n\r3. \wCountJump Top");
				keys |= (1<<2);
			}
			else len += format(MenuBody[len], 511-len, "^n\r3. \dCountJump Top(no jumps)");
		}
		else len += format(MenuBody[len], 511-len, "^n\r3. \dCountJump Top disable by server");
		
		if(get_pcvar_num(kz_uq_dcj)==1)
		{
			if(dist[0]!=0)
			{
				len += format(MenuBody[len], 511-len, "^n\r4. \wDouble CountJump Top");
				keys |= (1<<3);
			}
			else len += format(MenuBody[len], 511-len, "^n\r4. \dDouble CountJump Top(no jumps)");
		}
		else len += format(MenuBody[len], 511-len, "^n\r4. \dDouble CountJump Top disable by server");
		
		if(get_pcvar_num(kz_uq_bj)==1)
		{
			if(bj_dist[0]!=0)
			{
				len += format(MenuBody[len], 511-len, "^n\r5. \wBhopJump Top");
				keys |= (1<<4);
			}
			else len += format(MenuBody[len], 511-len, "^n\r5. \dBhopJump Top(no jumps)");
		}
		else len += format(MenuBody[len], 511-len, "^n\r5. \dBhopJump Top disable by server");
		
		if(get_pcvar_num(kz_uq_sbj)==1)
		{
			if(sbj_dist[0]!=0)
			{
				len += format(MenuBody[len], 511-len, "^n\r6. \wStandUp BhopJump Top");
				keys |= (1<<5);
			}
			else len += format(MenuBody[len], 511-len, "^n\r6. \dStandUp BhopJump Top(no jumps)");
		}
		else len += format(MenuBody[len], 511-len, "^n\r6. \dStandUp BhopJump Top disable by server");
		
		if(get_pcvar_num(kz_uq_wj)==1)
		{
			if(wj_dist[0]!=0)
			{
				len += format(MenuBody[len], 511-len, "^n\r7. \wWeirdJump Top");
				keys |= (1<<6);
			}
			else len += format(MenuBody[len], 511-len, "^n\r7. \dWeirdJump Top(no jumps)");
		}
		else len += format(MenuBody[len], 511-len, "^n\r7. \dWeirdJump Top disable by server");
		
		len += format(MenuBody[len], 511-len, "^n^n\r8. \wGo to the next page");
		keys |= (1<<7);
		len += format(MenuBody[len], 511-len, "^n\r9. \wOptions Menu");
		keys |= (1<<8);
		len += format(MenuBody[len], 511-len, "^n^n\r0. \wExit");
		keys |= (1<<9);
		show_menu(id, keys, MenuBody, -1, "StatsTopMenu1");
	}
	if(get_pcvar_num(kz_uq_top)==0) ColorChat(id, RED, "^x04[%s]^x03 Top10 disable by server",prefix);		
		
}
public Option(id)
{
		
	new MenuBody[512], len, keys;
	len = format(MenuBody, 511, "\yOptions Menu ^n");
	
	if(g_lj_stats[id]==true)
	{
		len += format(MenuBody[len], 511-len, "^n\r1. \yShowStats: \wEnable");
		keys |= (1<<0);
	}
	else
	{
		keys |= (1<<0);
		len += format(MenuBody[len], 511-len, "^n\r1. \yShowStats: \dDisable");
	}
	
	if(gHasColorChat[id]==true)
	{
		len += format(MenuBody[len], 511-len, "^n\r2. \yColorchat: \wEnable");
		keys |= (1<<1);
	}
	else
	{
		keys |= (1<<1);
		len += format(MenuBody[len], 511-len, "^n\r2. \yColorchat: \dDisable");
	}
	
	if(speedon[id]==true)
	{
		len += format(MenuBody[len], 511-len, "^n\r3. \yShow speed: \wEnable");
		keys |= (1<<2);
	}
	else
	{
		keys |= (1<<2);
		len += format(MenuBody[len], 511-len, "^n\r3. \yShow speed: \dDisable");
	}
	
	if(showpre[id]==true)
	{
		len += format(MenuBody[len], 511-len, "^n\r4. \yShow prestrafe: \wEnable");
		keys |= (1<<3);
	}
	else
	{
		keys |= (1<<3);
		len += format(MenuBody[len], 511-len, "^n\r4. \yShow prestrafe: \dDisable");
	}
	
	if(streifstat[id]==true)
	{
		len += format(MenuBody[len], 511-len, "^n\r5. \yShow strafes stats: \wEnable");
		keys |= (1<<4);
	}
	else
	{
		keys |= (1<<4);
		len += format(MenuBody[len], 511-len, "^n\r5. \yShow strafes stats: \dDisable");
	}
	
	if(kz_beam[id]==true)
	{
		len += format(MenuBody[len], 511-len, "^n\r6. \yShow beam after jump: \wEnable");
		keys |= (1<<5);
	}
	else
	{
		keys |= (1<<5);
		len += format(MenuBody[len], 511-len, "^n\r6. \yShow beam after jump: \dDisable");
	}
	
	if(showduck[id]==true)
	{
		len += format(MenuBody[len], 511-len, "^n\r7. \yShow ducks Prestrafe: \wEnable");
		keys |= (1<<6);
	}
	else
	{
		keys |= (1<<6);
		len += format(MenuBody[len], 511-len, "^n\r7. \yShow ducks Prestrafe: \dDisable");
	}
	if(failearly[id]==true)
	{
		len += format(MenuBody[len], 511-len, "^n\r8. \yBhop fail warn: \wEnable");
		keys |= (1<<7);
	}
	else
	{
		keys |= (1<<7);
		len += format(MenuBody[len], 511-len, "^n\r8. \yBhop fail warn: \dDisable");
	}
	if(multibhoppre[id]==true)
	{
		len += format(MenuBody[len], 511-len, "^n\r9. \yMulti Bhop Prestrafe: \wEnable");
		keys |= (1<<8);
	}
	else
	{
		keys |= (1<<8);
		len += format(MenuBody[len], 511-len, "^n\r9. \yMulti Bhop Prestrafe: \dDisable");
	}
	//len += format(MenuBody[len], 511-len, "^n^n\r9. \wPrint Plugin info");
	//keys |= (1<<8);
	
	len += format(MenuBody[len], 511-len, "^n^n\r0. \wExit");
	keys |= (1<<9);
	
	show_menu(id, keys, MenuBody, -1, "StatsOptionMenu");
		
}
public uqTopmenu2(id)
{
	get_pcvar_string(kz_prefix, prefix, 63);
	if(get_pcvar_num(kz_uq_top)==1)
	{
		read_topdcj(); //if you erase or write *.dat (no need restat map)
		read_topmcj();
		read_topcj();
		read_toplj();
		read_topdropsbj();
		read_topwj();
		read_topbj();
		read_topsbj();
		read_topldbhop();
		read_topladder();
		read_topdropcj();
		read_topdropbj();
		
		new MenuBody[512], len, keys;
		len = format(MenuBody, 511, "\yStats Top Menu 2/2^n");
		
		if(get_pcvar_num(kz_uq_mcj)==1)
		{
			if(mcj_dist[0]!=0)
			{
				len += format(MenuBody[len], 511-len, "^n\r1. \wMulti CountJump Top");
				keys = (1<<0);
			}
			else len += format(MenuBody[len], 511-len, "^n\r1. \dMulti CountJump Top(no jumps)");		
		}
		else len += format(MenuBody[len], 511-len, "^n\r1. \dMulti CountJump Top disable by server");
		
		if(get_pcvar_num(kz_uq_drcj)==1)
		{
			if(dropcj_dist[0]!=0)
			{
				len += format(MenuBody[len], 511-len, "^n\r2. \wDrop CountJump Top");
				keys |= (1<<1);
			}
			else len += format(MenuBody[len], 511-len, "^n\r2. \dDrop CountJump Top(no jumps)");
		}
		else len += format(MenuBody[len], 511-len, "^n\r2. \dDrop CountJump Top disable by server");
		
		if(get_pcvar_num(kz_uq_drbj)==1)
		{
			if(dropbj_dist[0]!=0)
			{
				len += format(MenuBody[len], 511-len, "^n\r3. \wDrop BhopJump Top");
				keys |= (1<<2);
			}
			else len += format(MenuBody[len], 511-len, "^n\r3. \dDrop BhopJump Top(no jumps)");
		}
		else len += format(MenuBody[len], 511-len, "^n\r3. \dDrop BhopJump Top disable by server");
		
		if(get_pcvar_num(kz_uq_drsbj)==1)
		{
			if(dropsbj_dist[0]!=0)
			{
				len += format(MenuBody[len], 511-len, "^n\r4. \wStandUp CountJump Top");
				keys |= (1<<3);
			}
			else len += format(MenuBody[len], 511-len, "^n\r4. \dStandUp CountJumpTop(no jumps)");
		}
		else len += format(MenuBody[len], 511-len, "^n\r4. \dStandUp CountJump Top disable by server");
		
		if(get_pcvar_num(kz_uq_ladder)==1)
		{
			if(ladder_dist[0]!=0)
			{
				len += format(MenuBody[len], 511-len, "^n\r5. \wLadderJump Top");
				keys |= (1<<4);
			}
			else len += format(MenuBody[len], 511-len, "^n\r5. \dLadderJump Top(no jumps)");
		}
		else len += format(MenuBody[len], 511-len, "^n\r5. \dLadderJump Top disable by server");
		
		if(get_pcvar_num(kz_uq_ldbj)==1)
		{
			if(ldbhop_dist[0]!=0)
			{
				len += format(MenuBody[len], 511-len, "^n\r6. \wLadder BhopJump Top");
				keys |= (1<<5);
			}
			else len += format(MenuBody[len], 511-len, "^n\r6. \dLadder BhopJump Top(no jumps)");
		}
		else len += format(MenuBody[len], 511-len, "^n\r6. \dLadder BhopJump Top disable by server");
		
		
		len += format(MenuBody[len], 511-len, "^n^n\r7. \wBack to the first page");
		keys |= (1<<6);
		len += format(MenuBody[len], 511-len, "^n\r8. \wOptions Menu");
		keys |= (1<<7);
		len += format(MenuBody[len], 511-len, "^n^n\r9. \wPrint Plugin info");
		keys |= (1<<8);
		len += format(MenuBody[len], 511-len, "^n^n\r0. \wExit");
		keys |= (1<<9);
		show_menu(id, keys, MenuBody, -1, "StatsTopMenu2");
	}
	if(get_pcvar_num(kz_uq_top)==0) ColorChat(id, RED, "^x04[%s]^x03 Top10 disable by server",prefix);
		
}
public OptionMenu(id, key)
{
	switch((key+1))
	{
		case 1:
		{
			cmdljStats(id);
			Option(id);
			
		}
		case 2:
		{
			cmdColorChat(id);
			Option(id);
		}
		case 3:
		{
			show_speed(id);
			Option(id);
		}
		case 4:
		{
			show_pre(id);
			Option(id);
		}
		case 5:
		{
			streif_stats(id);
			Option(id);
		}
		case 6:
		{
			cmdljbeam(id);
			Option(id);
		}
		case 7:
		{
			duck_show(id);
			Option(id);
		}
		case 8:
		{
			show_early(id);
			Option(id);
		}
		case 9:
		{
			multi_bhop(id);
			Option(id);
		}

	}
	return PLUGIN_HANDLED;
}
public TopMenu1(id, key)
{
	switch((key+1))
	{
		case 1:
		{
			if(get_pcvar_num(kz_uq_maptop)==1)
			{
				show_topmap(id);
				uqTopmenu1(id);
			}
		}
		case 2:
		{
			show_toplj(id);
			uqTopmenu1(id);
		}
		case 3:
		{
			show_topcj(id);
			uqTopmenu1(id);
		}
		case 4:
		{
			show_topdcj(id);
			uqTopmenu1(id);
		}
		case 5:
		{
			show_topbj(id);
			uqTopmenu1(id);
		}
		case 6:
		{
			show_topsbj(id);
			uqTopmenu1(id);
		}

		case 7:
		{	
			show_topwj(id);
			uqTopmenu1(id);
		}

		case 8:
		{
			uqTopmenu2(id);
		}
		case 9:
		{
			Option(id);
		}
	
			

	}
	return PLUGIN_HANDLED;
}

public TopMenu2(id,key) 
{ 
	switch((key+1))
	{
	
		case 1: 
		{ 
			show_topmcj(id);
			uqTopmenu2(id);
			
		} 
		case 2: 
		{ 
			show_topdropcj(id);
			uqTopmenu2(id);
		} 
		case 3: 
		{ 
			show_topdropbj(id);
			uqTopmenu2(id);
		} 
		case 4: 
		{ 
			show_topdropsbj(id);
			uqTopmenu2(id);
		} 
		case 5: 
		{ 
			show_topladder(id);
			uqTopmenu2(id);
		} 
		case 6: 
		{ 
			show_topldbhop(id);
			uqTopmenu2(id);
		} 
		case 7: 
		{ 
			uqTopmenu1(id);
		} 
		case 8:
		{
			Option(id);
		}
		case 9:
		{
			cmdVersion(id);
			uqTopmenu2(id);
		}
	} 
	return PLUGIN_HANDLED;
}

public native_kz_get_configsdir(name[], len)
{
	param_convert(1);
	
	new lalin[64];
	get_localinfo("amxx_configsdir", lalin,63);
	
	return formatex(name, len, "%s/%s", lalin, KZ_DIR);
}
stock kz_get_configsdir(name[], len)
{
	new lalin[64];
	get_localinfo("amxx_configsdir", lalin,63);
	
	return formatex(name, len, "%s/%s", lalin, KZ_DIR);
}
