Guest User

Untitled

a guest
Nov 20th, 2010
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 206.71 KB | None | 0 0
  1. /*
  2.     .-==========================================-.
  3.     |~~ Long Jump Stats - eXtreme Modification ~~|
  4.     .-==========================================-.
  5.  
  6.     Server cvars:
  7.  
  8.     ===-
  9.  
  10.     // Enabled/Disables the plugin
  11.     // 0 = disabled
  12.     // 1 = enabled
  13.     kz_ljs_enabled "1"
  14.  
  15.     // Maximum possible lj (not 4 cj)
  16.     kz_max_lj "260.0"
  17.  
  18.     // 1337 lj (prints to all players)
  19.     // To disable, set it to -1
  20.     kz_leet_lj "250.0"
  21.  
  22.     // Professional lj (prints to all players)
  23.     // To disable, set it to -1
  24.     kz_pro_lj "245.0"
  25.  
  26.     // Good lj (prints to all players)
  27.     // To disable, set it to -1
  28.     kz_good_lj "240.0"
  29.  
  30.     // Minimal lj distance
  31.     kz_min_lj "215.0"
  32.  
  33.     // Difrence between longjump and countjump for good/pro/leet/max jump
  34.     kz_cj_dif "10.0"
  35.  
  36.     // Enables lj sounds
  37.     // 0 = disabled
  38.     // 1 = ultimate sounds
  39.     // 2 = distance in voice
  40.     kz_lj_sounds "1"
  41.  
  42.     // How dose plugin works
  43.     // 0 = no top and no colorchat
  44.     // 1 = prints good/pro/leet jumps
  45.     // 2 = enables top10
  46.     // 3 = prints good/pro/leet jumps and enables top10
  47.     kz_ljs_tops "3"
  48.  
  49.     // Do you want to save ljtop after mapchange?
  50.     kz_ljs_topsave "1"
  51.  
  52.     // How ranking will work?
  53.     // 0 = names
  54.     // 1 = steam ids
  55.     // 2 = ips
  56.     kz_ljs_rank_by "0"
  57.  
  58.     // Kz jumping color chat:
  59.     // 0 = normal
  60.     // 1 = red
  61.     // 2 = green
  62.     // 3 = blue
  63.     // 4 = silver
  64.     // 5 = team color
  65.  
  66.     kz_leet_lj_clr "1"
  67.     kz_pro_lj_clr "2"
  68.     kz_good_lj_clr "4"
  69.  
  70.     kz_leet_cj_clr "1"
  71.     kz_pro_cj_clr "2"
  72.     kz_good_cj_clr "4"
  73.  
  74.     // Colors of /ljstats (rrr ggg bbb)
  75.     kz_ljstats_red "0"
  76.     kz_ljstats_green "255"
  77.     kz_ljstats_blue "159"
  78.  
  79.     // LongJump Stats Laser Beam
  80.     // 0 = off
  81.     // 1 = normal
  82.     // 2 = uber beam
  83.     kz_ljs_beam "2"
  84.  
  85.     // Enables protection 4 legal kreedz settings
  86.     kz_legal_settings "1"
  87.  
  88.     // Is your server fast?
  89.     // 0 = slow
  90.     // 1 = normal
  91.     // 2 = realy good ( >10mb/s or localhost/lan server )
  92.     kz_ljs_fastserver "2"
  93.  
  94.     // Enables auto-setting 4 kz_ljs_fastserver cvar if it is 2
  95.     kz_ljs_autoserver "1"
  96.  
  97.     // What is enabled on client when he connects to a server?
  98.     // 0 = nothing
  99.     // a = colorchat
  100.     // b = ljstats
  101.     // c = speed
  102.     kz_ljs_connectenabler "abc"
  103.  
  104.     // Do you want cmds like /speed to be visible in the chat?
  105.     kz_ljs_viscmds "1"
  106.  
  107.     // Speedometer type
  108.     // 0 = show real speed and horizontal speed
  109.     // 1 = show real speed
  110.     // 2 = show horizontal speed
  111.     kz_ljs_speedtype "0"
  112.  
  113.     .-==========================================-.
  114.  
  115.  
  116.     Admin commands:
  117.  
  118.     ==-
  119.  
  120.     amx_resetljrec - resets ljrec and ljtop
  121.     amx_resetljtop - resets ljrec and ljtop
  122.  
  123.     .-==========================================-.
  124.  
  125.  
  126.     Client commands:
  127.  
  128.     ==-
  129.  
  130.     say /colorchat  - enables/disables colorchat
  131.     say /lj10       - display tops menu
  132.     say /ljrec      - display records menu
  133.     say /ljsmenu    - display ljs menu
  134.     say /ljstats    - enables/disables longjump stats
  135.     say /ljsversion - prints plugin version
  136.     say /speed      - enables/disables visible speed
  137.  
  138.     .-==========================================-.
  139.  
  140.  
  141.     Installation:
  142.  
  143.     ==-
  144.  
  145.     1. Extract all files and overwrite your cstrike folder
  146.     2. Add kz_ljs_xm.amxx in addons/amxmodx/configs/plugins.ini list
  147.     3. Restart your server/Change map
  148.     !!! WARNING !!!
  149.     To get better gocheck and hook protection write kz_ljs_xm.amxx
  150.     in plugins.ini BEFORE your checkpoint and hook plugins!
  151.     Good e.x. of plugins.ini
  152.     -> kz_ljs_xm.amxx
  153.     -> ProKreedz.amxx
  154.     -> ProKreedz_Hook.amxx
  155.     Bad e.x. of plugins.ini
  156.     -> ProKreedz.amxx
  157.     -> ProKreedz_Hook.amxx
  158.     -> kz_ljs_xm.amxx
  159.  
  160.     .-==========================================-.
  161.  
  162.  
  163.     Credits:
  164.  
  165.     ==-
  166.  
  167.     Created by:
  168.     Fatalis    ( 8.9.22.42:27017 )      ( http://www.KZMonkeys.net )
  169.     Numb       ( 195.149.21.176:27016 ) ( http://sensation-kreedz.net )
  170.  
  171.     Special thanks to:
  172.     Bentski    ( cs.bentski.lt:27015 )  ( http://kzlt.bentski.lt )
  173.     ~Val~      ( cs.groza.ru:27017 )    ( http://www.groza.ru )
  174.     Lt.RAT     ( cs.groza.ru:27017 )    ( http://www.groza.ru )
  175.  
  176.     Hosted by:
  177.     http://www.xtreme-jumps.eu/
  178.     http://www.thebishop.fr/
  179.  
  180.     .-==========================================-.
  181.  
  182.     Have fun! =]
  183.  
  184.  
  185.     P.S. You need legal kreedz settings 4 this to work!!!
  186.  
  187. */
  188.  
  189. #include <amxmodx>
  190. #include <amxmisc>
  191. #include <colorchat>
  192. #include <fakemeta>
  193. #include <engine>
  194. #include <fakemeta_util>
  195.  
  196. #pragma semicolon 1
  197.  
  198. #define COMMAND_PROTECTION
  199. #define JOKES
  200.  
  201. #define INFO_ONE 1
  202. #define INFO_ZERO 0
  203. #define NSTRAFES 14
  204. #define NTOP 23
  205. #define NSHOW 10
  206. #define MAPSHOW 4 // show first 3
  207.  
  208. //enums
  209. #define TYPE_NONE 0
  210. #define TYPE_LJ 1
  211. #define TYPE_CJ 2
  212. #define TYPE_BJ 3
  213. #define TYPE_HJ 4
  214. #define TYPE_FEJ 5 //fireEscape jump
  215. #define TYPE_LaJ 5 //ladder jump
  216. #define TYPE_SBJ 6 //stand-up bhop
  217. #define TYPE_WJ 7  //weird jump
  218. #define TYPE_LCHJ 10 //Lj && Cj && Hj
  219. #define TYPE_SBBJ 20 //Bj && SBJ
  220.  
  221. #define DIST_LEET 1
  222. #define DIST_PRO 2
  223. #define DIST_GOOD 3
  224. #define DIST_GOD 4
  225.  
  226. #define TOP_MAP 0
  227. #define TOP_LJ  1
  228. #define TOP_CJ  2
  229. #define TOP_BJ  3
  230. #define TOP_SBJ 4
  231. #define TOP_HJ  5
  232. #define TOP_FEJ 6
  233. #define TOP_LaJ 6
  234. #define TOP_WJ 7
  235.  
  236. //Iterator
  237. new jj;
  238.  
  239. //For PreThink
  240. new Float:weapSpeed[33];
  241. new Float:weapSpeedOld[33];
  242. new strLen;
  243. new strMess[40*NSTRAFES];
  244. new strMessBuf[40*NSTRAFES];
  245. new goodSyncTemp;
  246. new badSyncTemp;
  247. new Float:time_;
  248. new Float:maxPreSpeedWeapon;
  249. new Float:maxBhopPreSpeedWeap;
  250. new Float:Fulltime;
  251. new ljStatsRed;
  252. new ljStatsGreen;
  253. new ljStatsBlue;
  254. new ljs_beam;
  255. new sync_;
  256.  
  257.  
  258. // Ints & strings
  259. new server_settings[34][27][16];
  260. new plugin_id;
  261. new plugin_file_name[64];
  262. new pluginstatus;
  263. new gBeam;
  264. new jumptype[33];
  265. //new vJumpedAtEnt[33];
  266. new strafes[33];
  267. new ljsDir[64];
  268. new pre_type[33][32];
  269.  
  270. new top_names[NTOP][129];
  271. //new top_authid[NTOP][33];
  272. new top_distance[NTOP];
  273. new top_maxspeed[NTOP];
  274. new top_prestrafe[NTOP];
  275. new top_strafes[NTOP];
  276. new top_sync[NTOP];
  277. new top_type[NTOP][5];
  278. new top_pretype[NTOP][32];
  279.  
  280. new map_names[NSHOW][129];
  281. new map_authid[NSHOW][33];
  282. new map_distance[NSHOW];
  283. new map_maxspeed[NSHOW];
  284. new map_prestrafe[NSHOW];
  285. new map_strafes[NSHOW];
  286. new map_sync[NSHOW];
  287. new map_type[NSHOW][5];
  288. new map_pretype[NSHOW][32];
  289.  
  290. new cj_names[NTOP][129];
  291. new cj_authid[NTOP][33];
  292. new cj_distance[NTOP];
  293. new cj_maxspeed[NTOP];
  294. new cj_prestrafe[NTOP];
  295. new cj_strafes[NTOP];
  296. new cj_sync[NTOP];
  297. new cj_pretype[NTOP][32];
  298.  
  299. new bj_names[NTOP][129];
  300. new bj_authid[NTOP][33];
  301. new bj_distance[NTOP];
  302. new bj_maxspeed[NTOP];
  303. new bj_prestrafe[NTOP];
  304. new bj_strafes[NTOP];
  305. new bj_sync[NTOP];
  306. new bj_pretype[NTOP][32];
  307.  
  308. new sbj_names[NTOP][129];
  309. new sbj_authid[NTOP][33];
  310. new sbj_distance[NTOP];
  311. new sbj_maxspeed[NTOP];
  312. new sbj_prestrafe[NTOP];
  313. new sbj_strafes[NTOP];
  314. new sbj_sync[NTOP];
  315. new sbj_pretype[NTOP][32];
  316.  
  317. new wj_names[NTOP][129];
  318. new wj_authid[NTOP][33];
  319. new wj_distance[NTOP];
  320. new wj_maxspeed[NTOP];
  321. new wj_prestrafe[NTOP];
  322. new wj_strafes[NTOP];
  323. new wj_sync[NTOP];
  324. new wj_pretype[NTOP][32];
  325.  
  326. new lj_names[NTOP][129];
  327. new lj_authid[NTOP][33];
  328. new lj_distance[NTOP];
  329. new lj_maxspeed[NTOP];
  330. new lj_prestrafe[NTOP];
  331. new lj_strafes[NTOP];
  332. new lj_sync[NTOP];
  333. new lj_pretype[NTOP][32];
  334.  
  335. new view_names[33][NSHOW][129];
  336. new view_distance[33][NSHOW];
  337. new view_maxspeed[33][NSHOW];
  338. new view_prestrafe[33][NSHOW];
  339. new view_strafes[33][NSHOW];
  340. new view_sync[33][NSHOW];
  341. new view_type[33][NSHOW][5];
  342. new view_pretype[33][NSHOW][32];
  343. new full_top_stats_selected_type[33];
  344. new full_top_stats_selected_page[33];
  345. new strafe_stat_sync[33][NSTRAFES][2]; // 0=good 1=bad
  346. new buttons;
  347. new strafecounter_oldbuttons[33];
  348.  
  349. // Bools
  350. new bool:bljhelp[33];
  351. new bool:StrafeStat[33];
  352. new bool:fallDown[33];
  353. new bool:possible_lj_script[33][2];
  354. new bool:tops_save;
  355. new bool:gHasColorChat[33];
  356. new bool:gHasSpeed[33];
  357. new bool:gHasLjStats[33];
  358. new bool:testBhop[33];
  359. new bool:gInAir[33];
  360. new bool:isBhop[33];
  361. new bool:cjumped[33];
  362. new bool:doubleducked[33];
  363. new bool:cducked[33];
  364. new bool:induck[33];
  365. new bool:OnGround[33];
  366. new bool:turning_right[33];
  367. new bool:turning_left[33];
  368. new bool:strafing_aw[33];
  369. new bool:strafing_sd[33];
  370. new bool:bljbeam[33];
  371.  
  372. // Floats
  373. new Float:fMaxGroundBhopSpeed[33];
  374. new Float:ljhel[33][3];
  375. new Float:strafe_stat_time[33][NSTRAFES]; //[id][#of strafes for stat][goodStat/Badstat]  (of speed)
  376. new Float:strafe_stat_speed[33][NSTRAFES][2]; //[id][#of strafes for stat][goodStat/Badstat]  (of speed)
  377. new Float:TempSpeed[33];
  378. new Float:vBeamPos[33][129][3];
  379. new Float:vBeamPosStatus[33][129];
  380. new Float:vBeamTime[33][129];
  381. new Float:vBeamLastTime[33];
  382. new Float:old_angle1[33];
  383. new Float:angle[3];
  384. new Float:vFramePos[33][2][3];
  385. new Float:vFrameSpeed[33][2][3];
  386. new Float:vDuckedAt[33][3];
  387. new Float:vFallAt[33][3];
  388. new Float:vJumpedAt[33][3];
  389. new Float:vJumpedAt2[3];
  390. new Float:xDistance;
  391. new Float:yDistance;
  392. new Float:fDistance;
  393. new Float:fDistance1;
  394. new Float:fDistance2;
  395. new Float:rDistance[3];
  396. new Float:rLandPos[3];
  397. new Float:vOrigin[3];
  398. new Float:vLastFrameOrigin[33][3];
  399. //new Float:vLastFrameVelocity[33][3];
  400. new Float:vOldOrigin[33][3];
  401. //new Float:vOldOrigin2[33];
  402. new Float:vTraceEnd[3];
  403. new Float:fMaxAirSpeed[33];
  404. new Float:fMaxGroundSpeed[33];
  405. new Float:fCjPreSpeed[33];
  406. new Float:vVelocity[3];
  407. //new Float:realDist[33];
  408. new Float:fSpeed;
  409. new Float:gSpeed;
  410. //new Float:OldOldSpeed[33];
  411. //new Float:OldSpeed[33];
  412. new Float:frame2time;
  413. new Float:jumptime[33];
  414. new Float:lasttime[33];
  415. new Float:beam_jump_off_time[33];
  416.  
  417. // Plugin strings
  418. new const gPLUGIN[] = "LjS - eXtreme Mod";
  419. new const gVERSION[] = "2.2b7 Lt.RAT`s edition v3 bl";
  420. new const gVERSION_NUM[] = "22007";
  421. new const gAUTHOR[] = "Fatalis & Numb & Lt.RAT";
  422.  
  423. // Cvars
  424. new kz_ljs_enabled;
  425. new kz_good_lj;
  426. new kz_pro_lj;
  427. new kz_leet_lj;
  428. new kz_min_lj;
  429. new kz_min_lj_c;
  430. new kz_max_lj;
  431. new kz_cj_dif;
  432. new kz_lj_sounds;
  433. new kz_leet_lj_clr;
  434. new kz_pro_lj_clr;
  435. new kz_good_lj_clr;
  436. new kz_leet_cj_clr;
  437. new kz_pro_cj_clr;
  438. new kz_good_cj_clr;
  439. new kz_ljstats_red;
  440. new kz_ljstats_green;
  441. new kz_ljstats_blue;
  442. new kz_ljs_beam;
  443. new kz_legal_settings;
  444. new kz_ljs_fastserver;
  445. //new kz_ljs_autoserver;
  446. new kz_ljs_speedtype;
  447. new kz_ljs_connectenabler;
  448. new kz_ljs_viscmds;
  449. new kz_ljs_tops;
  450. new kz_ljs_topsave;
  451. new kz_ljs_rank_by;
  452. new kz_ljs_maptop;
  453. new kz_min_bhop;
  454. new kz_min_bhop_c;
  455. new edgefriction;
  456. new mp_footsteps;
  457. new sv_cheats;
  458. new sv_gravity;
  459. new sv_airaccelerate;
  460. new sv_maxspeed;
  461. new sv_stepsize;
  462. new sv_maxvelocity;
  463.  
  464. //new sv_lan;
  465.  
  466. public plugin_init()
  467. {
  468.     if( tops_save )
  469.         read_tops();
  470.    
  471.     new s_plugin_id[32], filename[255];
  472.    
  473.     format(s_plugin_id, 31, "%d", plugin_id);
  474.     format(filename, 254, "%s/ljs_plugin_info.txt", ljsDir);
  475.    
  476.     if( file_exists(filename) )
  477.         delete_file(filename);
  478.    
  479.     write_file(filename, gVERSION_NUM);
  480.     write_file(filename, s_plugin_id);
  481.     write_file(filename, plugin_file_name);
  482.     write_file(filename, gPLUGIN);
  483.     write_file(filename, gVERSION);
  484.     write_file(filename, gAUTHOR);
  485. }
  486.  
  487. public plugin_start()
  488. {
  489.     plugin_id = register_plugin(gPLUGIN, gVERSION, gAUTHOR);
  490.     register_cvar("LongJumpStats", gVERSION, FCVAR_SERVER);
  491.     register_dictionary("common.txt");
  492.    
  493.     register_forward(FM_ShouldCollide,   "fwdTouch",           1);
  494.     register_forward(FM_Touch,           "fwdTouch",           1);
  495.     register_forward(FM_PlayerPreThink,  "fwdPlayerPreThink",  0);
  496.     register_forward(FM_PlayerPostThink, "fwdPlayerPostThink", 0);
  497.     register_forward(FM_StartFrame,      "fwdStartFrame",      0);
  498.     register_forward(FM_CmdStart,        "fwdCmdStart");
  499.    
  500.    
  501.     kz_ljs_enabled        = register_cvar("kz_ljs_enabled",        "1");        // enables/disables the plugin
  502.     kz_good_lj            = register_cvar("kz_good_lj",            "240.0");    // good longjumps
  503.     kz_pro_lj             = register_cvar("kz_pro_lj",             "245.0");    // professional longjumps
  504.     kz_leet_lj            = register_cvar("kz_leet_lj",            "250.0");    // leet longjump
  505.     kz_min_lj             = register_cvar("kz_min_lj",             "215.0");    // minimal longjump
  506.     kz_min_lj_c           = register_cvar("kz_min_lj_c",           "230.0");    // minimal longjump to see
  507.     kz_min_bhop       = register_cvar("kz_min_bhop",           "210.0");    // minimal bhop
  508.     kz_min_bhop_c         = register_cvar("kz_min_bhop_c",         "220.0");    // minimal bhop
  509.     kz_max_lj             = register_cvar("kz_max_lj",             "260.0");    // maximal longjump
  510.     kz_cj_dif             = register_cvar("kz_cj_dif",             "10.0");     // difrence between lj and cj
  511.     kz_lj_sounds          = register_cvar("kz_lj_sounds",          "1");        // enables leet/pro/good lj/cj sounds
  512.     kz_leet_lj_clr        = register_cvar("kz_leet_lj_clr",        "1");        // color of leet lj (1=red, 2=green, 3=blue, 4=gray, 5=team, 0=default)
  513.     kz_pro_lj_clr         = register_cvar("kz_pro_lj_clr",         "2");        // color of pro lj
  514.     kz_good_lj_clr        = register_cvar("kz_good_lj_clr",        "4");        // color of good lj
  515.     kz_leet_cj_clr        = register_cvar("kz_leet_cj_clr",        "1");        // color of leet lj
  516.     kz_pro_cj_clr         = register_cvar("kz_pro_cj_clr",         "2");        // color of pro lj
  517.     kz_good_cj_clr        = register_cvar("kz_good_cj_clr",        "4");        // color of good lj
  518.     kz_ljstats_red        = register_cvar("kz_ljstats_red",        "0");        // red color of /ljstats
  519.     kz_ljstats_green      = register_cvar("kz_ljstats_green",      "255");      // green color of /ljstats
  520.     kz_ljstats_blue       = register_cvar("kz_ljstats_blue",       "159");      // blue color of /ljstats
  521.     kz_ljs_beam           = register_cvar("kz_ljs_beam",           "2");        // 0=beam off, 1=normal beam, 2=uber beam
  522.     kz_legal_settings     = register_cvar("kz_legal_settings",     "1");        // enables protection 4 legal kreedz settings
  523.     kz_ljs_fastserver     = register_cvar("kz_ljs_fastserver",     "1");            // Is your server fast? (0=slow, 1=normal, 2=good)
  524.     //kz_ljs_autoserver     = register_cvar("kz_ljs_autoserver",     "1");      // Authomaticaly detect what cvar of kz_ljs_fastserver should be?
  525.     kz_ljs_speedtype      = register_cvar("kz_ljs_speedtype",      "0");        // Speedometer type
  526.     kz_ljs_connectenabler = register_cvar("kz_ljs_connectenabler", "ab");       // What is enabled at connect (0=nothing, a=colorchat, b=ljstats, c=speed)
  527.     kz_ljs_viscmds        = register_cvar("kz_ljs_viscmds",        "1");        // Do you want say commands to be apeard on the chat?
  528.     kz_ljs_tops           = register_cvar("kz_ljs_tops",           "3");        // LongJump top (0=Nothing, 1=ColorChat, 2=top, 3=top+ColorChat)
  529.     kz_ljs_topsave        = register_cvar("kz_ljs_topsave",        "1");        // Do you want to save ljtop after mapchange?
  530.     kz_ljs_rank_by        = register_cvar("kz_ljs_rank_by",        "2");        // How ranking will work? 0=name, 1=steam, 2=ip
  531.     kz_ljs_maptop         = register_cvar("kz_ljs_maptop",         "1");        // Enable map top
  532.    
  533.     edgefriction          = get_cvar_pointer("edgefriction");
  534.     mp_footsteps          = get_cvar_pointer("mp_footsteps");
  535.     sv_cheats             = get_cvar_pointer("sv_cheats");
  536.     sv_gravity            = get_cvar_pointer("sv_gravity");
  537.     sv_airaccelerate      = get_cvar_pointer("sv_airaccelerate");
  538.     sv_maxspeed           = get_cvar_pointer("sv_maxspeed");
  539.     sv_stepsize           = get_cvar_pointer("sv_stepsize");
  540.     sv_maxvelocity        = get_cvar_pointer("sv_maxvelocity");
  541. //  sv_lan                = get_cvar_pointer("sv_lan");
  542.    
  543. /* 
  544.     server_settings[33][0] = "1";
  545.     server_settings[33][1] = "260.0";
  546.     server_settings[33][2] = "250.0";
  547.     server_settings[33][3] = "245.0";
  548.     server_settings[33][4] = "240.0";
  549.     server_settings[33][5] = "215.0";
  550.     server_settings[33][6] = "5.0";
  551.     server_settings[33][7] = "1";
  552.     server_settings[33][8] = "3";
  553.     server_settings[33][9] = "1";
  554.     server_settings[33][10] = "0";
  555.     server_settings[33][11] = "1";
  556.     server_settings[33][12] = "2";
  557.     server_settings[33][13] = "4";
  558.     server_settings[33][14] = "1";
  559.     server_settings[33][15] = "2";
  560.     server_settings[33][16] = "4";
  561.     server_settings[33][17] = "0";
  562.     server_settings[33][18] = "255";
  563.     server_settings[33][19] = "159";
  564.     server_settings[33][20] = "2";
  565.     server_settings[33][21] = "1";
  566.     server_settings[33][22] = "2";
  567.     server_settings[33][23] = "1";
  568.     server_settings[33][24] = "abc";
  569.     server_settings[33][25] = "1";
  570.     server_settings[33][26] = "0";
  571. */
  572.     configurate_plugin();
  573.    
  574.     register_menucmd(register_menuid("LongJump Stats Menu"),  1023, "LjsMenu_Select");
  575.     register_menucmd(register_menuid("Top 10 Menu"),          1023, "MainTopMenu_Select");
  576.     register_menucmd(register_menuid("Full top stats"),       1023, "FullTopMenu_Select");
  577.     register_menucmd(register_menuid("Show best longjumper"), 1023, "LeetJumpMenu_Select");
  578.    
  579.    
  580.     tops_save = true;
  581.     new LJS_ADMIN = ADMIN_MAP;
  582.     if( get_pcvar_num(kz_ljs_topsave) )
  583.         LJS_ADMIN = ADMIN_RCON;
  584.     else
  585.         tops_save = false;
  586.    
  587.     register_concmd("amx_resetljrec",  "topreset",         LJS_ADMIN, "- resets ljrec and ljtops");
  588.     register_concmd("amx_resetljtops", "topreset",         LJS_ADMIN, "- resets ljrec and ljtops");
  589.    
  590.     register_clcmd("say /colorchat",  "cmdColorChat",      ADMIN_ALL, "- enables/disables colorchat");
  591.     register_clcmd("say /ljstats",    "cmdLjStats",        ADMIN_ALL, "- enables/disables longjump stats");
  592.     register_clcmd("say /ljsversion", "cmdVersion",        ADMIN_ALL, "- prints plugin version");
  593.     register_clcmd("say /speed",      "cmdSpeed",          ADMIN_ALL, "- enabled/disables visible speed");
  594.     register_clcmd("say /strafestat", "cmdStrafeStat",     ADMIN_ALL, "- enabled/disables strafe statistics");
  595.     register_clcmd("say /ljlinear",   "cmdljhelp",         ADMIN_ALL, "- enabled/disables");
  596.     register_clcmd("say /ljbeam",     "cmdljbeam",         ADMIN_ALL, "- enabled/disables");
  597.    
  598.     register_clcmd("say /ljsmenu",    "cmdLjsMenu",        ADMIN_ALL, "- display ljs menu");
  599.     register_clcmd("say /cj15",       "cmdTopMenu",        -1,        "- display tops menu");
  600.     register_clcmd("say /cjtop15",    "cmdTopMenu",        -1,        "- display tops menu");
  601.     register_clcmd("say /cj10",       "cmdTopMenu",        -1,        "- display tops menu");
  602.     register_clcmd("say /cjtop10",    "cmdTopMenu",        -1,        "- display tops menu");
  603.     register_clcmd("say /cjtop",      "cmdTopMenu",        -1,        "- display tops menu");
  604.     register_clcmd("say /bj15",       "cmdTopMenu",        -1,        "- display tops menu");
  605.     register_clcmd("say /bjtop15",    "cmdTopMenu",        -1,        "- display tops menu");
  606.     register_clcmd("say /bj10",       "cmdTopMenu",        -1,        "- display tops menu");
  607.     register_clcmd("say /bjtop10",    "cmdTopMenu",        -1,        "- display tops menu");
  608.     register_clcmd("say /bjtop",      "cmdTopMenu",        -1,        "- display tops menu");
  609.     register_clcmd("say /bhop15",     "cmdTopMenu",        -1,        "- display tops menu");
  610.     register_clcmd("say /bhop10",     "cmdTopMenu",        -1,        "- display tops menu");
  611.     register_clcmd("say /bhop",       "cmdTopMenu",        -1,        "- display tops menu");
  612.     register_clcmd("say /lj15",       "cmdTopMenu",        -1,        "- display tops menu");
  613.     register_clcmd("say /ljtop15",    "cmdTopMenu",        -1,        "- display tops menu");
  614.     register_clcmd("say /lj10",       "cmdTopMenu",        ADMIN_ALL, "- display tops menu");
  615.     register_clcmd("say /ljtop10",    "cmdTopMenu",        -1,        "- display tops menu");
  616.     register_clcmd("say /ljtop",      "cmdTopMenu",        -1,        "- display tops menu");
  617.     register_clcmd("say /ljrec",      "show_leet_ljumper", ADMIN_ALL, "- display records menu");
  618.     register_clcmd("say /cjrec",      "show_leet_ljumper", -1,        "- display records menu");
  619.     register_clcmd("say /bjrec",      "show_leet_ljumper", -1,    "- display records menu");
  620.     register_clcmd("say /sbjrec",     "show_leet_ljumper", -1,        "- display records menu");
  621.     register_clcmd("say /wjrec",      "show_leet_ljumper", -1,        "- display records menu");
  622.    
  623.     register_clcmd("say /tele",       "gocheckBoth",           -1,        " - teleported");
  624.     register_clcmd("say /tp",         "gocheckBoth",           -1,        " - teleported");
  625.     register_clcmd("say /gocheck",    "gocheckBoth",           -1,        " - teleported");
  626.     register_clcmd("say /gc",         "gocheckBoth",           -1,        " - teleported");
  627.     register_clcmd("say .tele",       "gocheckBoth",           -1,        " - teleported");
  628.     register_clcmd("say .tp",         "gocheckBoth",           -1,        " - teleported");
  629.     register_clcmd("say .gocheck",    "gocheckBoth",           -1,        " - teleported");
  630.     register_clcmd("say .gc",         "gocheckBoth",           -1,        " - teleported");
  631.     register_clcmd("/tele",           "gocheckBoth",           -1,        " - teleported");
  632.     register_clcmd("/tp",             "gocheckBoth",           -1,        " - teleported");
  633.     register_clcmd("/gocheck",        "gocheckBoth",           -1,        " - teleported");
  634.     register_clcmd("/gc",             "gocheckBoth",           -1,        " - teleported");
  635.     register_clcmd(".tele",           "gocheckBoth",           -1,        " - teleported");
  636.     register_clcmd(".tp",             "gocheckBoth",           -1,        " - teleported");
  637.     register_clcmd(".gocheck",        "gocheckBoth",           -1,        " - teleported");
  638.     register_clcmd(".gc",             "gocheckBoth",           -1,        " - teleported");
  639.     register_clcmd("say /stuck",      "gocheckBoth",           -1,        " - teleported");
  640.     register_clcmd("say /unstuck",    "gocheckBoth",           -1,        " - teleported");
  641.     register_clcmd("say .stuck",      "gocheckBoth",           -1,        " - teleported");
  642.     register_clcmd("say .unstuck",    "gocheckBoth",           -1,        " - teleported");
  643.     register_clcmd("/stuck",          "gocheckBoth",           -1,        " - teleported");
  644.     register_clcmd("/unstuck",        "gocheckBoth",           -1,        " - teleported");
  645.     register_clcmd(".stuck",          "gocheckBoth",           -1,        " - teleported");
  646.     register_clcmd(".unstuck",        "gocheckBoth",           -1,        " - teleported");
  647.     register_clcmd("say /start",      "gocheckBoth",           -1,        " - reseted");
  648.     register_clcmd("say /reset",      "gocheckBoth",           -1,        " - reseted");
  649.     register_clcmd("say /restart",    "gocheckBoth",           -1,        " - reseted");
  650.     register_clcmd("say /spawn",      "gocheckBoth",           -1,        " - reseted");
  651.     register_clcmd("say .start",      "gocheckBoth",           -1,        " - reseted");
  652.     register_clcmd("say .reset",      "gocheckBoth",           -1,        " - reseted");
  653.     register_clcmd("say .restart",    "gocheckBoth",           -1,        " - reseted");
  654.     register_clcmd("say .spawn",      "gocheckBoth",           -1,        " - reseted");
  655.     register_clcmd("/start",          "gocheckBoth",           -1,        " - reseted");
  656.     register_clcmd("/reset",          "gocheckBoth",           -1,        " - reseted");
  657.     register_clcmd("/restart",        "gocheckBoth",           -1,        " - reseted");
  658.     register_clcmd("/spawn",          "gocheckBoth",           -1,        " - reseted");
  659.     register_clcmd(".start",          "gocheckBoth",           -1,        " - reseted");
  660.     register_clcmd(".reset",          "gocheckBoth",           -1,        " - reseted");
  661.     register_clcmd(".restart",        "gocheckBoth",           -1,        " - reseted");
  662.     register_clcmd(".spawn",          "gocheckBoth",           -1,        " - reseted");
  663.     register_clcmd("+hook",           "gocheckBoth",           -1,        " - used hook");
  664.     register_clcmd("-hook",           "gocheckBoth",           -1,        " - used hook");
  665.        
  666.     new dataDir[64];
  667.     get_datadir(dataDir, 63);
  668.     format(ljsDir, 63, "%s/ljs", dataDir);
  669.     if( !dir_exists(ljsDir) )
  670.         mkdir(ljsDir);
  671.    
  672.     get_plugin(plugin_id, plugin_file_name, 63, "", 0, "", 0, "", 0, "", 0);
  673. }
  674.  
  675. public fwdCmdStart(plr, uc_handle, seed)
  676. {
  677.     if ( is_user_alive( plr ) )
  678.     {
  679.         static g_iPlayerFps;
  680.         g_iPlayerFps = get_uc(uc_handle, UC_Msec);
  681.  
  682.         if ( (g_iPlayerFps > 0 && g_iPlayerFps < 10))
  683.         {
  684.             gocheckBoth(plr);
  685.         }
  686.     }
  687. }
  688.  
  689. public configurate_plugin()
  690. {
  691. /*  if( !get_ljsconfig(0) )
  692.     {
  693.         for( new i; i < 27; i++ )
  694.             format(server_settings[0][i], 15, "%s", server_settings[33][i]);
  695.     }
  696.     setconfig_now(0);
  697. */
  698. }
  699.  
  700. public setconfig_now(player)
  701. {
  702. /*
  703.     set_cvar_string("kz_ljs_enabled", server_settings[player][0]);
  704.     set_cvar_string("kz_max_lj", server_settings[player][1]);
  705.     set_cvar_string("kz_leet_lj", server_settings[player][2]);
  706.     set_cvar_string("kz_pro_lj", server_settings[player][3]);
  707.     set_cvar_string("kz_good_lj", server_settings[player][4]);
  708.     set_cvar_string("kz_min_lj", server_settings[player][5]);
  709.     set_cvar_string("kz_cj_dif", server_settings[player][6]);
  710.     set_cvar_string("kz_lj_sounds", server_settings[player][7]);
  711.     set_cvar_string("kz_lj_top", server_settings[player][8]);
  712.     set_cvar_string("kz_ljs_topsave", server_settings[player][9]);
  713.     set_cvar_string("kz_ljs_rank_by", server_settings[player][10]);
  714.     set_cvar_string("kz_leet_lj_clr", server_settings[player][11]);
  715.     set_cvar_string("kz_pro_lj_clr", server_settings[player][12]);
  716.     set_cvar_string("kz_good_lj_clr", server_settings[player][13]);
  717.     set_cvar_string("kz_leet_cj_clr", server_settings[player][14]);
  718.     set_cvar_string("kz_pro_cj_clr", server_settings[player][15]);
  719.     set_cvar_string("kz_good_cj_clr", server_settings[player][16]);
  720.     set_cvar_string("kz_ljstats_red", server_settings[player][17]);
  721.     set_cvar_string("kz_ljstats_green", server_settings[player][18]);
  722.     set_cvar_string("kz_ljstats_blue", server_settings[player][19]);
  723.     set_cvar_string("kz_ljs_beam", server_settings[player][20]);
  724.     set_cvar_string("kz_legal_settings", server_settings[player][21]);
  725.     if( str_to_num(server_settings[player][22]) == 2 && str_to_num(server_settings[player][23]) )
  726.     {
  727.         if( !is_dedicated_server() && get_pcvar_num(sv_lan) != 0 )
  728.             set_cvar_string("kz_ljs_fastserver", "2");
  729.         else
  730.             set_cvar_string("kz_ljs_fastserver", "1");
  731.     }
  732.     else
  733.         set_cvar_string("kz_ljs_fastserver", server_settings[player][22]);
  734.     set_pcvar_num(kz_ljs_autoserver, str_to_num(server_settings[player][23]));
  735.     set_cvar_string("kz_ljs_connectenabler", server_settings[player][24]);
  736.     set_cvar_string("kz_ljs_viscmds", server_settings[player][25]);
  737.     set_cvar_string("kz_ljs_speedtype", server_settings[player][26]);
  738. */
  739. }
  740.  
  741. stock get_ljsconfig(player)
  742. {
  743.     static configsDir[64], filename[128];
  744.     get_configsdir(configsDir, 63);
  745.     format(filename, 127, "%s/ljstats.ini", configsDir);
  746.    
  747.     if( !dir_exists(configsDir) )
  748.         mkdir(configsDir);
  749.        
  750.     if( !file_exists(filename) )
  751.     {
  752.         log_amx("LjS: Error: Configuration file <^"%s^"> not found!", filename);
  753.         log_amx("LjS: Creating file...");
  754.         write_file(filename, "; .-==========================================-.");
  755.         write_file(filename, "; |~~ Long Jump Stats - eXtreme Modification ~~|");
  756.         write_file(filename, "; .-==========================================-.");
  757.         write_file(filename, "");
  758.         write_file(filename, "");
  759.         write_file(filename, "; Enabled/Disables the plugin");
  760.         write_file(filename, "; 0 = disabled");
  761.         write_file(filename, "; 1 = enabled");
  762.         write_file(filename, "; Cvar kz_ljs_enabled (default ^"1^")");
  763.         write_file(filename, "1");
  764.         write_file(filename, "");
  765.         write_file(filename, "; Maximum possible lj (not 4 cj)");
  766.         write_file(filename, "; Cvar kz_max_lj (default ^"260.0^")");
  767.         write_file(filename, "260.0");
  768.         write_file(filename, "");
  769.         write_file(filename, "; 1337 lj (prints to all players)");
  770.         write_file(filename, "; To disable, set it to -1");
  771.         write_file(filename, "; Cvar kz_leet_lj (default ^"250.0^")");
  772.         write_file(filename, "250.0");
  773.         write_file(filename, "");
  774.         write_file(filename, "; Professional lj (prints to all players)");
  775.         write_file(filename, "; To disable, set it to -1");
  776.         write_file(filename, "; Cvar kz_pro_lj (default ^"245.0^")");
  777.         write_file(filename, "245.0");
  778.         write_file(filename, "");
  779.         write_file(filename, "; Good lj (prints to all players)");
  780.         write_file(filename, "; To disable, set it to -1");
  781.         write_file(filename, "; Cvar kz_good_lj (default ^"240.0^")");
  782.         write_file(filename, "240.0");
  783.         write_file(filename, "");
  784.         write_file(filename, "; Minimal lj distance");
  785.         write_file(filename, "; Cvar kz_min_lj (default ^"215.0^")");
  786.         write_file(filename, "215.0");
  787.         write_file(filename, "");
  788.         write_file(filename, "; Difrence between longjump and countjump for good/pro/leet/max jump");
  789.         write_file(filename, "; Cvar kz_cj_dif (default ^"10.0^")");
  790.         write_file(filename, "10.0");
  791.         write_file(filename, "");
  792.         write_file(filename, "; Enables lj sounds");
  793.         write_file(filename, "; 0 = disabled");
  794.         write_file(filename, "; 1 = ultimate sounds");
  795.         write_file(filename, "; 2 = distance in voice");
  796.         write_file(filename, "; Cvar kz_lj_sounds (default ^"1^")");
  797.         write_file(filename, "1");
  798.         write_file(filename, "");
  799.         write_file(filename, "; How dose plugin works");
  800.         write_file(filename, "; 0 = no top and no colorchat");
  801.         write_file(filename, "; 1 = prints good/pro/leet jumps");
  802.         write_file(filename, "; 2 = enables top10");
  803.         write_file(filename, "; 3 = prints good/pro/leet jumps and enables top10");
  804.         write_file(filename, "; Cvar kz_lj_top (default ^"3^")");
  805.         write_file(filename, "3");
  806.         write_file(filename, "");
  807.         write_file(filename, "; Do you want to save ljtop after mapchange?");
  808.         write_file(filename, "; Cvar kz_ljs_topsave (default ^"1^")");
  809.         write_file(filename, "1");
  810.         write_file(filename, "");
  811.         write_file(filename, "; How ranking will work?");
  812.         write_file(filename, "; 0 = names");
  813.         write_file(filename, "; 1 = steam ids");
  814.         write_file(filename, "; 2 = ips");
  815.         write_file(filename, "; Cvar kz_ljs_rank_by (default ^"0^")");
  816.         write_file(filename, "0");
  817.         write_file(filename, "");
  818.         write_file(filename, "; Kz jumping color chat:");
  819.         write_file(filename, "; 0 = normal");
  820.         write_file(filename, "; 1 = red");
  821.         write_file(filename, "; 2 = green");
  822.         write_file(filename, "; 3 = blue");
  823.         write_file(filename, "; 4 = silver");
  824.         write_file(filename, "; 5 = team color");
  825.         write_file(filename, "");
  826.         write_file(filename, "; Cvar kz_leet_lj_clr (default ^"1^")");
  827.         write_file(filename, "1");
  828.         write_file(filename, "; Cvar kz_pro_lj_clr (default ^"2^")");
  829.         write_file(filename, "2");
  830.         write_file(filename, "; Cvar kz_good_lj_clr (default ^"4^")");
  831.         write_file(filename, "4");
  832.         write_file(filename, "");
  833.         write_file(filename, "; Cvar kz_leet_cj_clr (default ^"1^")");
  834.         write_file(filename, "1");
  835.         write_file(filename, "; Cvar kz_pro_cj_clr (default ^"2^")");
  836.         write_file(filename, "2");
  837.         write_file(filename, "; Cvar kz_good_cj_clr (default ^"4^")");
  838.         write_file(filename, "4");
  839.         write_file(filename, "");
  840.         write_file(filename, "; Colors of /ljstats (rrr ggg bbb)");
  841.         write_file(filename, "; Cvar kz_ljstats_red (default ^"0^")");
  842.         write_file(filename, "0");
  843.         write_file(filename, "; Cvar kz_ljstats_green (default ^"255^")");
  844.         write_file(filename, "255");
  845.         write_file(filename, "; Cvar kz_ljstats_blue (^"159^")");
  846.         write_file(filename, "159");
  847.         write_file(filename, "");
  848.         write_file(filename, "; LongJump Stats Laser Beam");
  849.         write_file(filename, "; 0 = off");
  850.         write_file(filename, "; 1 = normal");
  851.         write_file(filename, "; 2 = uber beam");
  852.         write_file(filename, "; Cvar kz_ljs_beam (default ^"2^")");
  853.         write_file(filename, "2");
  854.         write_file(filename, "");
  855.         write_file(filename, "; Enables protection 4 legal kreedz settings");
  856.         write_file(filename, "; Cvar kz_legal_settings (default ^"1^")");
  857.         write_file(filename, "1");
  858.         write_file(filename, "");
  859.         write_file(filename, "; Is your server fast?");
  860.         write_file(filename, "; 0 = slow");
  861.         write_file(filename, "; 1 = normal");
  862.         write_file(filename, "; 2 = realy good ( >10mb/s or localhost/lan server )");
  863.         write_file(filename, "; Cvar kz_ljs_fastserver (default ^"2^")");
  864.         write_file(filename, "2");
  865.         write_file(filename, "");
  866.         write_file(filename, "; Enables auto-setting 4 kz_ljs_fastserver cvar if it is 2");
  867.         write_file(filename, "; Cvar kz_ljs_autoserver (default ^"1^")");
  868.         write_file(filename, "1");
  869.         write_file(filename, "");
  870.         write_file(filename, "; What is enabled on client when he connects to a server?");
  871.         write_file(filename, "; 0 = nothing");
  872.         write_file(filename, "; a = colorchat");
  873.         write_file(filename, "; b = ljstats");
  874.         write_file(filename, "; c = speed");
  875.         write_file(filename, "; Cvar kz_ljs_connectenabler (default ^"abc^")");
  876.         write_file(filename, "abc");
  877.         write_file(filename, "");
  878.         write_file(filename, "; Do you want cmds like /speed to be visible in the chat?");
  879.         write_file(filename, "; Cvar kz_ljs_viscmds (default ^"1^")");
  880.         write_file(filename, "1");
  881.         write_file(filename, "");
  882.         write_file(filename, "; Speedometer type");
  883.         write_file(filename, "; 0 = show real speed and horizontal speed");
  884.         write_file(filename, "; 1 = show real speed");
  885.         write_file(filename, "; 2 = show horizontal speed");
  886.         write_file(filename, "; Cvar kz_ljs_speedtype (default ^"0^")");
  887.         write_file(filename, "0");
  888.         if( file_exists(filename) )
  889.         {
  890.             log_amx("LjS: File <^"%s^"> successfully created.", filename);
  891.             log_amx("LjS: All settings are setted by default.");
  892.         }
  893.         else
  894.         {
  895.             log_amx("LjS: Fatal-Error: Creation of <^"%s^"> file failed!", filename);
  896.             log_amx("LjS: Disabeling plugin...");
  897.             set_cvar_string("kz_ljs_enabled", "0");
  898.             if( get_cvar_num("kz_ljs_enabled") )
  899.             {
  900.                 if( !plugin_file_name[0] )
  901.                     return 0;
  902.                
  903.                 log_amx("LjS: Fatal-Error: Omg, plugin cannot be disabled by cvar... Check your amxx!!!");
  904.                 log_amx("LjS: Disabeling plugin by turning off the code.");
  905.                 pause("ac", plugin_file_name);
  906.             }
  907.             return 0;
  908.         }
  909.     }
  910.    
  911.     new ljs_cvar_num;
  912.     for( ljs_cvar_num = INFO_ZERO; ljs_cvar_num < 27; ljs_cvar_num++ )
  913.         server_settings[player][ljs_cvar_num] = "";
  914.    
  915.     ljs_cvar_num = 0;
  916.     new i, line, text[16], txtsize;
  917.     for( i = INFO_ZERO; i < 255; i++ )
  918.     {
  919.         if( (line=read_file(filename, line, text, 15, txtsize)) != 0 )
  920.         {
  921.             if( text[0] == ';' || (text[0] == '/' && text[1] == '/') || !text[0] || text[0] == ' ' )
  922.                 continue;
  923.             else
  924.             {
  925.                 format(server_settings[player][ljs_cvar_num], 15, "%s", text);
  926.                 ljs_cvar_num += 1;
  927.                 if( ljs_cvar_num == 27 )
  928.                     break;
  929.             }
  930.         }
  931.         else
  932.             break;
  933.     }
  934.    
  935.     delete_file(filename);
  936.     write_file(filename, "; .-==========================================-.");
  937.     write_file(filename, "; |~~ Long Jump Stats - eXtreme Modification ~~|");
  938.     write_file(filename, "; .-==========================================-.");
  939.     write_file(filename, "");
  940.     write_file(filename, "");
  941.     write_file(filename, "; Enabled/Disables the plugin");
  942.     write_file(filename, "; 0 = disabled");
  943.     write_file(filename, "; 1 = enabled");
  944.     write_file(filename, "; Cvar kz_ljs_enabled (default ^"1^")");
  945.     if( server_settings[player][0][0] )
  946.         write_file(filename, server_settings[player][0]);
  947.     else
  948.     {
  949.         fix_config(1, player);
  950.         return 1;
  951.     }
  952.     write_file(filename, "");
  953.     write_file(filename, "; Maximum possible lj (not 4 cj)");
  954.     write_file(filename, "; Cvar kz_max_lj (default ^"260.0^")");
  955.     if( server_settings[player][1][0] )
  956.         write_file(filename, server_settings[player][1]);
  957.     else
  958.     {
  959.         fix_config(2, player);
  960.         return 1;
  961.     }
  962.     write_file(filename, "");
  963.     write_file(filename, "; 1337 lj (prints to all players)");
  964.     write_file(filename, "; To disable, set it to -1");
  965.     write_file(filename, "; Cvar kz_leet_lj (default ^"250.0^")");
  966.     if( server_settings[player][2][0] )
  967.         write_file(filename, server_settings[player][2]);
  968.     else
  969.     {
  970.         fix_config(3, player);
  971.         return 1;
  972.     }
  973.     write_file(filename, "");
  974.     write_file(filename, "; Professional lj (prints to all players)");
  975.     write_file(filename, "; To disable, set it to -1");
  976.     write_file(filename, "; Cvar kz_pro_lj (default ^"245.0^")");
  977.     if( server_settings[player][3][0] )
  978.         write_file(filename, server_settings[player][3]);
  979.     else
  980.     {
  981.         fix_config(4, player);
  982.         return 1;
  983.     }
  984.     write_file(filename, "");
  985.     write_file(filename, "; Good lj (prints to all players)");
  986.     write_file(filename, "; To disable, set it to -1");
  987.     write_file(filename, "; Cvar kz_good_lj (default ^"240.0^")");
  988.     if( server_settings[player][4][0] )
  989.         write_file(filename, server_settings[player][4]);
  990.     else
  991.     {
  992.         fix_config(5, player);
  993.         return 1;
  994.     }
  995.     write_file(filename, "");
  996.     write_file(filename, "; Minimal lj distance");
  997.     write_file(filename, "; Cvar kz_min_lj (default ^"215.0^")");
  998.     if( server_settings[player][5][0] )
  999.         write_file(filename, server_settings[player][5]);
  1000.     else
  1001.     {
  1002.         fix_config(6, player);
  1003.         return 1;
  1004.     }
  1005.     write_file(filename, "");
  1006.     write_file(filename, "; Difrence between longjump and countjump for good/pro/leet/max jump");
  1007.     write_file(filename, "; Cvar kz_cj_dif (default ^"10.0^")");
  1008.     if( server_settings[player][6][0] )
  1009.         write_file(filename, server_settings[player][6]);
  1010.     else
  1011.     {
  1012.         fix_config(7, player);
  1013.         return 1;
  1014.     }
  1015.     write_file(filename, "");
  1016.     write_file(filename, "; Enables lj sounds");
  1017.     write_file(filename, "; 0 = disabled");
  1018.     write_file(filename, "; 1 = ultimate sounds");
  1019.     write_file(filename, "; 2 = distance in voice");
  1020.     write_file(filename, "; Cvar kz_lj_sounds (default ^"1^")");
  1021.     if( server_settings[player][7][0] )
  1022.         write_file(filename, server_settings[player][7]);
  1023.     else
  1024.     {
  1025.         fix_config(8, player);
  1026.         return 1;
  1027.     }
  1028.     write_file(filename, "");
  1029.     write_file(filename, "; How dose plugin works");
  1030.     write_file(filename, "; 0 = no top and no colorchat");
  1031.     write_file(filename, "; 1 = prints good/pro/leet jumps");
  1032.     write_file(filename, "; 2 = enables top10");
  1033.     write_file(filename, "; 3 = prints good/pro/leet jumps and enables top10");
  1034.     write_file(filename, "; Cvar kz_lj_top (default ^"3^")");
  1035.     if( server_settings[player][8][0] )
  1036.         write_file(filename, server_settings[player][8]);
  1037.     else
  1038.     {
  1039.         fix_config(9, player);
  1040.         return 1;
  1041.     }
  1042.     write_file(filename, "");
  1043.     write_file(filename, "; Do you want to save ljtop after mapchange?");
  1044.     write_file(filename, "; Cvar kz_ljs_topsave (default ^"1^")");
  1045.     if( server_settings[player][9][0] )
  1046.         write_file(filename, server_settings[player][9]);
  1047.     else
  1048.     {
  1049.         fix_config(10, player);
  1050.         return 1;
  1051.     }
  1052.     write_file(filename, "");
  1053.     write_file(filename, "; How ranking will work?");
  1054.     write_file(filename, "; 0 = names");
  1055.     write_file(filename, "; 1 = steam ids");
  1056.     write_file(filename, "; 2 = ips");
  1057.     write_file(filename, "; Cvar kz_ljs_rank_by (default ^"0^")");
  1058.     if( server_settings[player][10][0] )
  1059.         write_file(filename, server_settings[player][10]);
  1060.     else
  1061.     {
  1062.         fix_config(11, player);
  1063.         return 1;
  1064.     }
  1065.     write_file(filename, "");
  1066.     write_file(filename, "; Kz jumping color chat:");
  1067.     write_file(filename, "; 0 = normal");
  1068.     write_file(filename, "; 1 = red");
  1069.     write_file(filename, "; 2 = green");
  1070.     write_file(filename, "; 3 = blue");
  1071.     write_file(filename, "; 4 = silver");
  1072.     write_file(filename, "; 5 = team color");
  1073.     write_file(filename, "");
  1074.     write_file(filename, "; Cvar kz_leet_lj_clr (default ^"1^")");
  1075.     if( server_settings[player][11][0] )
  1076.         write_file(filename, server_settings[player][11]);
  1077.     else
  1078.     {
  1079.         fix_config(12, player);
  1080.         return 1;
  1081.     }
  1082.     write_file(filename, "; Cvar kz_pro_lj_clr (default ^"2^")");
  1083.     if( server_settings[player][12][0] )
  1084.         write_file(filename, server_settings[player][12]);
  1085.     else
  1086.     {
  1087.         fix_config(13, player);
  1088.         return 1;
  1089.     }
  1090.     write_file(filename, "; Cvar kz_good_lj_clr (default ^"4^")");
  1091.     if( server_settings[player][13][0] )
  1092.         write_file(filename, server_settings[player][13]);
  1093.     else
  1094.     {
  1095.         fix_config(14, player);
  1096.         return 1;
  1097.     }
  1098.     write_file(filename, "");
  1099.     write_file(filename, "; Cvar kz_leet_cj_clr (default ^"1^")");
  1100.     if( server_settings[player][14][0] )
  1101.         write_file(filename, server_settings[player][14]);
  1102.     else
  1103.     {
  1104.         fix_config(15, player);
  1105.         return 1;
  1106.     }
  1107.     write_file(filename, "; Cvar kz_pro_cj_clr (default ^"2^")");
  1108.     if( server_settings[player][15][0] )
  1109.         write_file(filename, server_settings[player][15]);
  1110.     else
  1111.     {
  1112.         fix_config(16, player);
  1113.         return 1;
  1114.     }
  1115.     write_file(filename, "; Cvar kz_good_cj_clr (default ^"4^")");
  1116.     if( server_settings[player][16][0] )
  1117.         write_file(filename, server_settings[player][16]);
  1118.     else
  1119.     {
  1120.         fix_config(17, player);
  1121.         return 1;
  1122.     }
  1123.     write_file(filename, "");
  1124.     write_file(filename, "; Colors of /ljstats (rrr ggg bbb)");
  1125.     write_file(filename, "; Cvar kz_ljstats_red (default ^"0^")");
  1126.     if( server_settings[player][17][0] )
  1127.         write_file(filename, server_settings[player][17]);
  1128.     else
  1129.     {
  1130.         fix_config(18, player);
  1131.         return 1;
  1132.     }
  1133.     write_file(filename, "; Cvar kz_ljstats_green (default ^"255^")");
  1134.     if( server_settings[player][18][0] )
  1135.         write_file(filename, server_settings[player][18]);
  1136.     else
  1137.     {
  1138.         fix_config(19, player);
  1139.         return 1;
  1140.     }
  1141.     write_file(filename, "; Cvar kz_ljstats_blue (^"159^")");
  1142.     if( server_settings[player][19][0] )
  1143.         write_file(filename, server_settings[player][19]);
  1144.     else
  1145.     {
  1146.         fix_config(20, player);
  1147.         return 1;
  1148.     }
  1149.     write_file(filename, "");
  1150.     write_file(filename, "; LongJump Stats Laser Beam");
  1151.     write_file(filename, "; 0 = off");
  1152.     write_file(filename, "; 1 = normal");
  1153.     write_file(filename, "; 2 = uber beam");
  1154.     write_file(filename, "; Cvar kz_ljs_beam (default ^"2^")");
  1155.     if( server_settings[player][20][0] )
  1156.         write_file(filename, server_settings[player][20]);
  1157.     else
  1158.     {
  1159.         fix_config(21, player);
  1160.         return 1;
  1161.     }
  1162.     write_file(filename, "");
  1163.     write_file(filename, "; Enables protection 4 legal kreedz settings");
  1164.     write_file(filename, "; Cvar kz_legal_settings (default ^"1^")");
  1165.     if( server_settings[player][21][0] )
  1166.         write_file(filename, server_settings[player][21]);
  1167.     else
  1168.     {
  1169.         fix_config(22, player);
  1170.         return 1;
  1171.     }
  1172.     write_file(filename, "");
  1173.     write_file(filename, "; Is your server fast?");
  1174.     write_file(filename, "; 0 = slow");
  1175.     write_file(filename, "; 1 = normal");
  1176.     write_file(filename, "; 2 = realy good ( >10mb/s or localhost/lan server )");
  1177.     write_file(filename, "; Cvar kz_ljs_fastserver (default ^"2^")");
  1178.     if( server_settings[player][22][0] )
  1179.         write_file(filename, server_settings[player][22]);
  1180.     else
  1181.     {
  1182.         fix_config(23, player);
  1183.         return 1;
  1184.     }
  1185.     write_file(filename, "");
  1186.     write_file(filename, "; Enables auto-setting 4 kz_ljs_fastserver cvar if it is 2");
  1187.     write_file(filename, "; Cvar kz_ljs_autoserver (default ^"1^")");
  1188.     if( server_settings[player][23][0] )
  1189.         write_file(filename, server_settings[player][23]);
  1190.     else
  1191.     {
  1192.         fix_config(24, player);
  1193.         return 1;
  1194.     }
  1195.     write_file(filename, "");
  1196.     write_file(filename, "; What is enabled on client when he connects to a server?");
  1197.     write_file(filename, "; 0 = nothing");
  1198.     write_file(filename, "; a = colorchat");
  1199.     write_file(filename, "; b = ljstats");
  1200.     write_file(filename, "; c = speed");
  1201.     write_file(filename, "; Cvar kz_ljs_connectenabler (default ^"abc^")");
  1202.     if( server_settings[player][24][0] )
  1203.         write_file(filename, server_settings[player][24]);
  1204.     else
  1205.     {
  1206.         fix_config(25, player);
  1207.         return 1;
  1208.     }
  1209.     write_file(filename, "");
  1210.     write_file(filename, "; Do you want cmds like /speed to be visible in the chat?");
  1211.     write_file(filename, "; Cvar kz_ljs_viscmds (default ^"1^")");
  1212.     if( server_settings[player][25][0] )
  1213.         write_file(filename, server_settings[player][25][0]);
  1214.     else
  1215.     {
  1216.         fix_config(26, player);
  1217.         return 1;
  1218.     }
  1219.     write_file(filename, "");
  1220.     write_file(filename, "; Speedometer type");
  1221.     write_file(filename, "; 0 = show real speed and horizontal speed");
  1222.     write_file(filename, "; 1 = show real speed");
  1223.     write_file(filename, "; 2 = show horizontal speed");
  1224.     write_file(filename, "; Cvar kz_ljs_speedtype (default ^"0^")");
  1225.     if( server_settings[player][26][0] )
  1226.         write_file(filename, server_settings[player][26]);
  1227.     else
  1228.     {
  1229.         fix_config(27, player);
  1230.         return 1;
  1231.     }
  1232.    
  1233.     return 1;
  1234. }
  1235.  
  1236. public fix_config(fix_since, player)
  1237. {
  1238.     static configsDir[64], filename[128];
  1239.     get_configsdir(configsDir, 63);
  1240.     format(filename, 127, "%s/ljstats.ini", configsDir);
  1241.    
  1242.     if( !(fix_since < 2) )
  1243.     {
  1244.         log_amx("LjS: Error: Settings that gows before #%d in <^"%s^"> cold be incurrent!", (fix_since+1), filename);
  1245.         log_amx("LjS: All other settings are setted by default. Please check the config file!");
  1246.     }
  1247.     else
  1248.     {
  1249.         log_amx("LjS: Error: Configuration file <^"%s^"> is not currect!", filename);
  1250.         log_amx("LjS: All settings are setted by default.");
  1251.        
  1252.         server_settings[player][0] = "1";
  1253.         write_file(filename, "1");
  1254.         write_file(filename, "");
  1255.         write_file(filename, "; Maximum possible lj (not 4 cj)");
  1256.         write_file(filename, "; Cvar kz_max_lj (default ^"260.0^")");
  1257.     }
  1258.     if( fix_since < 3 )
  1259.     {
  1260.         server_settings[player][1] = "260.0";
  1261.         write_file(filename, "260.0");
  1262.         write_file(filename, "");
  1263.         write_file(filename, "; 1337 lj (prints to all players)");
  1264.         write_file(filename, "; To disable, set it to -1");
  1265.         write_file(filename, "; Cvar kz_leet_lj (default ^"250.0^")");
  1266.     }
  1267.     if( fix_since < 4 )
  1268.     {
  1269.         server_settings[player][2] = "250.0";
  1270.         write_file(filename, "250.0");
  1271.         write_file(filename, "");
  1272.         write_file(filename, "; Professional lj (prints to all players)");
  1273.         write_file(filename, "; To disable, set it to -1");
  1274.         write_file(filename, "; Cvar kz_pro_lj (default ^"245.0^")");
  1275.     }
  1276.     if( fix_since < 5 )
  1277.     {
  1278.         server_settings[player][3] = "245.0";
  1279.         write_file(filename, "245.0");
  1280.         write_file(filename, "");
  1281.         write_file(filename, "; Good lj (prints to all players)");
  1282.         write_file(filename, "; To disable, set it to -1");
  1283.         write_file(filename, "; Cvar kz_good_lj (default ^"240.0^")");
  1284.     }
  1285.     if( fix_since < 6 )
  1286.     {
  1287.         server_settings[player][4] = "240.0";
  1288.         write_file(filename, "240.0");
  1289.         write_file(filename, "");
  1290.         write_file(filename, "; Minimal lj distance");
  1291.         write_file(filename, "; Cvar kz_min_lj (default ^"215.0^")");
  1292.     }
  1293.     if( fix_since < 7 )
  1294.     {
  1295.         server_settings[player][5] = "215.0";
  1296.         write_file(filename, "215.0");
  1297.         write_file(filename, "");
  1298.         write_file(filename, "; Difrence between longjump and countjump for good/pro/leet/max jump");
  1299.         write_file(filename, "; Cvar kz_cj_dif (default ^"10.0^")");
  1300.     }
  1301.     if( fix_since < 8 )
  1302.     {
  1303.         server_settings[player][6] = "10.0";
  1304.         write_file(filename, "10.0");
  1305.         write_file(filename, "");
  1306.         write_file(filename, "; Enables lj sounds");
  1307.         write_file(filename, "; 0 = disabled");
  1308.         write_file(filename, "; 1 = ultimate sounds");
  1309.         write_file(filename, "; 2 = distance in voice");
  1310.         write_file(filename, "; Cvar kz_lj_sounds (default ^"1^")");
  1311.     }
  1312.     if( fix_since < 9 )
  1313.     {
  1314.         server_settings[player][7] = "1";
  1315.         write_file(filename, "1");
  1316.         write_file(filename, "");
  1317.         write_file(filename, "; How dose plugin works");
  1318.         write_file(filename, "; 0 = no top and no colorchat");
  1319.         write_file(filename, "; 1 = prints good/pro/leet jumps");
  1320.         write_file(filename, "; 2 = enables top10");
  1321.         write_file(filename, "; 3 = prints good/pro/leet jumps and enables top10");
  1322.         write_file(filename, "; Cvar kz_lj_top (default ^"3^")");
  1323.     }
  1324.     if( fix_since < 10 )
  1325.     {
  1326.         server_settings[player][8] = "3";
  1327.         write_file(filename, "3");
  1328.         write_file(filename, "");
  1329.         write_file(filename, "; Do you want to save ljtop after mapchange?");
  1330.         write_file(filename, "; Cvar kz_ljs_topsave (default ^"1^")");
  1331.     }
  1332.     if( fix_since < 11 )
  1333.     {
  1334.         server_settings[player][9] = "1";
  1335.         write_file(filename, "1");
  1336.         write_file(filename, "");
  1337.         write_file(filename, "; How ranking will work?");
  1338.         write_file(filename, "; 0 = names");
  1339.         write_file(filename, "; 1 = steam ids");
  1340.         write_file(filename, "; 2 = ips");
  1341.         write_file(filename, "; Cvar kz_ljs_rank_by (default ^"0^")");
  1342.     }
  1343.     if( fix_since < 12 )
  1344.     {
  1345.         server_settings[player][10] = "0";
  1346.         write_file(filename, "0");
  1347.         write_file(filename, "");
  1348.         write_file(filename, "; Kz jumping color chat:");
  1349.         write_file(filename, "; 0 = normal");
  1350.         write_file(filename, "; 1 = red");
  1351.         write_file(filename, "; 2 = green");
  1352.         write_file(filename, "; 3 = blue");
  1353.         write_file(filename, "; 4 = silver");
  1354.         write_file(filename, "; 5 = team color");
  1355.         write_file(filename, "");
  1356.         write_file(filename, "; Cvar kz_leet_lj_clr (default ^"1^")");
  1357.     }
  1358.     if( fix_since < 13 )
  1359.     {
  1360.         server_settings[player][11] = "1";
  1361.         write_file(filename, "1");
  1362.         write_file(filename, "; Cvar kz_pro_lj_clr (default ^"2^")");
  1363.     }
  1364.     if( fix_since < 14 )
  1365.     {
  1366.         server_settings[player][12] = "2";
  1367.         write_file(filename, "2");
  1368.         write_file(filename, "; Cvar kz_good_lj_clr (default ^"4^")");
  1369.     }
  1370.     if( fix_since < 15 )
  1371.     {
  1372.         server_settings[player][13] = "4";
  1373.         write_file(filename, "4");
  1374.         write_file(filename, "");
  1375.         write_file(filename, "; Cvar kz_leet_cj_clr (default ^"1^")");
  1376.     }
  1377.     if( fix_since < 16 )
  1378.     {
  1379.         server_settings[player][14] = "1";
  1380.         write_file(filename, "1");
  1381.         write_file(filename, "; Cvar kz_pro_cj_clr (default ^"2^")");
  1382.     }
  1383.     if( fix_since < 17 )
  1384.     {
  1385.         server_settings[player][15] = "2";
  1386.         write_file(filename, "2");
  1387.         write_file(filename, "; Cvar kz_good_cj_clr (default ^"4^")");
  1388.     }
  1389.     if( fix_since < 18 )
  1390.     {
  1391.         server_settings[player][16] = "4";
  1392.         write_file(filename, "4");
  1393.         write_file(filename, "");
  1394.         write_file(filename, "; Colors of /ljstats (rrr ggg bbb)");
  1395.         write_file(filename, "; Cvar kz_ljstats_red (default ^"0^")");
  1396.     }
  1397.     if( fix_since < 19 )
  1398.     {
  1399.         server_settings[player][17] = "0";
  1400.         write_file(filename, "0");
  1401.         write_file(filename, "; Cvar kz_ljstats_green (default ^"255^")");
  1402.     }
  1403.     if( fix_since < 20 )
  1404.     {
  1405.         server_settings[player][18] = "255";
  1406.         write_file(filename, "255");
  1407.         write_file(filename, "; Cvar kz_ljstats_blue (^"159^")");
  1408.     }
  1409.     if( fix_since < 21 )
  1410.     {
  1411.         server_settings[player][19] = "159";
  1412.         write_file(filename, "159");
  1413.         write_file(filename, "");
  1414.         write_file(filename, "; LongJump Stats Laser Beam");
  1415.         write_file(filename, "; 0 = off");
  1416.         write_file(filename, "; 1 = normal");
  1417.         write_file(filename, "; 2 = uber beam");
  1418.         write_file(filename, "; Cvar kz_ljs_beam (default ^"2^")");
  1419.     }
  1420.     if( fix_since < 22 )
  1421.     {
  1422.         server_settings[player][20] = "2";
  1423.         write_file(filename, "2");
  1424.         write_file(filename, "");
  1425.         write_file(filename, "; Enables protection 4 legal kreedz settings");
  1426.         write_file(filename, "; Cvar kz_legal_settings (default ^"1^")");
  1427.     }
  1428.     if( fix_since < 23 )
  1429.     {
  1430.         server_settings[player][21] = "1";
  1431.         write_file(filename, "1");
  1432.         write_file(filename, "");
  1433.         write_file(filename, "; Is your server fast?");
  1434.         write_file(filename, "; 0 = slow");
  1435.         write_file(filename, "; 1 = normal");
  1436.         write_file(filename, "; 2 = realy good ( >10mb/s or localhost/lan server )");
  1437.         write_file(filename, "; Cvar kz_ljs_fastserver (default ^"2^")");
  1438.     }
  1439.     if( fix_since < 24 )
  1440.     {
  1441.         server_settings[player][22] = "2";
  1442.         write_file(filename, "2");
  1443.         write_file(filename, "");
  1444.         write_file(filename, "; Enables auto-setting 4 kz_ljs_fastserver cvar if it is 2");
  1445.         write_file(filename, "; Cvar kz_ljs_autoserver (default ^"1^")");
  1446.     }
  1447.     if( fix_since < 25 )
  1448.     {
  1449.         server_settings[player][23] = "1";
  1450.         write_file(filename, "1");
  1451.         write_file(filename, "");
  1452.         write_file(filename, "; What is enabled on client when he connects to a server?");
  1453.         write_file(filename, "; 0 = nothing");
  1454.         write_file(filename, "; a = colorchat");
  1455.         write_file(filename, "; b = ljstats");
  1456.         write_file(filename, "; c = speed");
  1457.         write_file(filename, "; Cvar kz_ljs_connectenabler (default ^"abc^")");
  1458.     }
  1459.     if( fix_since < 26 )
  1460.     {
  1461.         server_settings[player][24] = "abc";
  1462.         write_file(filename, "abc");
  1463.         write_file(filename, "");
  1464.         write_file(filename, "; Do you want cmds like /speed to be visible in the chat?");
  1465.         write_file(filename, "; Cvar kz_ljs_viscmds (default ^"1^")");
  1466.     }
  1467.     if( fix_since < 27 )
  1468.     {
  1469.         server_settings[player][25] = "1";
  1470.         write_file(filename, "1");
  1471.         write_file(filename, "");
  1472.         write_file(filename, "; Speedometer type");
  1473.         write_file(filename, "; 0 = show real speed and horizontal speed");
  1474.         write_file(filename, "; 1 = show real speed");
  1475.         write_file(filename, "; 2 = show horizontal speed");
  1476.         write_file(filename, "; Cvar kz_ljs_speedtype (default ^"0^")");
  1477.     }
  1478.     if( fix_since < 28 )
  1479.     {
  1480.         server_settings[player][26] = "0";
  1481.         write_file(filename, "0");
  1482.     }
  1483. }
  1484.  
  1485. public plugin_cfg()
  1486. {
  1487.     if( get_pcvar_num(kz_legal_settings) )
  1488.     {
  1489.         set_cvar_string("edgefriction", "2");
  1490.         set_cvar_string("mp_footsteps", "1");
  1491.         set_cvar_string("sv_cheats", "0");
  1492.         set_cvar_string("sv_gravity", "800");
  1493.         set_cvar_string("sv_airaccelerate", "10");
  1494.         set_cvar_string("sv_maxspeed", "320");
  1495.         set_cvar_string("sv_stepsize", "18");
  1496.         set_cvar_string("sv_maxvelocity", "2000");
  1497.     }
  1498. }
  1499.  
  1500. public plugin_precache()
  1501. {
  1502.     plugin_start();
  1503.    
  1504.     switch(random_num(1,6))
  1505.     {
  1506.         case 1: gBeam = precache_model("sprites/zbeam1.spr");
  1507.         case 2: gBeam = precache_model("sprites/zbeam2.spr");
  1508.         case 3: gBeam = precache_model("sprites/zbeam3.spr");
  1509.         case 4: gBeam = precache_model("sprites/zbeam4.spr");
  1510.         case 5: gBeam = precache_model("sprites/zbeam5.spr");
  1511.         case 6: gBeam = precache_model("sprites/zbeam6.spr");
  1512.     }
  1513.    
  1514.     if( get_pcvar_num(kz_lj_sounds) == 1 )
  1515.     {
  1516.         precache_sound("misc/impressive.wav");
  1517.         precache_sound("misc/mod_godlike.wav");
  1518.         precache_sound("misc/mod_wickedsick.wav");
  1519.         precache_sound("misc/perfect.wav");
  1520.     }
  1521.    
  1522.     if( get_pcvar_num(kz_ljs_enabled) )
  1523.         pluginstatus = INFO_ONE;
  1524.     else
  1525.         pluginstatus = INFO_ZERO;
  1526. }
  1527.  
  1528. public cmdTopMenu(id)
  1529. {
  1530.     new plugin_cvar = get_pcvar_num(kz_ljs_enabled);
  1531.     new ljtop_cvar = get_pcvar_num(kz_ljs_tops);
  1532.    
  1533.     if( plugin_cvar && (ljtop_cvar == 2 || ljtop_cvar == 3) )
  1534.     {
  1535.         new MenuBody[512], len, keys;
  1536.         len = format(MenuBody, 511, "\yTop 10 Menu^n");
  1537.  
  1538.         if( map_distance[0] )
  1539.         {      
  1540.             len += format(MenuBody[len], 511-len, "^n\r1. \wMap Top");
  1541.             keys = (1<<0);
  1542.         }
  1543.         else
  1544.             len += format(MenuBody[len], 511-len, "^n\r1. \dMap Top (no jumps)");
  1545.  
  1546.         if( lj_distance[0] )
  1547.         {
  1548.             len += format(MenuBody[len], 511-len, "^n\r2. \wLongJump Top");
  1549.             keys |= (1<<1);
  1550.         }
  1551.         else
  1552.             len += format(MenuBody[len], 511-len, "^n\r2. \dLongJump (no ljs)");
  1553.  
  1554.         if( cj_distance[0] )
  1555.         {
  1556.             len += format(MenuBody[len], 511-len, "^n\r3. \wCountJump Top");
  1557.             keys |= (1<<2);
  1558.         }
  1559.         else
  1560.             len += format(MenuBody[len], 511-len, "^n\r3. \dCountJump (no cjs)");
  1561.  
  1562.         if( bj_distance[0] )
  1563.         {
  1564.             len += format(MenuBody[len], 511-len, "^n\r4. \wBhopJump Top");
  1565.             keys |= (1<<3);
  1566.         }
  1567.         else
  1568.             len += format(MenuBody[len], 511-len, "^n\r4. \dBhopJump Top (no bjs)");
  1569.  
  1570.         if( sbj_distance[0] )
  1571.         {
  1572.             len += format(MenuBody[len], 511-len, "^n\r5. \wStand-upBhopJump Top");
  1573.             keys |= (1<<4);
  1574.         }
  1575.         else
  1576.             len += format(MenuBody[len], 511-len, "^n\r5. \dStand-upBhopJump Top (no sbjs)");
  1577.        
  1578.         if( wj_distance[0] )
  1579.         {
  1580.             len += format(MenuBody[len], 511-len, "^n\r6. \wWeirdJump Top");
  1581.             keys |= (1<<5);
  1582.         }
  1583.         else
  1584.             len += format(MenuBody[len], 511-len, "^n\r6. \dWeirdJump Top (no wjs)");
  1585. #if defined JOKES
  1586.         len += format(MenuBody[len], 511-len, "^n\r7. \dPlace for your advertising");
  1587.         keys |= (1<<6);
  1588.         len += format(MenuBody[len], 511-len, "^n\r8. \dPlace for your advertising");
  1589.         keys |= (1<<7);
  1590.         len += format(MenuBody[len], 511-len, "^n\r9. \dPlace for your advertising");
  1591.         keys |= (1<<8);
  1592. #endif
  1593.         len += format(MenuBody[len], 511-len, "^n^n\r0. \wExit");
  1594.         keys |= (1<<9);
  1595.  
  1596.  
  1597.     /*  len += format(MenuBody[len], 511-len, "^n^n^n\yTops full stats^n");
  1598.         len += format(MenuBody[len], 511-len, "^n\r5. \wTotal top stats");
  1599.         keys |= (1<<4);
  1600.  
  1601.         if( lj_distance[0] )
  1602.         {
  1603.             len += format(MenuBody[len], 511-len, "^n\r6. \wLj top stats");
  1604.             keys |= (1<<5);
  1605.         }
  1606.         else
  1607.             len += format(MenuBody[len], 511-len, "^n\r6. \dLj top stats (no ljs)");
  1608.  
  1609.         if( cj_distance[0] )
  1610.         {
  1611.             len += format(MenuBody[len], 511-len, "^n\r7. \wCj top stats");
  1612.             keys |= (1<<6);
  1613.         }
  1614.         else
  1615.             len += format(MenuBody[len], 511-len, "^n\r7. \dCj top stats (no cjs)");
  1616.  
  1617.         if( bj_distance[0] )
  1618.         {
  1619.             len += format(MenuBody[len], 511-len, "^n\r8. \wBj top stats");
  1620.             keys |= (1<<7);
  1621.         }
  1622.         else
  1623.             len += format(MenuBody[len], 511-len, "^n\r8. \dBj top stats (no bjs)");
  1624.            
  1625.         len += format(MenuBody[len], 511-len, "^n^n\r0. \wExit");
  1626.         keys |= (1<<9);
  1627.     */
  1628.         show_menu(id, keys, MenuBody, -1, "Top 10 Menu");
  1629.     }
  1630.     else if( !plugin_cvar )
  1631.         client_print(id, print_chat, "[XJ] Tops are not valid. Plugin has been disabled.");
  1632.     else
  1633.         client_print(id, print_chat, "[XJ] Tops are not valid. Tops have been disabled.");
  1634.    
  1635.     return ( (get_pcvar_num(kz_ljs_viscmds))?PLUGIN_CONTINUE:PLUGIN_HANDLED );
  1636. }
  1637.  
  1638. public MainTopMenu_Select(id, key)
  1639. {
  1640.     new plugin_cvar = get_pcvar_num(kz_ljs_enabled);
  1641.     new ljtop_cvar = get_pcvar_num(kz_ljs_tops);
  1642.    
  1643.     if( plugin_cvar && (ljtop_cvar == 2 || ljtop_cvar == 3) )
  1644.     {
  1645.         switch((key+1))
  1646.         {
  1647.             case 1:
  1648.             {
  1649.                 if( map_distance[0] )
  1650.                 {
  1651.                     show_top(id, TOP_MAP);
  1652.                     cmdTopMenu(id);
  1653.                 }
  1654.                 else
  1655.                     cmdTopMenu(id);
  1656.             }
  1657.             case 2:
  1658.             {
  1659.                 if( lj_distance[0] )
  1660.                 {
  1661.                     show_top(id, TOP_LJ);
  1662.                     cmdTopMenu(id);
  1663.                 }
  1664.                 else
  1665.                     cmdTopMenu(id);
  1666.             }
  1667.             case 3:
  1668.             {
  1669.                 if( cj_distance[0] )
  1670.                 {
  1671.                     show_top(id, TOP_CJ);
  1672.                     cmdTopMenu(id);
  1673.                 }
  1674.                 else
  1675.                     cmdTopMenu(id);
  1676.             }
  1677.             case 4:
  1678.             {
  1679.                 if( bj_distance[0] )
  1680.                 {
  1681.                     show_top(id, TOP_BJ);
  1682.                     cmdTopMenu(id);
  1683.                 }
  1684.                 else
  1685.                     cmdTopMenu(id);
  1686.             }
  1687.             case 5:
  1688.             {
  1689.                 if( sbj_distance[0] )
  1690.                 {
  1691.                     show_top(id, TOP_SBJ);
  1692.                     cmdTopMenu(id);
  1693.                 }
  1694.                 else
  1695.                     cmdTopMenu(id);
  1696.             }
  1697.             case 6:
  1698.             {
  1699.                 if( wj_distance[0] )
  1700.                 {
  1701.                     show_top(id, TOP_WJ);
  1702.                     cmdTopMenu(id);
  1703.                 }
  1704.                 else
  1705.                     cmdTopMenu(id);
  1706.             }
  1707. #if defined JOKES
  1708.             case 7:
  1709.             {
  1710.                 client_print(id, print_chat, "[XJ] It`s a joke :D ");
  1711.             }
  1712.             case 8:
  1713.             {
  1714.                 client_print(id, print_chat, "[XJ] It`s a joke :D ");
  1715.             }
  1716.             case 9:
  1717.             {
  1718.                 client_print(id, print_chat, "[XJ] It`s a joke :D ");
  1719.             }
  1720. #endif
  1721.  
  1722. /*
  1723.             case 5:
  1724.             {
  1725.                 if( top_distance[0] )
  1726.                     display_full_top_stats_menu(id, TOP_MAP, 0);
  1727.                 else
  1728.                     cmdTopMenu(id);
  1729.             }
  1730.             case 6:
  1731.             {
  1732.                 if( lj_distance[0] )
  1733.                     display_full_top_stats_menu(id, TOP_LJ, 0);
  1734.                 else
  1735.                     cmdTopMenu(id);
  1736.             }
  1737.             case 7:
  1738.             {
  1739.                 if( cj_distance[0] )
  1740.                     display_full_top_stats_menu(id, TOP_CJ, 0);
  1741.                 else
  1742.                     cmdTopMenu(id);
  1743.             }
  1744.             case 8:
  1745.             {
  1746.                 if( bj_distance[0] )
  1747.                     display_full_top_stats_menu(id, TOP_BJ, 0);
  1748.                 else
  1749.                     cmdTopMenu(id);
  1750.             }
  1751. */
  1752.         }
  1753.     }
  1754.     else if( !plugin_cvar )
  1755.         client_print(id, print_chat, "[XJ] Tops are not valid. Plugin has been disabled.");
  1756.     else
  1757.         client_print(id, print_chat, "[XJ] Tops are not valid. Tops have been disabled.");
  1758.    
  1759.     return PLUGIN_HANDLED;
  1760. }
  1761.  
  1762. public display_full_top_stats_menu(id, toptype, page)
  1763. {
  1764.     full_top_stats_selected_type[id] = toptype;
  1765.     full_top_stats_selected_page[id] = page;
  1766.  
  1767.     new i, MenuBody[512], len, keys;
  1768.    
  1769.     if( toptype == 3 )
  1770.     {
  1771.         if( page == 2 )
  1772.         {
  1773.             len = format(MenuBody, 511, "\yFull bj top stats \r2/2^n");
  1774.             for( i = INFO_ZERO; i < NSHOW; i++ )
  1775.             {
  1776.                 format( view_names[id][i], 32, bj_names[i] );
  1777.                 view_distance[id][i] = bj_distance[i];
  1778.                 view_maxspeed[id][i] = bj_maxspeed[i];
  1779.                 view_prestrafe[id][i] = bj_prestrafe[i];
  1780.                 view_strafes[id][i] = bj_strafes[i];
  1781.                 view_sync[id][i] = bj_sync[i];
  1782.                 view_type[id][i] = "";
  1783.                 format( view_pretype[id][i], 31, bj_pretype[i] );
  1784.                 if( i > 4 )
  1785.                 {
  1786.                     len += format(MenuBody[len], 511-len, "^n\r%d. \y%d. \w%s \r%d", (i-4), (i+1), view_names[id][i], (view_distance[id][i]/1000000));
  1787.                     if( (i-5) )
  1788.                         keys |= (1<<(i-5));
  1789.                     else
  1790.                         keys = (1<<0);
  1791.                 }
  1792.             }
  1793.             len += format(MenuBody[len], 511-len, "^n^n\r9. \wBack");
  1794.             keys |= (1<<8);
  1795.         }
  1796.         else if( page )
  1797.         {
  1798.             len = format(MenuBody, 511, "\yFull bj top stats \r1/2^n");
  1799.             for( i = INFO_ZERO; i < 5; i++ )
  1800.             {
  1801.                 format( view_names[id][i], 32, bj_names[i] );
  1802.                 view_distance[id][i] = bj_distance[i];
  1803.                 view_maxspeed[id][i] = bj_maxspeed[i];
  1804.                 view_prestrafe[id][i] = bj_prestrafe[i];
  1805.                 view_strafes[id][i] = bj_strafes[i];
  1806.                 view_sync[id][i] = bj_sync[i];
  1807.                 view_type[id][i] = "";
  1808.                 format( view_pretype[id][i], 31, bj_pretype[i] );
  1809.                 len += format(MenuBody[len], 511-len, "^n\r%d. \y%d. \w%s \r%d", (i+1), (i+1), view_names[id][i], (view_distance[id][i]/1000000));
  1810.                 if( i )
  1811.                     keys |= (1<<i);
  1812.                 else
  1813.                     keys = (1<<0);
  1814.             }
  1815.             len += format(MenuBody[len], 511-len, "^n^n\r9. \wNext");
  1816.             keys |= (1<<8);
  1817.         }
  1818.         else
  1819.         {
  1820.             len = format(MenuBody, 511, "\yFull bj top stats \r1/1^n");
  1821.             if( bj_distance[9] )
  1822.             {
  1823.                 display_full_top_stats_menu(id, toptype, 1);
  1824.                 return;
  1825.             }
  1826.            
  1827.             new limit;
  1828.             for( limit = INFO_ZERO; limit < NSHOW; limit++ )
  1829.             {
  1830.                 if( !bj_distance[limit] )
  1831.                     break;
  1832.             }
  1833.            
  1834.             if( limit == 1 )
  1835.             {
  1836.                 format( view_names[id][0], 32, bj_names[0] );
  1837.                 view_distance[id][0] = bj_distance[0];
  1838.                 view_maxspeed[id][0] = bj_maxspeed[0];
  1839.                 view_prestrafe[id][0] = bj_prestrafe[0];
  1840.                 view_strafes[id][0] = bj_strafes[0];
  1841.                 view_sync[id][0] = bj_sync[0];
  1842.                 view_type[id][0] = "";
  1843.                 format( view_pretype[id][0], 31, bj_pretype[0] );
  1844.                 len += format(MenuBody[len], 511-len, "^n\r1. \y1. \w%s \r%d", view_names[id][0], (view_distance[id][0]/1000000));
  1845.                 keys = (1<<0);
  1846.             }
  1847.             else
  1848.             {
  1849.                 for( i = INFO_ZERO; i < limit; i++ )
  1850.                 {
  1851.                     format( view_names[id][i], 32, bj_names[i] );
  1852.                     view_distance[id][i] = bj_distance[i];
  1853.                     view_maxspeed[id][i] = bj_maxspeed[i];
  1854.                     view_prestrafe[id][i] = bj_prestrafe[i];
  1855.                     view_strafes[id][i] = bj_strafes[i];
  1856.                     view_sync[id][i] = bj_sync[i];
  1857.                     view_type[id][i] = "";
  1858.                     format( view_pretype[id][i], 31, bj_pretype[i] );
  1859.                     len += format(MenuBody[len], 511-len, "^n\r%d. \y%d. \w%s \r%d", (i+1), (i+1), view_names[id][i], (view_distance[id][i]/1000000));
  1860.                     if( i )
  1861.                         keys |= (1<<i);
  1862.                     else
  1863.                         keys = (1<<0);
  1864.                 }
  1865.             }
  1866.         }
  1867.     }
  1868.     else if( toptype == 2 )
  1869.     {
  1870.         if( page == 2 )
  1871.         {
  1872.             len = format(MenuBody, 511, "\yFull cj top stats \r2/2^n");
  1873.             for( i = INFO_ZERO; i < NSHOW; i++ )
  1874.             {
  1875.                 format( view_names[id][i], 32, cj_names[i] );
  1876.                 view_distance[id][i] = cj_distance[i];
  1877.                 view_maxspeed[id][i] = cj_maxspeed[i];
  1878.                 view_prestrafe[id][i] = cj_prestrafe[i];
  1879.                 view_strafes[id][i] = cj_strafes[i];
  1880.                 view_sync[id][i] = cj_sync[i];
  1881.                 view_type[id][i] = "";
  1882.                 format( view_pretype[id][i], 31, cj_pretype[i] );
  1883.                 if( i > 4 )
  1884.                 {
  1885.                     len += format(MenuBody[len], 511-len, "^n\r%d. \y%d. \w%s \r%d", (i-4), (i+1), view_names[id][i], (view_distance[id][i]/1000000));
  1886.                     if( (i-5) )
  1887.                         keys |= (1<<(i-5));
  1888.                     else
  1889.                         keys = (1<<0);
  1890.                 }
  1891.             }
  1892.             len += format(MenuBody[len], 511-len, "^n^n\r9. \wBack");
  1893.             keys |= (1<<8);
  1894.         }
  1895.         else if( page )
  1896.         {
  1897.             len = format(MenuBody, 511, "\yFull cj top stats \r1/2^n");
  1898.             for( i = INFO_ZERO; i < 5; i++ )
  1899.             {
  1900.                 format( view_names[id][i], 32, cj_names[i] );
  1901.                 view_distance[id][i] = cj_distance[i];
  1902.                 view_maxspeed[id][i] = cj_maxspeed[i];
  1903.                 view_prestrafe[id][i] = cj_prestrafe[i];
  1904.                 view_strafes[id][i] = cj_strafes[i];
  1905.                 view_sync[id][i] = cj_sync[i];
  1906.                 view_type[id][i] = "";
  1907.                 format( view_pretype[id][i], 31, cj_pretype[i] );
  1908.                 len += format(MenuBody[len], 511-len, "^n\r%d. \y%d. \w%s \r%d", (i+1), (i+1), view_names[id][i], (view_distance[id][i]/1000000));
  1909.                 if( i )
  1910.                     keys |= (1<<i);
  1911.                 else
  1912.                     keys = (1<<0);
  1913.             }
  1914.             len += format(MenuBody[len], 511-len, "^n^n\r9. \wNext");
  1915.             keys |= (1<<8);
  1916.         }
  1917.         else
  1918.         {
  1919.             len = format(MenuBody, 511, "\yFull cj top stats \r1/1^n");
  1920.             if( cj_distance[9] )
  1921.             {
  1922.                 display_full_top_stats_menu(id, toptype, 1);
  1923.                 return;
  1924.             }
  1925.            
  1926.             new limit;
  1927.             for( limit = INFO_ZERO; limit < NSHOW; limit++ )
  1928.             {
  1929.                 if( !cj_distance[limit] )
  1930.                     break;
  1931.             }
  1932.            
  1933.             if( limit == 1 )
  1934.             {
  1935.                 format( view_names[id][0], 32, cj_names[0] );
  1936.                 view_distance[id][0] = cj_distance[0];
  1937.                 view_maxspeed[id][0] = cj_maxspeed[0];
  1938.                 view_prestrafe[id][0] = cj_prestrafe[0];
  1939.                 view_strafes[id][0] = cj_strafes[0];
  1940.                 view_sync[id][0] = cj_sync[0];
  1941.                 view_type[id][0] = "";
  1942.                 format( view_pretype[id][0], 31, cj_pretype[0] );
  1943.                 len += format(MenuBody[len], 511-len, "^n\r1. \y1. \w%s \r%d", view_names[id][0], (view_distance[id][0]/1000000));
  1944.                 keys = (1<<0);
  1945.             }
  1946.             else
  1947.             {
  1948.                 for( i = INFO_ZERO; i < limit; i++ )
  1949.                 {
  1950.                     format( view_names[id][i], 32, cj_names[i] );
  1951.                     view_distance[id][i] = cj_distance[i];
  1952.                     view_maxspeed[id][i] = cj_maxspeed[i];
  1953.                     view_prestrafe[id][i] = cj_prestrafe[i];
  1954.                     view_strafes[id][i] = cj_strafes[i];
  1955.                     view_sync[id][i] = cj_sync[i];
  1956.                     view_type[id][i] = "";
  1957.                     format( view_pretype[id][i], 31, cj_pretype[i] );
  1958.                     len += format(MenuBody[len], 511-len, "^n\r%d. \y%d. \w%s \r%d", (i+1), (i+1), view_names[id][i], (view_distance[id][i]/1000000));
  1959.                     if( i )
  1960.                         keys |= (1<<i);
  1961.                     else
  1962.                         keys = (1<<0);
  1963.                 }
  1964.             }
  1965.         }
  1966.     }
  1967.     else if( toptype )
  1968.     {
  1969.         if( page == 2 )
  1970.         {
  1971.             len = format(MenuBody, 511, "\yFull lj top stats \r2/2^n");
  1972.             for( i = INFO_ZERO; i < NSHOW; i++ )
  1973.             {
  1974.                 format( view_names[id][i], 32, lj_names[i] );
  1975.                 view_distance[id][i] = lj_distance[i];
  1976.                 view_maxspeed[id][i] = lj_maxspeed[i];
  1977.                 view_prestrafe[id][i] = lj_prestrafe[i];
  1978.                 view_strafes[id][i] = lj_strafes[i];
  1979.                 view_sync[id][i] = lj_sync[i];
  1980.                 view_type[id][i] = "";
  1981.                 format( view_pretype[id][i], 31, lj_pretype[i] );
  1982.                 if( i > 4 )
  1983.                 {
  1984.                     len += format(MenuBody[len], 511-len, "^n\r%d. \y%d. \w%s \r%d", (i-4), (i+1), view_names[id][i], (view_distance[id][i]/1000000));
  1985.                     if( (i-5) )
  1986.                         keys |= (1<<(i-5));
  1987.                     else
  1988.                         keys = (1<<0);
  1989.                 }
  1990.             }
  1991.             len += format(MenuBody[len], 511-len, "^n^n\r9. \wBack");
  1992.             keys |= (1<<8);
  1993.         }
  1994.         else if( page )
  1995.         {
  1996.             len = format(MenuBody, 511, "\yFull lj top stats \r1/2^n");
  1997.             for( i = INFO_ZERO; i < 5; i++ )
  1998.             {
  1999.                 format( view_names[id][i], 32, lj_names[i] );
  2000.                 view_distance[id][i] = lj_distance[i];
  2001.                 view_maxspeed[id][i] = lj_maxspeed[i];
  2002.                 view_prestrafe[id][i] = lj_prestrafe[i];
  2003.                 view_strafes[id][i] = lj_strafes[i];
  2004.                 view_sync[id][i] = lj_sync[i];
  2005.                 view_type[id][i] = "";
  2006.                 format( view_pretype[id][i], 31, lj_pretype[i] );
  2007.                 len += format(MenuBody[len], 511-len, "^n\r%d. \y%d. \w%s \r%d", (i+1), (i+1), view_names[id][i], (view_distance[id][i]/1000000));
  2008.                 if( i )
  2009.                     keys |= (1<<i);
  2010.                 else
  2011.                     keys = (1<<0);
  2012.             }
  2013.             len += format(MenuBody[len], 511-len, "^n^n\r9. \wNext");
  2014.             keys |= (1<<8);
  2015.         }
  2016.         else
  2017.         {
  2018.             len = format(MenuBody, 511, "\yFull lj top stats \r1/1^n");
  2019.             if( lj_distance[9] )
  2020.             {
  2021.                 display_full_top_stats_menu(id, toptype, 1);
  2022.                 return;
  2023.             }
  2024.            
  2025.             new limit;
  2026.             for( limit = INFO_ZERO; limit < NSHOW; limit++ )
  2027.             {
  2028.                 if( !lj_distance[limit] )
  2029.                     break;
  2030.             }
  2031.            
  2032.             if( limit == 1 )
  2033.             {
  2034.                 format( view_names[id][0], 32, lj_names[0] );
  2035.                 view_distance[id][0] = lj_distance[0];
  2036.                 view_maxspeed[id][0] = lj_maxspeed[0];
  2037.                 view_prestrafe[id][0] = lj_prestrafe[0];
  2038.                 view_strafes[id][0] = lj_strafes[0];
  2039.                 view_sync[id][0] = lj_sync[0];
  2040.                 view_type[id][0] = "";
  2041.                 format( view_pretype[id][0], 31, lj_pretype[0] );
  2042.                 len += format(MenuBody[len], 511-len, "^n\r1. \y1. \w%s \r%d", view_names[id][0], (view_distance[id][0]/1000000));
  2043.                 keys = (1<<0);
  2044.             }
  2045.             else
  2046.             {
  2047.                 for( i = INFO_ZERO; i < limit; i++ )
  2048.                 {
  2049.                     format( view_names[id][i], 32, lj_names[i] );
  2050.                     view_distance[id][i] = lj_distance[i];
  2051.                     view_maxspeed[id][i] = lj_maxspeed[i];
  2052.                     view_prestrafe[id][i] = lj_prestrafe[i];
  2053.                     view_strafes[id][i] = lj_strafes[i];
  2054.                     view_sync[id][i] = lj_sync[i];
  2055.                     view_type[id][i] = "";
  2056.                     format( view_pretype[id][i], 31, lj_pretype[i] );
  2057.                     len += format(MenuBody[len], 511-len, "^n\r%d. \y%d. \w%s \r%d", (i+1), (i+1), view_names[id][i], (view_distance[id][i]/1000000));
  2058.                     if( i )
  2059.                         keys |= (1<<i);
  2060.                     else
  2061.                         keys = (1<<0);
  2062.                 }
  2063.             }
  2064.         }
  2065.     }
  2066.     else
  2067.     {
  2068.         if( page == 2 )
  2069.         {
  2070.             len = format(MenuBody, 511, "\yFull total top stats \r2/2^n");
  2071.             for( i = INFO_ZERO; i < NSHOW; i++ )
  2072.             {
  2073.                 format( view_names[id][i], 32, top_names[i] );
  2074.                 view_distance[id][i] = top_distance[i];
  2075.                 view_maxspeed[id][i] = top_maxspeed[i];
  2076.                 view_prestrafe[id][i] = top_prestrafe[i];
  2077.                 view_strafes[id][i] = top_strafes[i];
  2078.                 view_sync[id][i] = top_sync[i];
  2079.                 format( view_type[id][i], 4, top_type[i] );
  2080.                 format( view_pretype[id][i], 31, top_pretype[i] );
  2081.                 if( i > 4 )
  2082.                 {
  2083.                     len += format(MenuBody[len], 511-len, "^n\r%d. \y%d. \w%s \r%d \d%s", (i-4), (i+1), view_names[id][i], (view_distance[id][i]/1000000), view_type[id][i]);
  2084.                     if( (i-5) )
  2085.                         keys |= (1<<(i-5));
  2086.                     else
  2087.                         keys = (1<<0);
  2088.                 }
  2089.             }
  2090.             len += format(MenuBody[len], 511-len, "^n^n\r9. \wBack");
  2091.             keys |= (1<<8);
  2092.         }
  2093.         else if( page )
  2094.         {
  2095.             len = format(MenuBody, 511, "\yFull total top stats \r1/2^n");
  2096.             for( i = INFO_ZERO; i < 5; i++ )
  2097.             {
  2098.                 format( view_names[id][i], 32, top_names[i] );
  2099.                 view_distance[id][i] = top_distance[i];
  2100.                 view_maxspeed[id][i] = top_maxspeed[i];
  2101.                 view_prestrafe[id][i] = top_prestrafe[i];
  2102.                 view_strafes[id][i] = top_strafes[i];
  2103.                 view_sync[id][i] = top_sync[i];
  2104.                 format( view_type[id][i], 4, top_type[i] );
  2105.                 format( view_pretype[id][i], 31, top_pretype[i] );
  2106.                 len += format(MenuBody[len], 511-len, "^n\r%d. \y%d. \w%s \r%d \d%s", (i+1), (i+1), view_names[id][i], (view_distance[id][i]/1000000), view_type[id][i]);
  2107.                 if( i )
  2108.                     keys |= (1<<i);
  2109.                 else
  2110.                     keys = (1<<0);
  2111.             }
  2112.             len += format(MenuBody[len], 511-len, "^n^n\r9. \wNext");
  2113.             keys |= (1<<8);
  2114.         }
  2115.         else
  2116.         {
  2117.             len = format(MenuBody, 511, "\yFull total top stats \r1/1^n");
  2118.             if( top_distance[9] )
  2119.             {
  2120.                 display_full_top_stats_menu(id, toptype, 1);
  2121.                 return;
  2122.             }
  2123.            
  2124.             new limit;
  2125.             for( limit = INFO_ZERO; limit < NSHOW; limit++ )
  2126.             {
  2127.                 if( !top_distance[limit] )
  2128.                     break;
  2129.             }
  2130.            
  2131.             if( limit == 1 )
  2132.             {
  2133.                 format( view_names[id][0], 32, top_names[0] );
  2134.                 view_distance[id][0] = top_distance[0];
  2135.                 view_maxspeed[id][0] = top_maxspeed[0];
  2136.                 view_prestrafe[id][0] = top_prestrafe[0];
  2137.                 view_strafes[id][0] = top_strafes[0];
  2138.                 view_sync[id][0] = top_sync[0];
  2139.                 format( view_type[id][0], 4, top_type[0] );
  2140.                 format( view_pretype[id][0], 31, top_pretype[0] );
  2141.                 len += format(MenuBody[len], 511-len, "^n\r1. \y1. \w%s \r%d \d%s", view_names[id][0], (view_distance[id][0]/1000000), view_type[id][0]);
  2142.                 keys = (1<<0);
  2143.             }
  2144.             else
  2145.             {
  2146.                 for( i = INFO_ZERO; i < limit; i++ )
  2147.                 {
  2148.                     format( view_names[id][i], 32, top_names[i] );
  2149.                     view_distance[id][i] = top_distance[i];
  2150.                     view_maxspeed[id][i] = top_maxspeed[i];
  2151.                     view_prestrafe[id][i] = top_prestrafe[i];
  2152.                     view_strafes[id][i] = top_strafes[i];
  2153.                     view_sync[id][i] = top_sync[i];
  2154.                     format( view_type[id][i], 4, top_type[i] );
  2155.                     format( view_pretype[id][i], 31, top_pretype[i] );
  2156.                     len += format(MenuBody[len], 511-len, "^n\r%d. \y%d. \w%s \r%d \d%s", (i+1), (i+1), view_names[id][i], (view_distance[id][i]/1000000), view_type[id][i]);
  2157.                     if( i )
  2158.                         keys |= (1<<i);
  2159.                     else
  2160.                         keys = (1<<0);
  2161.                 }
  2162.             }
  2163.         }
  2164.     }
  2165.     len += format(MenuBody[len], 511-len, "^n^n\r0. \wExit");
  2166.     keys |= (1<<9);
  2167.     show_menu(id, keys, MenuBody, -1, "Full top stats");
  2168. }
  2169.  
  2170. public FullTopMenu_Select(id, key)
  2171. {
  2172.     new target = key, jumpschanged, nofirstjump, i, menu_continue = INFO_ONE, page = full_top_stats_selected_page[id], jumptype = full_top_stats_selected_type[id], ljtops = get_pcvar_num(kz_ljs_tops);
  2173.     key += 1;
  2174.    
  2175.     if( key == 10 )
  2176.         return PLUGIN_HANDLED;
  2177.    
  2178.     if( page == 2 )
  2179.         target += 5;
  2180.    
  2181.     if( !(get_pcvar_num(kz_ljs_enabled) && (ljtops == 2 || ljtops == 3)) )
  2182.     {
  2183.         if( !(ljtops == 2 || ljtops == 3) )
  2184.             client_print(id, print_chat, "[XJ] Tops are not valid. Tops have been disabled.");
  2185.         else
  2186.             client_print(id, print_chat, "[XJ] Tops are not valid. Plugin has been disabled.");
  2187.         return PLUGIN_HANDLED;
  2188.     }
  2189.    
  2190.     for( i = INFO_ZERO; i < 5; i++ )
  2191.     {
  2192.         if( jumptype == 3 )
  2193.         {
  2194.             if( !i && !bj_distance[i] )
  2195.             {
  2196.                 nofirstjump = INFO_ONE;
  2197.                 jumpschanged = INFO_ONE;
  2198.                 break;
  2199.             }
  2200.             else if( !equal(view_names[id][i], bj_names[i])
  2201.             || view_distance[id][i] != bj_distance[i]
  2202.             || view_maxspeed[id][i] != bj_maxspeed[i]
  2203.             || view_prestrafe[id][i] != bj_prestrafe[i]
  2204.             || view_strafes[id][i] != bj_strafes[i]
  2205.             || view_sync[id][i] != bj_sync[i]
  2206.             || !equal(view_pretype[id][i], bj_pretype[i]) )
  2207.             {
  2208.                 jumpschanged = INFO_ONE;
  2209.                 break;
  2210.             }
  2211.         }
  2212.         else if( jumptype == 2 )
  2213.         {
  2214.             if( !i && !cj_distance[i] )
  2215.             {
  2216.                 nofirstjump = INFO_ONE;
  2217.                 jumpschanged = INFO_ONE;
  2218.                 break;
  2219.             }
  2220.             else if( !equal(view_names[id][i], cj_names[i])
  2221.             || view_distance[id][i] != cj_distance[i]
  2222.             || view_maxspeed[id][i] != cj_maxspeed[i]
  2223.             || view_prestrafe[id][i] != cj_prestrafe[i]
  2224.             || view_strafes[id][i] != cj_strafes[i]
  2225.             || view_sync[id][i] != cj_sync[i]
  2226.             || !equal(view_pretype[id][i], cj_pretype[i]) )
  2227.             {
  2228.                 jumpschanged = INFO_ONE;
  2229.                 break;
  2230.             }
  2231.         }
  2232.         else if( jumptype )
  2233.         {
  2234.             if( !i && !lj_distance[i] )
  2235.             {
  2236.                 nofirstjump = INFO_ONE;
  2237.                 jumpschanged = INFO_ONE;
  2238.                 break;
  2239.             }
  2240.             else if( !equal(view_names[id][i], lj_names[i])
  2241.             || view_distance[id][i] != lj_distance[i]
  2242.             || view_maxspeed[id][i] != lj_maxspeed[i]
  2243.             || view_prestrafe[id][i] != lj_prestrafe[i]
  2244.             || view_strafes[id][i] != lj_strafes[i]
  2245.             || view_sync[id][i] != lj_sync[i]
  2246.             || !equal(view_pretype[id][i], lj_pretype[i]) )
  2247.             {
  2248.                 jumpschanged = INFO_ONE;
  2249.                 break;
  2250.             }
  2251.         }
  2252.         else
  2253.         {
  2254.             if( !i && !top_distance[i] )
  2255.             {
  2256.                 nofirstjump = INFO_ONE;
  2257.                 jumpschanged = INFO_ONE;
  2258.                 break;
  2259.             }
  2260.             else if( !equal(view_names[id][i], top_names[i])
  2261.             || view_distance[id][i] != top_distance[i]
  2262.             || view_maxspeed[id][i] != top_maxspeed[i]
  2263.             || view_prestrafe[id][i] != top_prestrafe[i]
  2264.             || view_strafes[id][i] != top_strafes[i]
  2265.             || view_sync[id][i] != top_sync[i]
  2266.             || !equal(view_type[id][i], top_type[i])
  2267.             || !equal(view_pretype[id][i], top_pretype[i]) )
  2268.             {
  2269.                 jumpschanged = INFO_ONE;
  2270.                 break;
  2271.             }
  2272.         }
  2273.     }
  2274.    
  2275.     if( nofirstjump )
  2276.     {
  2277.         if( jumptype == 3 )
  2278.             client_print(id, print_chat, "[XJ] Bj top is not valid. Jumps have been reseted (no bjs).");
  2279.         else if( jumptype == 2 )
  2280.             client_print(id, print_chat, "[XJ] Cj top is not valid. Jumps have been reseted (no cjs).");
  2281.         else if( jumptype )
  2282.             client_print(id, print_chat, "[XJ] Lj top is not valid. Jumps have been reseted (no ljs).");
  2283.         else
  2284.             client_print(id, print_chat, "[XJ] Tops are not valid. Jumps have been reseted (no jumps).");
  2285.         menu_continue = INFO_ZERO;
  2286.     }
  2287.     else if( page && key == 9 )
  2288.     {
  2289.         if( page == 2 )
  2290.             full_top_stats_selected_page[id] = 0;
  2291.         else if( jumpschanged )
  2292.         {
  2293.             if( jumptype == 3 )
  2294.                 client_print(id, print_chat, "[XJ] First 5 bjs have been changed. You are redirected to menu start.");
  2295.             else if( jumptype == 2 )
  2296.                 client_print(id, print_chat, "[XJ] First 5 cjs have been changed. You are redirected to menu start.");
  2297.             else if( jumptype )
  2298.                 client_print(id, print_chat, "[XJ] First 5 ljs have been changed. You are redirected to menu start.");
  2299.             else
  2300.                 client_print(id, print_chat, "[XJ] First 5 jumps have been changed. You are redirected to menu start.");
  2301.             full_top_stats_selected_page[id] = 0;
  2302.         }
  2303.         else
  2304.         {
  2305.             if( jumptype == 3 && bj_distance[9] )
  2306.                 full_top_stats_selected_page[id] = 2;
  2307.             else if( jumptype == 2 && cj_distance[9] )
  2308.                 full_top_stats_selected_page[id] = 2;
  2309.             else if( jumptype && lj_distance[9] )
  2310.                 full_top_stats_selected_page[id] = 2;
  2311.             else if( !jumptype && top_distance[9] )
  2312.                 full_top_stats_selected_page[id] = 2;
  2313.             else
  2314.             {
  2315.                 client_print(id, print_chat, "[XJ] All jumps have been changed. You are redirected to menu start.");
  2316.                 full_top_stats_selected_page[id] = 0;
  2317.             }
  2318.         }
  2319.     }
  2320.     else
  2321.     {
  2322.         if( jumpschanged && page == 2 )
  2323.         {
  2324.             if( jumptype == 3 )
  2325.                 client_print(id, print_chat, "[XJ] First 5 bjs have been changed. You are redirected to menu start.");
  2326.             else if( jumptype == 2 )
  2327.                 client_print(id, print_chat, "[XJ] First 5 cjs have been changed. You are redirected to menu start.");
  2328.             else if( jumptype )
  2329.                 client_print(id, print_chat, "[XJ] First 5 ljs have been changed. You are redirected to menu start.");
  2330.             else
  2331.                 client_print(id, print_chat, "[XJ] First 5 jumps have been changed. You are redirected to menu start.");
  2332.             full_top_stats_selected_page[id] = 0;
  2333.         }
  2334.         else if( page == 2 )
  2335.         {
  2336.             if( jumptype == 3 && bj_distance[9] )
  2337.                 full_top_stats_selected_page[id] = 2;
  2338.             else if( jumptype == 2 && cj_distance[9] )
  2339.                 full_top_stats_selected_page[id] = 2;
  2340.             else if( jumptype && lj_distance[9] )
  2341.                 full_top_stats_selected_page[id] = 2;
  2342.             else if( !jumptype && top_distance[9] )
  2343.                 full_top_stats_selected_page[id] = 2;
  2344.             else
  2345.             {
  2346.                 client_print(id, print_chat, "[XJ] All jumps have been changed. You are redirected to menu start.");
  2347.                 full_top_stats_selected_page[id] = 0;
  2348.             }
  2349.         }
  2350.         else
  2351.             full_top_stats_selected_page[id] = 0;
  2352.     }
  2353.    
  2354.     if( !(page && key == 9) )
  2355.         show_player_stats(id, target, jumptype);
  2356.    
  2357.     if( menu_continue )
  2358.         display_full_top_stats_menu(id, jumptype, full_top_stats_selected_page[id]);
  2359.    
  2360.     return PLUGIN_HANDLED;
  2361. }
  2362.  
  2363. public show_player_stats(id, target, toptype)
  2364. {
  2365.     new buffer[2368], name[131], len, motdname[64];
  2366.     if( toptype == 3 )
  2367.         format(motdname, 63, "%s's bj", view_names[id][target]);
  2368.     else if( toptype == 2 )
  2369.         format(motdname, 63, "%s's cj", view_names[id][target]);
  2370.     else if( toptype )
  2371.         format(motdname, 63, "%s's lj", view_names[id][target]);
  2372.     else
  2373.         format(motdname, 63, "%s's jump", view_names[id][target]);
  2374.    
  2375.     len = format(buffer, 2367, "<body bgcolor=#94AEC6><table width=100%% cellpadding=2 cellspacing=0 border=0>");
  2376.     len += format(buffer[len], 2367-len, "<tr  align=left bgcolor=#52697B><th width=50%%> Info name <th width=50%% align=left> Value");
  2377.    
  2378.     format(name, 31, "%s", view_names[id][target]);
  2379.     while( containi(name, "<") != -1 )
  2380.         replace(name, 129, "<", "&lt;");
  2381.     while( containi(name, ">") != -1 )
  2382.         replace(name, 129, ">", "&gt;");
  2383.    
  2384.     if( toptype == 3 )
  2385.         len += format(buffer[len], 2367-len, "<tr align=left bgcolor=#A4BED6><td> Top type: <td align=left> BhopJump top");
  2386.     else if( toptype == 2 )
  2387.         len += format(buffer[len], 2367-len, "<tr align=left bgcolor=#A4BED6><td> Top type: <td align=left> CountJump top");
  2388.     else if( toptype == 1 )
  2389.         len += format(buffer[len], 2367-len, "<tr align=left bgcolor=#A4BED6><td> Top type: <td align=left> LongJump top");
  2390.     else
  2391.         len += format(buffer[len], 2367-len, "<tr align=left bgcolor=#A4BED6><td> Top type: <td align=left> Total top");
  2392.    
  2393.     len += format(buffer[len], 2367-len, "<tr align=left><td> Position: <td align=left> #%d", (target+1));
  2394.     len += format(buffer[len], 2367-len, "<tr align=left bgcolor=#A4BED6><td> Name: <td align=left> %s", name);
  2395.     len += format(buffer[len], 2367-len, "<tr align=left><td> Distance: <td align=left> %d.%06d", (view_distance[id][target]/1000000), (view_distance[id][target]%1000000));
  2396.     len += format(buffer[len], 2367-len, "<tr align=left bgcolor=#A4BED6><td> TopSpeed: <td align=left> %d.%06d", (view_maxspeed[id][target]/1000000), (view_maxspeed[id][target]%1000000));
  2397.     len += format(buffer[len], 2367-len, "<tr align=left><td> PreStrafe: <td align=left> %d.%06d", (view_prestrafe[id][target]/1000000), (view_prestrafe[id][target]%1000000));
  2398.     len += format(buffer[len], 2367-len, "<tr align=left bgcolor=#A4BED6><td> Strafes: <td align=left> %d", view_strafes[id][target]);
  2399.     len += format(buffer[len], 2367-len, "<tr align=left><td> Sync: <td align=left> %d", view_sync[id][target]);
  2400.     len += format(buffer[len], 2367-len, "<tr align=left bgcolor=#A4BED6><td> PreType: <td align=left> %s", view_pretype[id][target]);
  2401.    
  2402.     if( !toptype ) //TODO bhop?
  2403.         len += format(buffer[len], 2367-len, "<tr align=left><td> Jump Type: <td align=left> %s", (equal(view_type[id][target], "cj")) ? "CountJump" : "LongJump");
  2404.    
  2405.     len += format(buffer[len], 2367-len, "</table></body>");
  2406.    
  2407.     show_motd(id, buffer, motdname);
  2408. }
  2409.  
  2410. public cmdLjsMenu(id)
  2411. {
  2412.     new plugin_cvar = get_pcvar_num(kz_ljs_enabled);
  2413.     new ljtop_cvar = get_pcvar_num(kz_ljs_tops);
  2414.     new MenuBody[512], len, keys;
  2415.     len = format(MenuBody, 511, "\yLongJump Stats Menu^n");
  2416.    
  2417.     if( !plugin_cvar )
  2418.     {
  2419.         len += format(MenuBody[len], 511-len, "^n\r1. \dSwitch colorchat (plugin off)");
  2420.         len += format(MenuBody[len], 511-len, "^n\r2. \dSwitch ljstats (plugin off)");
  2421.         len += format(MenuBody[len], 511-len, "^n\r3. \dSwitch speed (plugin off)");
  2422.         len += format(MenuBody[len], 511-len, "^n\r4. \dView tops (plugin off)");
  2423.     }
  2424.     else
  2425.     {
  2426.         len += format(MenuBody[len], 511-len, "^n\r1. \wSwitch colorchat");
  2427.         len += format(MenuBody[len], 511-len, "^n\r2. \wSwitch ljstats");
  2428.         len += format(MenuBody[len], 511-len, "^n\r3. \wSwitch speed");
  2429.         if( (ljtop_cvar == 2 || ljtop_cvar == 3) && (map_distance[0] || lj_distance[0] || cj_distance[0] || bj_distance[0] || sbj_distance[0]) )
  2430.         {
  2431.             len += format(MenuBody[len], 511-len, "^n^n\r4. \wView tops");
  2432.             keys = (1<<0|1<<1|1<<2|1<<3);
  2433.         }
  2434.         else
  2435.         {
  2436.             if( !(map_distance[0] || lj_distance[0] || cj_distance[0] || bj_distance[0] || sbj_distance[0]) )
  2437.                 len += format(MenuBody[len], 511-len, "^n\r4. \dView tops (no jumps)");
  2438.             else
  2439.                 len += format(MenuBody[len], 511-len, "^n\r4. \dView tops (disabled)");
  2440.             keys = (1<<0|1<<1|1<<2);
  2441.         }
  2442.     }
  2443.    
  2444.     len += format(MenuBody[len], 511-len, "^n^n\r5. \wPrint plugin info");
  2445.     if( !plugin_cvar )
  2446.         keys = (1<<4);
  2447.     else
  2448.         keys |= (1<<4);
  2449.    
  2450.     new flags = get_user_flags(id);
  2451.     if( flags&ADMIN_MENU && (flags&ADMIN_CFG || flags&ADMIN_CVAR) )
  2452.         len += format(MenuBody[len], 511-len, "^n^n^n\rAdmin menu^n");
  2453.    
  2454.     if( flags&ADMIN_MENU )
  2455.     {
  2456.         if( flags&ADMIN_CFG )
  2457.         {
  2458.             len += format(MenuBody[len], 511-len, "^n\r6. \yServer configurations");
  2459.             keys |= (1<<5);
  2460.         }
  2461.        
  2462.         if( flags&ADMIN_CVAR )
  2463.         {
  2464.             len += format(MenuBody[len], 511-len, "^n\r7. \yOne map config");
  2465.             keys |= (1<<6);
  2466.         }
  2467.     }
  2468.    
  2469.     len += format(MenuBody[len], 511-len, "^n^n\r0. \wExit");
  2470.     keys |= (1<<9);
  2471.    
  2472.     show_menu(id, keys, MenuBody, -1, "LongJump Stats Menu");
  2473.    
  2474.     return ( (get_pcvar_num(kz_ljs_viscmds))?PLUGIN_CONTINUE:PLUGIN_HANDLED );
  2475. }
  2476.  
  2477. public LjsMenu_Select(id, key)
  2478. {
  2479.     switch((key+1))
  2480.     {
  2481.         case 1:
  2482.         {
  2483.             if( get_pcvar_num(kz_ljs_enabled) )
  2484.                     cmdColorChat(id);
  2485.             cmdLjsMenu(id);
  2486.         }
  2487.         case 2:
  2488.         {
  2489.             if( get_pcvar_num(kz_ljs_enabled) )
  2490.                 cmdLjStats(id);
  2491.             cmdLjsMenu(id);
  2492.         }
  2493.         case 3:
  2494.         {
  2495.             if( get_pcvar_num(kz_ljs_enabled) )
  2496.                 cmdSpeed(id);
  2497.             cmdLjsMenu(id);
  2498.         }
  2499.         case 4:
  2500.         {
  2501.             if( get_pcvar_num(kz_ljs_enabled) )
  2502.                 cmdTopMenu(id);
  2503.             else
  2504.                 cmdLjsMenu(id);
  2505.         }
  2506.         case 5: cmdVersion(id);
  2507.         case 6:
  2508.         {
  2509.             if( get_user_flags(id)&ADMIN_CFG && get_user_flags(id)&ADMIN_MENU )
  2510.                 ColorChat(id, RED, "[XJ] Comming soon!");
  2511.             else
  2512.                 cmdLjsMenu(id);
  2513.         }
  2514.         case 7:
  2515.         {
  2516.             if( get_user_flags(id)&ADMIN_CVAR && get_user_flags(id)&ADMIN_MENU )
  2517.                 ColorChat(id, BLUE, "[XJ] Comming soon!");
  2518.             else
  2519.                 cmdLjsMenu(id);
  2520.         }
  2521.     }
  2522.     return PLUGIN_HANDLED;
  2523. }
  2524.  
  2525. public read_tops()
  2526. {
  2527.     static lj_filename[128], cj_filename[128], bj_filename[128], sbj_filename[128], wj_filename[128];
  2528.     format(lj_filename, 127, "%s/Top10_lj.dat", ljsDir);
  2529.     format(cj_filename, 127, "%s/Top10_cj.dat", ljsDir);
  2530.     format(bj_filename, 127, "%s/Top10_bj.dat", ljsDir);
  2531.     format(sbj_filename, 127, "%s/Top10_sbj.dat", ljsDir);
  2532.     format(wj_filename, 127, "%s/Top10_wj.dat", ljsDir);
  2533.    
  2534.     static distance[12], maxspeed[12], prestrafe[12], strafes[6], sync[6], line = 0, txtsize = 0, i;
  2535.  
  2536.     line = 0;
  2537.     if( file_exists(wj_filename) )
  2538.     {
  2539.         for( i = INFO_ZERO ; i < NTOP; i++ )
  2540.         {
  2541.             if( (line=read_file(wj_filename,line,wj_names[i],32,txtsize))!=0 )
  2542.             {
  2543.                 if( (line=read_file(wj_filename,line,wj_authid[i],32,txtsize))!=0 )
  2544.                 {
  2545.                     if( (line=read_file(wj_filename,line,distance,11,txtsize))!=0 )
  2546.                     {
  2547.                         if( (line=read_file(wj_filename,line,maxspeed,11,txtsize))!=0 )
  2548.                         {
  2549.                             if( (line=read_file(wj_filename,line,prestrafe,11,txtsize))!=0 )
  2550.                             {
  2551.                                 if( (line=read_file(wj_filename,line,strafes,5,txtsize))!=0 )
  2552.                                 {
  2553.                                     if( (line=read_file(wj_filename,line,sync,5,txtsize))!=0 )
  2554.                                     {
  2555.                                         if( (line=read_file(wj_filename,line,wj_pretype[i],31,txtsize))!=0 )
  2556.                                         {
  2557.                                             wj_distance[i] = str_to_num( distance );
  2558.                                             wj_maxspeed[i] = str_to_num( maxspeed );
  2559.                                             wj_prestrafe[i] = str_to_num( prestrafe );
  2560.                                             wj_strafes[i] = str_to_num( strafes );
  2561.                                             wj_sync[i] = str_to_num( sync );
  2562.                                         }
  2563.                                     }
  2564.                                 }
  2565.                             }
  2566.                         }
  2567.                     }
  2568.                 }
  2569.             }
  2570.             else
  2571.                 break;
  2572.         }
  2573.     }
  2574.  
  2575.     line = 0;
  2576.     if( file_exists(lj_filename) )
  2577.     {
  2578.         for( i = INFO_ZERO ; i < NTOP; i++ )
  2579.         {
  2580.             if( (line=read_file(lj_filename,line,lj_names[i],32,txtsize))!=0 )
  2581.             {
  2582.                 if( (line=read_file(lj_filename,line,lj_authid[i],32,txtsize))!=0 )
  2583.                 {
  2584.                     if( (line=read_file(lj_filename,line,distance,11,txtsize))!=0 )
  2585.                     {
  2586.                         if( (line=read_file(lj_filename,line,maxspeed,11,txtsize))!=0 )
  2587.                         {
  2588.                             if( (line=read_file(lj_filename,line,prestrafe,11,txtsize))!=0 )
  2589.                             {
  2590.                                 if( (line=read_file(lj_filename,line,strafes,5,txtsize))!=0 )
  2591.                                 {
  2592.                                     if( (line=read_file(lj_filename,line,sync,5,txtsize))!=0 )
  2593.                                     {
  2594.                                         if( (line=read_file(lj_filename,line,lj_pretype[i],31,txtsize))!=0 )
  2595.                                         {
  2596.                                             lj_distance[i] = str_to_num( distance );
  2597.                                             lj_maxspeed[i] = str_to_num( maxspeed );
  2598.                                             lj_prestrafe[i] = str_to_num( prestrafe );
  2599.                                             lj_strafes[i] = str_to_num( strafes );
  2600.                                             lj_sync[i] = str_to_num( sync );
  2601.                                         }
  2602.                                     }
  2603.                                 }
  2604.                             }
  2605.                         }
  2606.                     }
  2607.                 }
  2608.             }
  2609.             else
  2610.                 break;
  2611.         }
  2612.     }
  2613.    
  2614.     line = 0;
  2615.     if( file_exists(cj_filename) )
  2616.     {
  2617.         for( i = INFO_ZERO ; i < NTOP; i++ )
  2618.         {
  2619.             if( (line=read_file(cj_filename,line,cj_names[i],32,txtsize))!=0 )
  2620.             {
  2621.                 if( (line=read_file(cj_filename,line,cj_authid[i],32,txtsize))!=0 )
  2622.                 {
  2623.                     if( (line=read_file(cj_filename,line,distance,11,txtsize))!=0 )
  2624.                     {
  2625.                         if( (line=read_file(cj_filename,line,maxspeed,11,txtsize))!=0 )
  2626.                         {
  2627.                             if( (line=read_file(cj_filename,line,prestrafe,11,txtsize))!=0 )
  2628.                             {
  2629.                                 if( (line=read_file(cj_filename,line,strafes,5,txtsize))!=0 )
  2630.                                 {
  2631.                                     if( (line=read_file(cj_filename,line,sync,5,txtsize))!=0 )
  2632.                                     {
  2633.                                         if( (line=read_file(cj_filename,line,cj_pretype[i],31,txtsize))!=0 )
  2634.                                         {
  2635.                                             cj_distance[i] = str_to_num( distance );
  2636.                                             cj_maxspeed[i] = str_to_num( maxspeed );
  2637.                                             cj_prestrafe[i] = str_to_num( prestrafe );
  2638.                                             cj_strafes[i] = str_to_num( strafes );
  2639.                                             cj_sync[i] = str_to_num( sync );
  2640.                                         }
  2641.                                     }
  2642.                                 }
  2643.                             }
  2644.                         }
  2645.                     }
  2646.                 }
  2647.             }
  2648.             else
  2649.                 break;
  2650.         }
  2651.     }
  2652.     line = 0;
  2653.     if( file_exists(bj_filename) )
  2654.     {
  2655.         for( i = INFO_ZERO ; i < NTOP; i++ )
  2656.         {
  2657.             if( (line=read_file(bj_filename,line,bj_names[i],32,txtsize))!=0 )
  2658.             {
  2659.                 if( (line=read_file(bj_filename,line,bj_authid[i],32,txtsize))!=0 )
  2660.                 {
  2661.                     if( (line=read_file(bj_filename,line,distance,11,txtsize))!=0 )
  2662.                     {
  2663.                         if( (line=read_file(bj_filename,line,maxspeed,11,txtsize))!=0 )
  2664.                         {
  2665.                             if( (line=read_file(bj_filename,line,prestrafe,11,txtsize))!=0 )
  2666.                             {
  2667.                                 if( (line=read_file(bj_filename,line,strafes,5,txtsize))!=0 )
  2668.                                 {
  2669.                                     if( (line=read_file(bj_filename,line,sync,5,txtsize))!=0 )
  2670.                                     {
  2671.                                         if( (line=read_file(bj_filename,line,bj_pretype[i],31,txtsize))!=0 )
  2672.                                         {
  2673.                                             bj_distance[i] = str_to_num( distance );
  2674.                                             bj_maxspeed[i] = str_to_num( maxspeed );
  2675.                                             bj_prestrafe[i] = str_to_num( prestrafe );
  2676.                                             bj_strafes[i] = str_to_num( strafes );
  2677.                                             bj_sync[i] = str_to_num( sync );
  2678.                                         }
  2679.                                     }
  2680.                                 }
  2681.                             }
  2682.                         }
  2683.                     }
  2684.                 }
  2685.             }
  2686.             else
  2687.                 break;
  2688.         }
  2689.     }
  2690.  
  2691.     line = 0;
  2692.     if( file_exists(sbj_filename) )
  2693.     {
  2694.         for( i = INFO_ZERO ; i < NTOP; i++ )
  2695.         {
  2696.             if( (line=read_file(sbj_filename,line,sbj_names[i],32,txtsize))!=0 )
  2697.             {
  2698.                 if( (line=read_file(sbj_filename,line,sbj_authid[i],32,txtsize))!=0 )
  2699.                 {
  2700.                     if( (line=read_file(sbj_filename,line,distance,11,txtsize))!=0 )
  2701.                     {
  2702.                         if( (line=read_file(sbj_filename,line,maxspeed,11,txtsize))!=0 )
  2703.                         {
  2704.                             if( (line=read_file(sbj_filename,line,prestrafe,11,txtsize))!=0 )
  2705.                             {
  2706.                                 if( (line=read_file(sbj_filename,line,strafes,5,txtsize))!=0 )
  2707.                                 {
  2708.                                     if( (line=read_file(sbj_filename,line,sync,5,txtsize))!=0 )
  2709.                                     {
  2710.                                         if( (line=read_file(sbj_filename,line,sbj_pretype[i],31,txtsize))!=0 )
  2711.                                         {
  2712.                                             sbj_distance[i] = str_to_num( distance );
  2713.                                             sbj_maxspeed[i] = str_to_num( maxspeed );
  2714.                                             sbj_prestrafe[i] = str_to_num( prestrafe );
  2715.                                             sbj_strafes[i] = str_to_num( strafes );
  2716.                                             sbj_sync[i] = str_to_num( sync );
  2717.                                         }
  2718.                                     }
  2719.                                 }
  2720.                             }
  2721.                         }
  2722.                     }
  2723.                 }
  2724.             }
  2725.             else
  2726.                 break;
  2727.         }
  2728.     }
  2729.     return PLUGIN_HANDLED;
  2730. }
  2731.  
  2732. public topreset(id)
  2733. {
  2734.     if( id == (is_dedicated_server()?0:1) || (get_user_flags(id)&ADMIN_RCON && tops_save) || (get_user_flags(id)&ADMIN_MAP && !tops_save) )
  2735.     {
  2736.         static lj_filename[128], cj_filename[128], bj_filename[128], sbj_filename[128], wj_filename[128];
  2737.         format(lj_filename, 127, "%s/Top10_lj.dat", ljsDir);
  2738.         format(cj_filename, 127, "%s/Top10_cj.dat", ljsDir);
  2739.         format(bj_filename, 127, "%s/Top10_bj.dat", ljsDir);
  2740.         format(sbj_filename, 127, "%s/Top10_sbj.dat", ljsDir);
  2741.         format(wj_filename, 127, "%s/Top10_wj.dat", ljsDir);
  2742.        
  2743.         if( file_exists(lj_filename) && tops_save )
  2744.             delete_file(lj_filename);
  2745.         if( file_exists(cj_filename) && tops_save )
  2746.             delete_file(cj_filename);
  2747.         if( file_exists(bj_filename) && tops_save )
  2748.             delete_file(bj_filename);
  2749.         if( file_exists(sbj_filename) && tops_save )
  2750.             delete_file(sbj_filename);
  2751.         if( file_exists(wj_filename) && tops_save )
  2752.             delete_file(wj_filename);
  2753.        
  2754.         static info_none[33], i;
  2755.         info_none = "";
  2756.         for( i = INFO_ZERO; i < NTOP; i++ )
  2757.         {
  2758.             format( map_names[i], 32, info_none );
  2759.             format( map_authid[i], 32, info_none );
  2760.             map_distance[i] = INFO_ZERO;
  2761.             map_maxspeed[i] = INFO_ZERO;
  2762.             map_prestrafe[i] = INFO_ZERO;
  2763.             map_strafes[i] = INFO_ZERO;
  2764.             map_sync[i] = INFO_ZERO;
  2765.             format( map_type[i], 32, info_none );
  2766.            
  2767.             format( lj_names[i], 32, info_none );
  2768.             format( lj_authid[i], 32, info_none );
  2769.             lj_distance[i] = INFO_ZERO;
  2770.             lj_maxspeed[i] = INFO_ZERO;
  2771.             lj_prestrafe[i] = INFO_ZERO;
  2772.             lj_strafes[i] = INFO_ZERO;
  2773.             lj_sync[i] = INFO_ZERO;
  2774.            
  2775.             format( cj_names[i], 32, info_none );
  2776.             format( cj_authid[i], 32, info_none );
  2777.             cj_distance[i] = INFO_ZERO;
  2778.             cj_maxspeed[i] = INFO_ZERO;
  2779.             cj_prestrafe[i] = INFO_ZERO;
  2780.             cj_strafes[i] = INFO_ZERO;
  2781.             cj_sync[i] = INFO_ZERO;
  2782.  
  2783.             format( bj_names[i], 32, info_none );
  2784.             format( bj_authid[i], 32, info_none );
  2785.             bj_distance[i] = INFO_ZERO;
  2786.             bj_maxspeed[i] = INFO_ZERO;
  2787.             bj_prestrafe[i] = INFO_ZERO;
  2788.             bj_strafes[i] = INFO_ZERO;
  2789.             bj_sync[i] = INFO_ZERO;
  2790.  
  2791.             format( sbj_names[i], 32, info_none );
  2792.             format( sbj_authid[i], 32, info_none );
  2793.             sbj_distance[i] = INFO_ZERO;
  2794.             sbj_maxspeed[i] = INFO_ZERO;
  2795.             sbj_prestrafe[i] = INFO_ZERO;
  2796.             sbj_strafes[i] = INFO_ZERO;
  2797.             sbj_sync[i] = INFO_ZERO;
  2798.  
  2799.             format( wj_names[i], 32, info_none );
  2800.             format( wj_authid[i], 32, info_none );
  2801.             wj_distance[i] = INFO_ZERO;
  2802.             wj_maxspeed[i] = INFO_ZERO;
  2803.             wj_prestrafe[i] = INFO_ZERO;
  2804.             wj_strafes[i] = INFO_ZERO;
  2805.             wj_sync[i] = INFO_ZERO;
  2806.         }
  2807.  
  2808.         static name[32], authid[32];
  2809.         name = "";
  2810.         authid = "";
  2811.         get_user_name( id, name, 31 );
  2812.         if( get_pcvar_num(kz_ljs_rank_by) == 1 )
  2813.             get_user_authid( id, authid ,31 );
  2814.         else
  2815.             get_user_ip( id, authid, 31, 1);
  2816.        
  2817.         log_amx("LjS: ^"%s<%d><%s>^" reseted ljtop", name, get_user_userid(id), authid);
  2818.        
  2819.         console_print(id, "[XJ] LongJump top and rec reseted!");
  2820.         client_print(0, print_chat, "[XJ] LongJump top and rec reseted!");
  2821.     }
  2822.     else
  2823.         console_print(id, "%L", id, "NO_ACC_COM");
  2824.    
  2825.     return PLUGIN_HANDLED;
  2826. }
  2827.  
  2828. public check_maintop(id, Distance, MaxAirSpeed, MaxGroundSpeed, strafes, sync, type)
  2829. {
  2830.     static jumptype[5], editional_top_n, rankby, top_num;
  2831.     rankby = get_pcvar_num(kz_ljs_rank_by);
  2832.    
  2833.     static name[33], authid[33];
  2834.     get_user_name( id, name, 32 );
  2835.  
  2836.     if( rankby == 1 )
  2837.         get_user_authid(id, authid ,32);
  2838.     else if( rankby == 2 )
  2839.         get_user_ip(id, authid, 32, 1);
  2840.     else
  2841.         get_user_name(id, authid, 32);
  2842.  
  2843.     editional_top_n = 0;
  2844.     top_num = 0;
  2845.    
  2846.     if( type == TYPE_WJ )
  2847.     {
  2848.         editional_top_n = check_wjtop(id, Distance, MaxAirSpeed, MaxGroundSpeed, strafes, sync, rankby);
  2849.         jumptype = "wj";
  2850.         if ( Distance > floatround(get_pcvar_float(kz_min_lj_c)*1000000) ) //TODO mb another cvar _c ?
  2851.         {
  2852.             top_num = 255;
  2853.         }
  2854.  
  2855.         if( tops_save && editional_top_n)
  2856.         {
  2857.             save_tops(TOP_WJ);
  2858.         }
  2859.     }
  2860.     else if( type == TYPE_CJ )
  2861.     {
  2862.         editional_top_n = check_cjtop(id, Distance, MaxAirSpeed, MaxGroundSpeed, strafes, sync, rankby);
  2863.         jumptype = "cj";
  2864.         if ( Distance > floatround(get_pcvar_float(kz_min_lj_c)*1000000) )
  2865.         {
  2866.             top_num = 255;
  2867.         }
  2868.  
  2869.         if( tops_save && editional_top_n)
  2870.         {
  2871.             save_tops(TOP_CJ);
  2872.         }
  2873.     }
  2874.     else if( type == TYPE_LJ || type == TYPE_HJ) //TODO: remove this after adding of hj top
  2875.     {
  2876.         editional_top_n = check_ljtop(id, Distance, MaxAirSpeed, MaxGroundSpeed, strafes, sync, rankby);
  2877.         jumptype = "lj";
  2878.         if ( Distance > floatround(get_pcvar_float(kz_min_lj_c)*1000000) )
  2879.         {
  2880.             top_num = 255;
  2881.         }
  2882.  
  2883.         if( tops_save && editional_top_n)
  2884.         {
  2885.             save_tops(TOP_LJ);
  2886.         }
  2887.     }
  2888.     else if( type == TYPE_BJ )
  2889.     {
  2890.         editional_top_n = check_bjtop(id, Distance, MaxAirSpeed, MaxGroundSpeed, strafes, sync, rankby);
  2891.         jumptype = "bj";
  2892.         if ( Distance > floatround(get_pcvar_float(kz_min_bhop_c)*1000000) )
  2893.         {
  2894.             top_num = 255;
  2895.         }
  2896.  
  2897.         if( tops_save && editional_top_n)
  2898.         {
  2899.             save_tops(TOP_BJ);
  2900.         }
  2901.     }
  2902.     else if( type == TYPE_SBJ )
  2903.     {
  2904.         editional_top_n = check_sbjtop(id, Distance, MaxAirSpeed, MaxGroundSpeed, strafes, sync, rankby);
  2905.         jumptype = "sbj";
  2906.         if ( Distance > floatround(get_pcvar_float(kz_min_bhop_c)*1000000) )
  2907.         {
  2908.             top_num = 255;
  2909.         }
  2910.  
  2911.         if( tops_save && editional_top_n)
  2912.         {
  2913.             save_tops(TOP_SBJ);
  2914.         }
  2915.     }
  2916.  
  2917.     //TODO: can be deprectaed to "top_num" from "top_num == 255"
  2918.     if( top_num == 255 && Distance > map_distance[NSHOW-1] && get_pcvar_num(kz_ljs_maptop) )
  2919.     {
  2920.         top_num = 0;
  2921.         static i;
  2922.         for( i = INFO_ZERO; i < NSHOW; i++ )
  2923.         {
  2924.             if( Distance > map_distance[i] )
  2925.             {
  2926.                 static pos, j;
  2927.                 pos = i;
  2928.                 j = 0;
  2929.                 while( !equal( map_authid[pos], authid ) && pos < NSHOW-1 )
  2930.                     pos++ ;
  2931.                 for( j = pos; j > i; j-- )
  2932.                 {
  2933.                     format( map_names[j], 32, map_names[j-1] );
  2934.                     format( map_authid[j], 32, map_authid[j-1] );
  2935.                     map_distance[j] = map_distance[j-1];
  2936.                     map_maxspeed[j] = map_maxspeed[j-1];
  2937.                     map_prestrafe[j] = map_prestrafe[j-1];
  2938.                     map_strafes[j] = map_strafes[j-1];
  2939.                     map_sync[j] = map_sync[j-1];
  2940.                     format( map_type[j], 4, map_type[j-1] );
  2941.                     format( map_pretype[j], 31, map_pretype[j-1] );
  2942.                 }
  2943.                
  2944.                 format( map_names[i], 32, name );
  2945.                 format( map_authid[i], 32, authid );
  2946.                 map_distance[i] = Distance;
  2947.                 map_maxspeed[i] = MaxAirSpeed;
  2948.                 map_prestrafe[i] = MaxGroundSpeed;
  2949.                 map_strafes[i] = strafes;
  2950.                 map_sync[i] = sync;
  2951.                 format( map_type[i], 4, jumptype );
  2952.                 format( map_pretype[i], 31, pre_type[id] );
  2953.                 top_num = i+1;
  2954.                
  2955.                 break;
  2956.             }
  2957.             else if( equal( map_authid[i], authid ) )
  2958.             {
  2959.                 top_num = 0;
  2960.                 break;
  2961.             }
  2962.         }
  2963.     }
  2964.     else
  2965.     {
  2966.         top_num = 0;
  2967.     }
  2968.  
  2969.     if( (get_pcvar_num(kz_ljs_tops) == 2 || get_pcvar_num(kz_ljs_tops) == 3) )
  2970.     {
  2971.         if( top_num && editional_top_n )
  2972.         {
  2973.             if (top_num == editional_top_n)
  2974.             {
  2975.                 client_print(0, print_chat, "[XJ] %s now is %d in map & %s top with %d.%03d jump!", name, top_num, jumptype, (Distance/1000000), (Distance%1000000/1000));
  2976.             }
  2977.             else
  2978.             {
  2979.                 client_print(0, print_chat, "[XJ] %s now is %d in map top & %d in %s top with %d.%03d jump!", name, top_num, editional_top_n, jumptype, (Distance/1000000), (Distance%1000000/1000));              
  2980.             }
  2981.         }
  2982.         else if( top_num && top_num < MAPSHOW )
  2983.         {
  2984.             client_print(0, print_chat, "[XJ] %s now is %d in map top with %d.%03d %s jump!", name, top_num, (Distance/1000000), (Distance%1000000), jumptype);
  2985.         }
  2986.         else if( editional_top_n && editional_top_n <= NSHOW )
  2987.         {
  2988.             client_print(0, print_chat, "[XJ] %s now is %d in %s top with %d.%03d jump!", name, editional_top_n, jumptype, (Distance/1000000), (Distance%1000000));
  2989.         }
  2990.     }
  2991. }
  2992.  
  2993. public check_sbjtop(id, Distance, MaxAirSpeed, MaxGroundSpeed, strafes, sync, rankby)
  2994. {
  2995.     static name[32], authid[32];
  2996.     get_user_name( id, name, 31 );
  2997.     if( rankby == 1 )
  2998.         get_user_authid(id, authid ,31);
  2999.     else if( rankby == 2 )
  3000.         get_user_ip(id, authid, 31, 1);
  3001.     else
  3002.         get_user_name(id, authid, 31);
  3003.    
  3004.     if( Distance > sbj_distance[NTOP-1] )
  3005.     {
  3006.         static i;
  3007.         for( i = INFO_ZERO; i < NTOP; i++ )
  3008.         {
  3009.             if( Distance > sbj_distance[i] )
  3010.             {
  3011.                 static pos, j;
  3012.                 pos = i;
  3013.                 j = 0;
  3014.                 while( !equal( sbj_authid[pos], authid ) && pos < NTOP-1 )
  3015.                     pos++ ;
  3016.                 for( j = pos; j > i; j-- )
  3017.                 {
  3018.                     format( sbj_names[j], 32, sbj_names[j-1] );
  3019.                     format( sbj_authid[j], 32, sbj_authid[j-1] );
  3020.                     sbj_distance[j] = sbj_distance[j-1];
  3021.                     sbj_maxspeed[j] = sbj_maxspeed[j-1];
  3022.                     sbj_prestrafe[j] = sbj_prestrafe[j-1];
  3023.                     sbj_strafes[j] = sbj_strafes[j-1];
  3024.                     sbj_sync[j] = sbj_sync[j-1];
  3025.                     format( sbj_pretype[j], 31, sbj_pretype[j-1] );
  3026.                 }
  3027.                
  3028.                 format( sbj_names[i], 32, name );
  3029.                 format( sbj_authid[i], 32, authid );
  3030.                 sbj_distance[i] = Distance;
  3031.                 sbj_maxspeed[i] = MaxAirSpeed;
  3032.                 sbj_prestrafe[i] = MaxGroundSpeed;
  3033.                 sbj_strafes[i] = strafes;
  3034.                 sbj_sync[i] = sync;
  3035.                 format( sbj_pretype[i], 31, pre_type[id] );
  3036.                 return (i+1);
  3037.                
  3038.             }
  3039.             else if( equal( sbj_authid[i], authid ) )
  3040.                 return 0;
  3041.         }
  3042.     }
  3043.     return 0;
  3044. }
  3045.  
  3046. public check_wjtop(id, Distance, MaxAirSpeed, MaxGroundSpeed, strafes, sync, rankby)
  3047. {
  3048.     static name[32], authid[32];
  3049.     get_user_name( id, name, 31 );
  3050.     if( rankby == 1 )
  3051.         get_user_authid(id, authid ,31);
  3052.     else if( rankby == 2 )
  3053.         get_user_ip(id, authid, 31, 1);
  3054.     else
  3055.         get_user_name(id, authid, 31);
  3056.    
  3057.     if( Distance > wj_distance[NTOP-1] )
  3058.     {
  3059.         static i;
  3060.         for( i = INFO_ZERO; i < NTOP; i++ )
  3061.         {
  3062.             if( Distance > wj_distance[i] )
  3063.             {
  3064.                 static pos, j;
  3065.                 pos = i;
  3066.                 j = 0;
  3067.                 while( !equal( wj_authid[pos], authid ) && pos < NTOP-1 )
  3068.                     pos++ ;
  3069.                 for( j = pos; j > i; j-- )
  3070.                 {
  3071.                     format( wj_names[j], 32, wj_names[j-1] );
  3072.                     format( wj_authid[j], 32, wj_authid[j-1] );
  3073.                     wj_distance[j] = wj_distance[j-1];
  3074.                     wj_maxspeed[j] = wj_maxspeed[j-1];
  3075.                     wj_prestrafe[j] = wj_prestrafe[j-1];
  3076.                     wj_strafes[j] = wj_strafes[j-1];
  3077.                     wj_sync[j] = wj_sync[j-1];
  3078.                     format( wj_pretype[j], 31, wj_pretype[j-1] );
  3079.                 }
  3080.                
  3081.                 format( wj_names[i], 32, name );
  3082.                 format( wj_authid[i], 32, authid );
  3083.                 wj_distance[i] = Distance;
  3084.                 wj_maxspeed[i] = MaxAirSpeed;
  3085.                 wj_prestrafe[i] = MaxGroundSpeed;
  3086.                 wj_strafes[i] = strafes;
  3087.                 wj_sync[i] = sync;
  3088.                 format( wj_pretype[i], 31, pre_type[id] );
  3089.                 return (i+1);
  3090.             }
  3091.             else if( equal( wj_authid[i], authid ) )
  3092.                 return 0;
  3093.         }
  3094.     }
  3095.     return 0;
  3096. }
  3097.  
  3098. public check_bjtop(id, Distance, MaxAirSpeed, MaxGroundSpeed, strafes, sync, rankby)
  3099. {
  3100.     static name[32], authid[32];
  3101.     get_user_name( id, name, 31 );
  3102.     if( rankby == 1 )
  3103.         get_user_authid(id, authid ,31);
  3104.     else if( rankby == 2 )
  3105.         get_user_ip(id, authid, 31, 1);
  3106.     else
  3107.         get_user_name(id, authid, 31);
  3108.    
  3109.     if( Distance > bj_distance[NTOP-1] )
  3110.     {
  3111.         static i;
  3112.         for( i = INFO_ZERO; i < NTOP; i++ )
  3113.         {
  3114.             if( Distance > bj_distance[i] )
  3115.             {
  3116.                 static pos, j;
  3117.                 pos = i;
  3118.                 j = 0;
  3119.                 while( !equal( bj_authid[pos], authid ) && pos < NTOP-1 )
  3120.                     pos++ ;
  3121.                 for( j = pos; j > i; j-- )
  3122.                 {
  3123.                     format( bj_names[j], 32, bj_names[j-1] );
  3124.                     format( bj_authid[j], 32, bj_authid[j-1] );
  3125.                     bj_distance[j] = bj_distance[j-1];
  3126.                     bj_maxspeed[j] = bj_maxspeed[j-1];
  3127.                     bj_prestrafe[j] = bj_prestrafe[j-1];
  3128.                     bj_strafes[j] = bj_strafes[j-1];
  3129.                     bj_sync[j] = bj_sync[j-1];
  3130.                     format( bj_pretype[j], 31, bj_pretype[j-1] );
  3131.                 }
  3132.                
  3133.                 format( bj_names[i], 32, name );
  3134.                 format( bj_authid[i], 32, authid );
  3135.                 bj_distance[i] = Distance;
  3136.                 bj_maxspeed[i] = MaxAirSpeed;
  3137.                 bj_prestrafe[i] = MaxGroundSpeed;
  3138.                 bj_strafes[i] = strafes;
  3139.                 bj_sync[i] = sync;
  3140.                 format( bj_pretype[i], 31, pre_type[id] );
  3141.                 return (i+1);
  3142.             }
  3143.             else if( equal( bj_authid[i], authid ) )
  3144.                 return 0;
  3145.         }
  3146.     }
  3147.     return 0;
  3148. }
  3149.  
  3150. public check_cjtop(id, Distance, MaxAirSpeed, MaxGroundSpeed, strafes, sync, rankby)
  3151. {
  3152.     static name[32], authid[32];
  3153.     get_user_name( id, name, 31 );
  3154.     if( rankby == 1 )
  3155.         get_user_authid(id, authid ,31);
  3156.     else if( rankby == 2 )
  3157.         get_user_ip(id, authid, 31, 1);
  3158.     else
  3159.         get_user_name(id, authid, 31);
  3160.    
  3161.     if( Distance > cj_distance[NTOP-1] )
  3162.     {
  3163.         static i;
  3164.         for( i = INFO_ZERO; i < NTOP; i++ )
  3165.         {
  3166.             if( Distance > cj_distance[i] )
  3167.             {
  3168.                 static pos, j;
  3169.                 pos = i;
  3170.                 j = 0;
  3171.                 while( !equal( cj_authid[pos], authid ) && pos < NTOP-1 )
  3172.                     pos++ ;
  3173.                 for( j = pos; j > i; j-- )
  3174.                 {
  3175.                     format( cj_names[j], 32, cj_names[j-1] );
  3176.                     format( cj_authid[j], 32, cj_authid[j-1] );
  3177.                     cj_distance[j] = cj_distance[j-1];
  3178.                     cj_maxspeed[j] = cj_maxspeed[j-1];
  3179.                     cj_prestrafe[j] = cj_prestrafe[j-1];
  3180.                     cj_strafes[j] = cj_strafes[j-1];
  3181.                     cj_sync[j] = cj_sync[j-1];
  3182.                     format( cj_pretype[j], 31, cj_pretype[j-1] );
  3183.                 }
  3184.                
  3185.                 format( cj_names[i], 32, name );
  3186.                 format( cj_authid[i], 32, authid );
  3187.                 cj_distance[i] = Distance;
  3188.                 cj_maxspeed[i] = MaxAirSpeed;
  3189.                 cj_prestrafe[i] = MaxGroundSpeed;
  3190.                 cj_strafes[i] = strafes;
  3191.                 cj_sync[i] = sync;
  3192.                 format( cj_pretype[i], 31, pre_type[id] );
  3193.                 return (i+1);
  3194.                
  3195.             }
  3196.             else if( equal( cj_authid[i], authid ) )
  3197.                 return 0;
  3198.         }
  3199.     }
  3200.     return 0;
  3201. }
  3202.  
  3203. public check_ljtop(id, Distance, MaxAirSpeed, MaxGroundSpeed, strafes, sync, rankby)
  3204. {
  3205.     static name[32], authid[32];
  3206.     get_user_name( id, name, 31 );
  3207.     if( rankby == 1 )
  3208.         get_user_authid(id, authid ,31);
  3209.     else if( rankby == 2 )
  3210.         get_user_ip(id, authid, 31, 1);
  3211.     else
  3212.         get_user_name(id, authid, 31);
  3213.    
  3214.     if( Distance > lj_distance[NTOP-1] )
  3215.     {
  3216.         static i;
  3217.         for( i = INFO_ZERO; i < NTOP; i++ )
  3218.         {
  3219.             if( Distance > lj_distance[i] )
  3220.             {
  3221.                 static pos, j;
  3222.                 pos = i;
  3223.                 j = 0;
  3224.                 while( !equal( lj_authid[pos], authid ) && pos < NTOP-1 )
  3225.                     pos++ ;
  3226.                 for( j = pos; j > i; j-- )
  3227.                 {
  3228.                     format( lj_names[j], 32, lj_names[j-1] );
  3229.                     format( lj_authid[j], 32, lj_authid[j-1] );
  3230.                     lj_distance[j] = lj_distance[j-1];
  3231.                     lj_maxspeed[j] = lj_maxspeed[j-1];
  3232.                     lj_prestrafe[j] = lj_prestrafe[j-1];
  3233.                     lj_strafes[j] = lj_strafes[j-1];
  3234.                     lj_sync[j] = lj_sync[j-1];
  3235.                     format( lj_pretype[j], 31, lj_pretype[j-1] );
  3236.                 }
  3237.                
  3238.                 format( lj_names[i], 32, name );
  3239.                 format( lj_authid[i], 32, authid );
  3240.                 lj_distance[i] = Distance;
  3241.                 lj_maxspeed[i] = MaxAirSpeed;
  3242.                 lj_prestrafe[i] = MaxGroundSpeed;
  3243.                 lj_strafes[i] = strafes;
  3244.                 lj_sync[i] = sync;
  3245.                 format( lj_pretype[i], 31, pre_type[id] );
  3246.                 return (i+1);
  3247.                
  3248.             }
  3249.             else if( equal( lj_authid[i], authid ) )
  3250.                 return 0;
  3251.         }
  3252.     }
  3253.     return 0;
  3254. }
  3255.  
  3256. public save_tops(_top)
  3257. {
  3258.     static i, distance[12], maxspeed[12], prestrafe[12], strafes[6], sync[6];
  3259.  
  3260.     if (_top == TOP_LJ)
  3261.     {
  3262.         static lj_filename[128];
  3263.  
  3264.         format(lj_filename, 127, "%s/Top10_lj.dat", ljsDir);
  3265.  
  3266.         if( file_exists(lj_filename) )
  3267.             delete_file(lj_filename);
  3268.  
  3269.         for( i = INFO_ZERO; i < NTOP; i++ )
  3270.         {
  3271.             if( lj_distance[i] )
  3272.             {
  3273.                 num_to_str(lj_distance[i], distance, 11);
  3274.                 num_to_str(lj_maxspeed[i], maxspeed, 11);
  3275.                 num_to_str(lj_prestrafe[i], prestrafe, 11);
  3276.                 num_to_str(lj_strafes[i], strafes, 5);
  3277.                 num_to_str(lj_sync[i], sync, 5);
  3278.                 write_file(lj_filename, lj_names[i]);
  3279.                 write_file(lj_filename, lj_authid[i]);
  3280.                 write_file(lj_filename, distance);
  3281.                 write_file(lj_filename, maxspeed);
  3282.                 write_file(lj_filename, prestrafe);
  3283.                 write_file(lj_filename, strafes);
  3284.                 write_file(lj_filename, sync);
  3285.                 write_file(lj_filename, lj_pretype[i]);
  3286.             }
  3287.         }
  3288.     }
  3289.     else if (_top == TOP_CJ)
  3290.     {
  3291.         static cj_filename[128];
  3292.  
  3293.         format(cj_filename, 127, "%s/Top10_cj.dat", ljsDir);
  3294.  
  3295.         if( file_exists(cj_filename) )
  3296.             delete_file(cj_filename);
  3297.  
  3298.         for( i = INFO_ZERO; i < NTOP; i++ )
  3299.         {
  3300.             if( cj_distance[i] )
  3301.             {
  3302.                 num_to_str(cj_distance[i], distance, 11);
  3303.                 num_to_str(cj_maxspeed[i], maxspeed, 11);
  3304.                 num_to_str(cj_prestrafe[i], prestrafe, 11);
  3305.                 num_to_str(cj_strafes[i], strafes, 5);
  3306.                 num_to_str(cj_sync[i], sync, 5);
  3307.                 write_file(cj_filename, cj_names[i]);
  3308.                 write_file(cj_filename, cj_authid[i]);
  3309.                 write_file(cj_filename, distance);
  3310.                 write_file(cj_filename, maxspeed);
  3311.                 write_file(cj_filename, prestrafe);
  3312.                 write_file(cj_filename, strafes);
  3313.                 write_file(cj_filename, sync);
  3314.                 write_file(cj_filename, cj_pretype[i]);
  3315.             }
  3316.         }
  3317.  
  3318.     }
  3319.     else if (_top == TOP_WJ)
  3320.     {
  3321.         static wj_filename[128];
  3322.  
  3323.         format(wj_filename, 127, "%s/Top10_wj.dat", ljsDir);
  3324.  
  3325.         if( file_exists(wj_filename) )
  3326.             delete_file(wj_filename);
  3327.  
  3328.         for( i = INFO_ZERO; i < NTOP; i++ )
  3329.         {
  3330.             if( wj_distance[i] )
  3331.             {
  3332.                 num_to_str(wj_distance[i], distance, 11);
  3333.                 num_to_str(wj_maxspeed[i], maxspeed, 11);
  3334.                 num_to_str(wj_prestrafe[i], prestrafe, 11);
  3335.                 num_to_str(wj_strafes[i], strafes, 5);
  3336.                 num_to_str(wj_sync[i], sync, 5);
  3337.                 write_file(wj_filename, wj_names[i]);
  3338.                 write_file(wj_filename, wj_authid[i]);
  3339.                 write_file(wj_filename, distance);
  3340.                 write_file(wj_filename, maxspeed);
  3341.                 write_file(wj_filename, prestrafe);
  3342.                 write_file(wj_filename, strafes);
  3343.                 write_file(wj_filename, sync);
  3344.                 write_file(wj_filename, wj_pretype[i]);
  3345.             }
  3346.         }
  3347.  
  3348.     }
  3349.     else if (_top == TOP_BJ)
  3350.     {
  3351.         static bj_filename[128];
  3352.  
  3353.         format(bj_filename, 127, "%s/Top10_bj.dat", ljsDir);
  3354.  
  3355.         if( file_exists(bj_filename) )
  3356.             delete_file(bj_filename);
  3357.  
  3358.         for( i = INFO_ZERO; i < NTOP; i++ )
  3359.         {
  3360.             if( bj_distance[i] )
  3361.             {
  3362.                 num_to_str(bj_distance[i], distance, 11);
  3363.                 num_to_str(bj_maxspeed[i], maxspeed, 11);
  3364.                 num_to_str(bj_prestrafe[i], prestrafe, 11);
  3365.                 num_to_str(bj_strafes[i], strafes, 5);
  3366.                 num_to_str(bj_sync[i], sync, 5);
  3367.                 write_file(bj_filename, bj_names[i]);
  3368.                 write_file(bj_filename, bj_authid[i]);
  3369.                 write_file(bj_filename, distance);
  3370.                 write_file(bj_filename, maxspeed);
  3371.                 write_file(bj_filename, prestrafe);
  3372.                 write_file(bj_filename, strafes);
  3373.                 write_file(bj_filename, sync);
  3374.                 write_file(bj_filename, bj_pretype[i]);
  3375.             }
  3376.         }
  3377.     }
  3378.     else if (_top == TOP_SBJ)
  3379.     {
  3380.         static sbj_filename[128];
  3381.  
  3382.         format(sbj_filename, 127, "%s/Top10_sbj.dat", ljsDir);
  3383.  
  3384.         if( file_exists(sbj_filename) )  
  3385.             delete_file(sbj_filename);
  3386.  
  3387.         for( i = INFO_ZERO; i < NTOP; i++ )
  3388.         {
  3389.             if( sbj_distance[i] )
  3390.             {
  3391.                 num_to_str(sbj_distance[i], distance, 11);
  3392.                 num_to_str(sbj_maxspeed[i], maxspeed, 11);
  3393.                 num_to_str(sbj_prestrafe[i], prestrafe, 11);
  3394.                 num_to_str(sbj_strafes[i], strafes, 5);
  3395.                 num_to_str(sbj_sync[i], sync, 5);
  3396.                 write_file(sbj_filename, sbj_names[i]);
  3397.                 write_file(sbj_filename, sbj_authid[i]);
  3398.                 write_file(sbj_filename, distance);
  3399.                 write_file(sbj_filename, maxspeed);
  3400.                 write_file(sbj_filename, prestrafe);
  3401.                 write_file(sbj_filename, strafes);
  3402.                 write_file(sbj_filename, sync);
  3403.                 write_file(sbj_filename, sbj_pretype[i]);
  3404.             }
  3405.         }
  3406.     }
  3407. }
  3408.  
  3409. public show_leet_ljumper(id)
  3410. {
  3411.     new plugin_cvar = get_pcvar_num(kz_ljs_enabled);
  3412.     new ljtop_cvar = get_pcvar_num(kz_ljs_tops);
  3413.     if( plugin_cvar && (ljtop_cvar == 2 || ljtop_cvar == 3) )
  3414.     {
  3415.         new MenuBody[512], len, keys;
  3416.         len = format(MenuBody, 511, "\yShow best longjumper^n");
  3417.  
  3418.         if( map_distance[0] )
  3419.         {
  3420.             len += format(MenuBody[len], 511-len, "^n\r1. \wMap record");
  3421.             keys = (1<<0);
  3422.         }
  3423.         else
  3424.             len += format(MenuBody[len], 511-len, "^n\r1. \dMap record (no jumps)");
  3425.            
  3426.         if( lj_distance[0] )
  3427.         {
  3428.             len += format(MenuBody[len], 511-len, "^n\r2. \wLongJump record");
  3429.             keys |= (1<<1);
  3430.         }
  3431.         else
  3432.             len += format(MenuBody[len], 511-len, "^n\r2. \dLongJump record (no ljs)");
  3433.            
  3434.         if( cj_distance[0] )
  3435.         {
  3436.             len += format(MenuBody[len], 511-len, "^n\r3. \wContJump record");
  3437.             keys |= (1<<2);
  3438.         }
  3439.         else
  3440.             len += format(MenuBody[len], 511-len, "^n\r3. \dContJump record (no cjs)");
  3441.  
  3442.         if( bj_distance[0] )
  3443.         {
  3444.             len += format(MenuBody[len], 511-len, "^n\r4. \wBhopJump record");
  3445.             keys |= (1<<3);
  3446.         }
  3447.         else
  3448.             len += format(MenuBody[len], 511-len, "^n\r4. \dBhopJump record (no bjs)");
  3449.  
  3450.         if( sbj_distance[0] )
  3451.         {
  3452.             len += format(MenuBody[len], 511-len, "^n\r5. \wStand-up BhopJump record");
  3453.             keys |= (1<<4);
  3454.         }
  3455.         else
  3456.             len += format(MenuBody[len], 511-len, "^n\r5. \dStand-up BhopJump record (no sbjs)");
  3457.  
  3458.         if( wj_distance[0] )
  3459.         {
  3460.             len += format(MenuBody[len], 511-len, "^n\r6. \wWeirdJump record");
  3461.             keys |= (1<<5);
  3462.         }
  3463.         else
  3464.             len += format(MenuBody[len], 511-len, "^n\r6. \dWeirdJump record (no wjs)");
  3465.            
  3466.         len += format(MenuBody[len], 511-len, "^n^n\r0. \wExit");
  3467.         keys |= (1<<9);
  3468.            
  3469.         show_menu(id, keys, MenuBody, -1, "Show best longjumper");
  3470.     }
  3471.     else if( !plugin_cvar )
  3472.         client_print(id, print_chat, "[XJ] Records are not valid. Plugin is disabled.");
  3473.     else
  3474.         client_print(id, print_chat, "[XJ] Records are not valid. Tops are disabled.");
  3475.    
  3476.     return ( (get_pcvar_num(kz_ljs_viscmds))?PLUGIN_CONTINUE:PLUGIN_HANDLED );
  3477. }
  3478.  
  3479. public LeetJumpMenu_Select(id, key)
  3480. {
  3481.     new plugin_cvar = get_pcvar_num(kz_ljs_enabled);
  3482.     new ljtops = get_pcvar_num(kz_ljs_tops);
  3483.  
  3484.     if( ljtops == 2 || ljtops == 3 )
  3485.         ljtops = 1;
  3486.     else
  3487.         ljtops = 0;
  3488.  
  3489.     switch((key+1))
  3490.     {
  3491.         case 1:
  3492.         {
  3493.             if( map_distance[0] && ljtops && plugin_cvar )
  3494.                 client_print(id, print_chat, "[XJ] %s has the total %d.%06d %s record!", map_names[0], map_distance[0]/1000000, map_distance[0]%1000000, map_type[0]);
  3495.             else if( !plugin_cvar )
  3496.                 client_print(id, print_chat, "[XJ] Records are not valid. Plugin has been disabled.");
  3497.             else if( !ljtops )
  3498.                 client_print(id, print_chat, "[XJ] Records are not valid. Tops have been disabled.");
  3499.             else
  3500.                 client_print(id, print_chat, "[XJ] Records are not valid. Tops have been reseted.");
  3501.         }
  3502.         case 2:
  3503.         {
  3504.             if( lj_distance[0] && ljtops && plugin_cvar )
  3505.                 client_print(id, print_chat, "[XJ] %s has the %d.%06d lj record!", lj_names[0], lj_distance[0]/1000000, lj_distance[0]%1000000);
  3506.             else if( !plugin_cvar )
  3507.                 client_print(id, print_chat, "[XJ] Records are not valid. Plugin has been disabled.");
  3508.             else if( !ljtops )
  3509.                 client_print(id, print_chat, "[XJ] Records are not valid. Tops have been disabled.");
  3510.             else
  3511.                 client_print(id, print_chat, "[XJ] Lj records are not valid. Tops have been reseted.");
  3512.         }
  3513.         case 3:
  3514.         {
  3515.             if( cj_distance[0] && ljtops && plugin_cvar )
  3516.                 client_print(id, print_chat, "[XJ] %s has the %d.%06d cj record!", cj_names[0], cj_distance[0]/1000000, cj_distance[0]%1000000);
  3517.             else if( !plugin_cvar )
  3518.                 client_print(id, print_chat, "[XJ] Records are not valid. Plugin has been disabled.");
  3519.             else if( !ljtops )
  3520.                 client_print(id, print_chat, "[XJ] Records are not valid. Tops have been disabled.");
  3521.             else
  3522.                 client_print(id, print_chat, "[XJ] Cj records are not valid. Tops have been reseted.");
  3523.         }
  3524.         case 4:
  3525.         {
  3526.             if( bj_distance[0] && ljtops && plugin_cvar )
  3527.                 client_print(id, print_chat, "[XJ] %s has the %d.%06d bj record!", bj_names[0], bj_distance[0]/1000000, bj_distance[0]%1000000);
  3528.             else if( !plugin_cvar )
  3529.                 client_print(id, print_chat, "[XJ] Records are not valid. Plugin has been disabled.");
  3530.             else if( !ljtops )
  3531.                 client_print(id, print_chat, "[XJ] Records are not valid. Tops have been disabled.");
  3532.             else
  3533.                 client_print(id, print_chat, "[XJ] Bj records are not valid. Tops have been reseted.");
  3534.         }
  3535.         case 5:
  3536.         {
  3537.             if( sbj_distance[0] && ljtops && plugin_cvar )
  3538.                 client_print(id, print_chat, "[XJ] %s has the %d.%06d sbj record!", sbj_names[0], sbj_distance[0]/1000000, sbj_distance[0]%1000000);
  3539.             else if( !plugin_cvar )
  3540.                 client_print(id, print_chat, "[XJ] Records are not valid. Plugin has been disabled.");
  3541.             else if( !ljtops )
  3542.                 client_print(id, print_chat, "[XJ] Records are not valid. Tops have been disabled.");
  3543.             else
  3544.                 client_print(id, print_chat, "[XJ] Sbj records are not valid. Tops have been reseted.");
  3545.         }
  3546.         case 6:
  3547.         {
  3548.             if( wj_distance[0] && ljtops && plugin_cvar )
  3549.                 client_print(id, print_chat, "[XJ] %s has the %d.%06d wj record!", wj_names[0], wj_distance[0]/1000000, wj_distance[0]%1000000);
  3550.             else if( !plugin_cvar )
  3551.                 client_print(id, print_chat, "[XJ] Records are not valid. Plugin has been disabled.");
  3552.             else if( !ljtops )
  3553.                 client_print(id, print_chat, "[XJ] Records are not valid. Tops have been disabled.");
  3554.             else
  3555.                 client_print(id, print_chat, "[XJ] Wj records are not valid. Tops have been reseted.");
  3556.         }
  3557.     }
  3558.     return PLUGIN_HANDLED;
  3559. }
  3560.  
  3561. public show_top(id, toptype)
  3562. {
  3563.     static buffer[2368], name[131], len, i;
  3564.    
  3565.     len = format(buffer, 2367, "<body bgcolor=#94AEC6><table width=100%% cellpadding=2 cellspacing=0 border=0>");
  3566.     if( !toptype )
  3567.         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");
  3568.     else
  3569.         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");
  3570.    
  3571.     if( toptype == TOP_WJ)
  3572.     {
  3573.         for( i = INFO_ZERO; i < NSHOW; i++ )
  3574.         {      
  3575.             if( wj_distance[i] == 0 )
  3576.             {
  3577.                 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=#A4BED6", (i+1), "-", "-", "-", "-", "-", "-");
  3578.                 i=NSHOW;
  3579.             }
  3580.             else
  3581.             {
  3582.                 name = wj_names[i];
  3583.                 while( containi(name, "<") != -1 )
  3584.                     replace(name, 129, "<", "&lt;");
  3585.                 while( containi(name, ">") != -1 )
  3586.                     replace(name, 129, ">", "&gt;");
  3587.                 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=#A4BED6", (i+1), name, (wj_distance[i]/1000000), (wj_distance[i]%1000000/100000), (wj_maxspeed[i]/1000000), (wj_maxspeed[i]%1000000/100000), (wj_prestrafe[i]/1000000), (wj_prestrafe[i]%1000000/100000), wj_strafes[i], wj_sync[i]);
  3588.             }
  3589.         }
  3590.     }
  3591.     else if( toptype == TOP_SBJ)
  3592.     {
  3593.         for( i = INFO_ZERO; i < NSHOW; i++ )
  3594.         {      
  3595.             if( sbj_distance[i] == 0 )
  3596.             {
  3597.                 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=#A4BED6", (i+1), "-", "-", "-", "-", "-", "-");
  3598.                 i=NSHOW;
  3599.             }
  3600.             else
  3601.             {
  3602.                 name = sbj_names[i];
  3603.                 while( containi(name, "<") != -1 )
  3604.                     replace(name, 129, "<", "&lt;");
  3605.                 while( containi(name, ">") != -1 )
  3606.                     replace(name, 129, ">", "&gt;");
  3607.                 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=#A4BED6", (i+1), name, (sbj_distance[i]/1000000), (sbj_distance[i]%1000000/100000), (sbj_maxspeed[i]/1000000), (sbj_maxspeed[i]%1000000/100000), (sbj_prestrafe[i]/1000000), (sbj_prestrafe[i]%1000000/100000), sbj_strafes[i], sbj_sync[i]);
  3608.             }
  3609.         }
  3610.     }
  3611.     else if( toptype == TOP_BJ)
  3612.     {
  3613.         for( i = INFO_ZERO; i < NSHOW; i++ )
  3614.         {      
  3615.             if( bj_distance[i] == 0 )
  3616.             {
  3617.                 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=#A4BED6", (i+1), "-", "-", "-", "-", "-", "-");
  3618.                 i=NSHOW;
  3619.             }
  3620.             else
  3621.             {
  3622.                 name = bj_names[i];
  3623.                 while( containi(name, "<") != -1 )
  3624.                     replace(name, 129, "<", "&lt;");
  3625.                 while( containi(name, ">") != -1 )
  3626.                     replace(name, 129, ">", "&gt;");
  3627.                 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=#A4BED6", (i+1), name, (bj_distance[i]/1000000), (bj_distance[i]%1000000/100000), (bj_maxspeed[i]/1000000), (bj_maxspeed[i]%1000000/100000), (bj_prestrafe[i]/1000000), (bj_prestrafe[i]%1000000/100000), bj_strafes[i], bj_sync[i]);
  3628.             }
  3629.         }
  3630.     }
  3631.     else if( toptype == TOP_CJ)
  3632.     {
  3633.         for( i = INFO_ZERO; i < NSHOW; i++ )
  3634.         {      
  3635.             if( cj_distance[i] == 0 )
  3636.             {
  3637.                 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=#A4BED6", (i+1), "-", "-", "-", "-", "-", "-");
  3638.                 i=NSHOW;
  3639.             }
  3640.             else
  3641.             {
  3642.                 name = cj_names[i];
  3643.                 while( containi(name, "<") != -1 )
  3644.                     replace(name, 129, "<", "&lt;");
  3645.                 while( containi(name, ">") != -1 )
  3646.                     replace(name, 129, ">", "&gt;");
  3647.                 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=#A4BED6", (i+1), name, (cj_distance[i]/1000000), (cj_distance[i]%1000000/100000), (cj_maxspeed[i]/1000000), (cj_maxspeed[i]%1000000/100000), (cj_prestrafe[i]/1000000), (cj_prestrafe[i]%1000000/100000), cj_strafes[i], cj_sync[i]);
  3648.             }
  3649.         }
  3650.     }
  3651.     else if( toptype == TOP_LJ)
  3652.     {
  3653.         for( i = INFO_ZERO; i < NSHOW; i++ )
  3654.         {      
  3655.             if( lj_distance[i] == 0 )
  3656.             {
  3657.                 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=#A4BED6", (i+1), "-", "-", "-", "-", "-", "-");
  3658.                 i=NSHOW;
  3659.             }
  3660.             else
  3661.             {
  3662.                 name = lj_names[i];
  3663.                 while( containi(name, "<") != -1 )
  3664.                     replace(name, 129, "<", "&lt;");
  3665.                 while( containi(name, ">") != -1 )
  3666.                     replace(name, 129, ">", "&gt;");
  3667.                 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=#A4BED6", (i+1), name, (lj_distance[i]/1000000), (lj_distance[i]%1000000/100000), (lj_maxspeed[i]/1000000), (lj_maxspeed[i]%1000000/100000), (lj_prestrafe[i]/1000000), (lj_prestrafe[i]%1000000/100000), lj_strafes[i], lj_sync[i]);
  3668.             }
  3669.         }
  3670.     }
  3671.     else if( toptype == TOP_MAP)
  3672.     {
  3673.         for( i = INFO_ZERO; i < NSHOW; i++ )
  3674.         {      
  3675.             if( map_distance[i] == 0 )
  3676.             {
  3677.                 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=#A4BED6", (i+1), "-", "-", "-", "-", "-", "-", "-");
  3678.                 i=NSHOW;
  3679.             }
  3680.             else
  3681.             {
  3682.                 name = map_names[i];
  3683.                 while( containi(name, "<") != -1 )
  3684.                     replace(name, 129, "<", "&lt;");
  3685.                 while( containi(name, ">") != -1 )
  3686.                     replace(name, 129, ">", "&gt;");
  3687.                 len += format(buffer[len], 2367-len, "<tr align=center%s><td> %d <td align=left> %s <td> %d <td> %d <td> %d <td> %d <td> %d <td> %s", ((i%2)==0) ? "" : " bgcolor=#A4BED6", (i+1), name, (map_distance[i]/1000000), (map_maxspeed[i]/1000000), (map_prestrafe[i]/1000000), map_strafes[i], map_sync[i], map_type[i]);
  3688.             }
  3689.         }
  3690.     }
  3691.        
  3692.     len += format(buffer[len], 2367-len, "</table></body>");
  3693.     static strin[20];
  3694.  
  3695.         if( toptype == TOP_WJ)
  3696.         format(strin,19, "Top %d WeirdJumps", NSHOW); //TODO: remove bug or todo better message
  3697.     else if( toptype == TOP_SBJ)
  3698.         format(strin,19, "Top %d S-BhopJumps", NSHOW); //TODO: remove bug or todo better message
  3699.     else if( toptype == TOP_BJ)
  3700.         format(strin,19, "Top %d BhopJumps", NSHOW);
  3701.     else if( toptype == TOP_CJ)
  3702.         format(strin,19, "Top %d CountJumps", NSHOW);
  3703.     else if( toptype == TOP_LJ)
  3704.         format(strin,19, "Top %d LongJumps", NSHOW);
  3705.     else if( toptype == TOP_MAP)
  3706.         format(strin,19, "Top %d Map Jumps", NSHOW);
  3707.         show_motd(id, buffer, strin);
  3708. }
  3709. public gocheckBoth(id)
  3710. {
  3711.     gocheck(id);
  3712.     gocheckbhop(id);
  3713. }
  3714. public gocheck(id)
  3715. {
  3716.     gInAir[id] = false;
  3717.     cjumped[id] = false;
  3718.     doubleducked[id] = false;
  3719.     jumptype[id] = TYPE_NONE;
  3720. }
  3721.  
  3722. public gocheckbhop(id)
  3723. {
  3724.     isBhop[id] = false;
  3725.     testBhop[id] = false;
  3726.     fMaxAirSpeed[id] = 0.0; //prevent 1 bug
  3727.     fMaxGroundSpeed[id] = 250.0;
  3728.     jumptype[id] = TYPE_NONE;
  3729. }
  3730.  
  3731. public ddend(id)
  3732.     doubleducked[id] = false;
  3733.  
  3734. public testcjstart(id)
  3735.     cducked[id] = false;
  3736.  
  3737. public client_putinserver(id)
  3738. {
  3739.     if( task_exists(id+234490, 0) )
  3740.         remove_task(id+234490, 0);
  3741.    
  3742.     set_task(0.1, "check_prestrafe_type", id+234490, "", 0, "b", 0);
  3743.    
  3744.     static connectenabler[6], fastserver;
  3745.     fastserver = get_pcvar_num(kz_ljs_fastserver);
  3746.     get_pcvar_string(kz_ljs_connectenabler, connectenabler, 5);
  3747.     format(connectenabler, 5, "_%s", connectenabler);
  3748.  
  3749.     if( contain(connectenabler, "a") > 0 )
  3750.         gHasColorChat[id] = true;
  3751.     else
  3752.         gHasColorChat[id] = false;
  3753.     if( contain(connectenabler, "b") > 0 )
  3754.         gHasLjStats[id] = true;
  3755.     else
  3756.         gHasLjStats[id] = false;
  3757.     if( contain(connectenabler, "c") > 0 )
  3758.     {
  3759.         gHasSpeed[id] = true;
  3760.         if( fastserver == 1 )
  3761.             set_task(0.1, "tskSpeed", id+334490, "", 0, "b", 0);
  3762.         else if( fastserver != 2 )
  3763.             set_task(0.5, "tskSpeed", id+334490, "", 0, "b", 0);
  3764.     }
  3765.     else
  3766.         gHasSpeed[id] = false;
  3767. //  if (get_pcvar_num(kz_ljs_beam) > 0)
  3768. //      bljbeam[id] = true;
  3769. //  else
  3770.  
  3771.     bljbeam[id] = false;
  3772.  
  3773. #if defined COMMAND_PROTECTION
  3774.     if( fastserver == 2 )
  3775.         set_task(0.5, "tskFps", id+434490, "", 0, "b", 0);
  3776.     else
  3777.         set_task(1.0, "tskFps", id+434490, "", 0, "b", 0);
  3778. #endif 
  3779.     StrafeStat[id] = true;
  3780.     bljhelp[id] = false;
  3781.     turning_right[id] = false;
  3782.     turning_left[id] = false;
  3783.     strafing_aw[id] = false;
  3784.     strafing_sd[id] = false;
  3785.     cducked[id] = false;
  3786.     cjumped[id] = false;
  3787.     doubleducked[id]=false;
  3788.     induck[id] = false;
  3789.     OnGround[id] = false;
  3790.     possible_lj_script[id][0] = false;
  3791.     possible_lj_script[id][1] = false;
  3792.     isBhop[id] = false;
  3793.     testBhop[id] = false;
  3794.     vFallAt[id][0] = 0.0;
  3795.     vFallAt[id][1] = 0.0;
  3796.     vFallAt[id][2] = 0.0;
  3797. }
  3798.  
  3799. public client_disconnect(id)
  3800. {
  3801.     if( task_exists(id+234490, 0) )
  3802.         remove_task(id+234490, 0);
  3803.    
  3804.     StrafeStat[id] = true;
  3805.     bljhelp[id] = false;
  3806.     gHasColorChat[id] = false;
  3807.     gHasLjStats[id] = false;
  3808.     gHasSpeed[id] = false;
  3809.     turning_right[id] = false;
  3810.     turning_left[id] = false;
  3811.     strafing_aw[id] = false;
  3812.     strafing_sd[id] = false;
  3813.     OnGround[id] = false;
  3814.     cducked[id] = false;
  3815.     doubleducked[id] = false;
  3816.     cjumped[id] = false;
  3817.     induck[id] = false;
  3818.     possible_lj_script[id][0] = false;
  3819.     possible_lj_script[id][1] = false;
  3820.     isBhop[id] = false;
  3821.     testBhop[id] = false;
  3822.  
  3823.    
  3824.     if( task_exists(id+334490, 0) )
  3825.         remove_task(id+334490, 0);
  3826.    
  3827.     if( task_exists(id+434490, 0) )
  3828.         remove_task(id+434490, 0);
  3829. }
  3830.  
  3831. public check_prestrafe_type(id)
  3832. {
  3833.     id -= 234490;
  3834.     if( is_user_alive(id) )
  3835.     {
  3836.         static flags, buttons, moving;
  3837.         flags = pev(id, pev_flags);
  3838.         buttons = pev(id, pev_button);
  3839.        
  3840.         /*if( flags&FL_ONGROUND && gInAir[id] && get_gametime() > (jumptime[id]+0.1) )
  3841.         {  
  3842.             new Float:vvvOrigin[3];
  3843.             pev(id, pev_origin, vvvOrigin);
  3844.  
  3845.             client_print(id, print_console, "prizemlils v check_prestrafe_type, %f %f %f", vvvOrigin[0],vvvOrigin[1],vvvOrigin[2]);        
  3846.             fwdPlayerPreThink(id);
  3847.         }*/
  3848.        
  3849.         if( (buttons&IN_FORWARD || buttons&IN_BACK || buttons&IN_MOVERIGHT || buttons&IN_MOVELEFT) && !(buttons&IN_DUCK) )
  3850.             moving = INFO_ONE;
  3851.         else
  3852.             moving = INFO_ZERO;
  3853.        
  3854.         if( moving && !(doubleducked[id]) && !(cjumped[id]) && flags&FL_ONGROUND && (turning_right[id] || turning_left[id]) )
  3855.         {
  3856.             if( buttons&IN_FORWARD && buttons&IN_BACK )
  3857.                 moving = INFO_ZERO;
  3858.            
  3859.             if( buttons&IN_MOVELEFT && buttons&IN_MOVERIGHT )
  3860.                 moving = INFO_ZERO;
  3861.            
  3862.             if( !(moving) )
  3863.                 pre_type[id] = "key error";
  3864.         }
  3865.         else
  3866.         {
  3867.             moving = 0;
  3868.         }
  3869.        
  3870.         if( moving )
  3871.         {
  3872.             if( buttons&IN_FORWARD )
  3873.             {
  3874.                 if( buttons&IN_MOVERIGHT )
  3875.                 {
  3876.                     if( turning_right[id] )
  3877.                         pre_type[id] = "right";
  3878.                     else
  3879.                         pre_type[id] = "right sw";
  3880.                 }
  3881.                 else if( buttons&IN_MOVELEFT )
  3882.                 {
  3883.                     if( turning_left[id] )
  3884.                         pre_type[id] = "left";
  3885.                     else
  3886.                         pre_type[id] = "left sw";
  3887.                 }
  3888.                 else
  3889.                 {
  3890.                     if( turning_right[id] )
  3891.                         pre_type[id] = "right (1 key)";
  3892.                     else
  3893.                         pre_type[id] = "left (1 key)";
  3894.                 }
  3895.             }
  3896.             else if( buttons&IN_BACK )
  3897.             {
  3898.                 if( buttons&IN_MOVERIGHT )
  3899.                 {
  3900.                     if( turning_left[id] )
  3901.                         pre_type[id] = "bw right";
  3902.                     else
  3903.                         pre_type[id] = "bw right sw";
  3904.                 }
  3905.                 else if( buttons&IN_MOVELEFT )
  3906.                 {
  3907.                     if( turning_right[id] )
  3908.                         pre_type[id] = "bw left";
  3909.                     else
  3910.                         pre_type[id] = "bw left sw";
  3911.                 }
  3912.                 else
  3913.                 {
  3914.                     if( turning_left[id] )
  3915.                         pre_type[id] = "bw right (1 key)";
  3916.                     else
  3917.                         pre_type[id] = "bw left (1 key)";
  3918.                 }
  3919.             }
  3920.             else if( buttons&IN_MOVERIGHT )
  3921.             {
  3922.                 if( turning_right[id] )
  3923.                     pre_type[id] = "bw right sw (1 key)";
  3924.                 else
  3925.                     pre_type[id] = "left sw (1 key)";
  3926.             }
  3927.             else if( buttons&IN_MOVELEFT )
  3928.             {
  3929.                 if( turning_left[id] )
  3930.                     pre_type[id] = "bw left sw (1 key)";
  3931.                 else
  3932.                     pre_type[id] = "right sw (1 key)";
  3933.             }
  3934.             else
  3935.                 pre_type[id] = "unknown error";
  3936.         }
  3937.     }              
  3938. }
  3939.  
  3940. #if defined COMMAND_PROTECTION
  3941. public tskFps(id)
  3942. {
  3943.     if( get_pcvar_num(kz_legal_settings) && get_pcvar_num(kz_ljs_enabled) )
  3944.     {
  3945.         id-=434490;
  3946.         client_cmd(id, "developer 0;fps_max 101;cl_forwardspeed 400;cl_sidespeed 400;cl_backspeed 400");
  3947.     }
  3948. }
  3949. #endif 
  3950.  
  3951. public cmdColorChat(id)
  3952. {
  3953.     if( get_pcvar_num(kz_ljs_enabled) && !gHasColorChat[id] )
  3954.     {
  3955.         gHasColorChat[id] = true;
  3956.         client_print(id, print_chat, "[XJ] ColorChat enabled. To disable, type /colorchat.");
  3957.     }
  3958.     else if( get_pcvar_num(kz_ljs_enabled) )
  3959.     {
  3960.         gHasColorChat[id] = false;
  3961.         client_print(id, print_chat, "[XJ] ColorChat disabled. To enable, type /colorchat.");
  3962.     }
  3963.    
  3964.     return ( (get_pcvar_num(kz_ljs_viscmds))?PLUGIN_CONTINUE:PLUGIN_HANDLED );
  3965. }
  3966.  
  3967. public cmdLjStats(id)
  3968. {
  3969.     if( get_pcvar_num(kz_ljs_enabled) && !gHasLjStats[id] )
  3970.     {
  3971.         gHasLjStats[id] = true;
  3972.        
  3973.         client_print(id, print_chat, "[XJ] LongJump Stats enabled. To disable, type /ljstats.");
  3974.     }
  3975.     else if( get_pcvar_num(kz_ljs_enabled) )
  3976.     {
  3977.         gHasLjStats[id] = false;
  3978.        
  3979.         client_print(id, print_chat, "[XJ] LongJump Stats disabled. To enable, type /ljstats.");
  3980.     }
  3981.    
  3982.     return ( (get_pcvar_num(kz_ljs_viscmds))?PLUGIN_CONTINUE:PLUGIN_HANDLED );
  3983. }
  3984.  
  3985. public cmdSpeed(id)
  3986. {
  3987.     if( get_pcvar_num(kz_ljs_enabled) && !gHasSpeed[id] )
  3988.     {
  3989.         gHasSpeed[id] = true;
  3990.         if( get_pcvar_num(kz_ljs_fastserver) == 1 )
  3991.             set_task(0.1, "tskSpeed", id+334490, "", 0, "b", 0);
  3992.         else if( get_pcvar_num(kz_ljs_fastserver) != 2 )
  3993.             set_task(0.5, "tskSpeed", id+334490, "", 0, "b", 0);
  3994.         client_print(id, print_chat, "[XJ] Speedometer enabled. To disable, type /speed.");
  3995.     }
  3996.     else if( get_pcvar_num(kz_ljs_enabled) )
  3997.     {
  3998.         gHasSpeed[id] = false;
  3999.         if( task_exists(id+334490, 0) )
  4000.             remove_task(id+334490, 0);
  4001.         client_print(id, print_chat, "[XJ] Speedometer disabled. To enable, type /speed.");
  4002.     }
  4003.    
  4004.     return ( (get_pcvar_num(kz_ljs_viscmds))?PLUGIN_CONTINUE:PLUGIN_HANDLED );
  4005. }
  4006.  
  4007. public cmdStrafeStat(id)
  4008. {
  4009.     if( get_pcvar_num(kz_ljs_enabled) && !(StrafeStat[id]) )
  4010.     {
  4011.         StrafeStat[id] = true;
  4012.         client_print(id, print_chat, "[XJ] Strafe stat enabled. To disable, type /strafestat.");
  4013.     }
  4014.     else if( get_pcvar_num(kz_ljs_enabled) )
  4015.     {
  4016.         StrafeStat[id] = false;
  4017.         client_print(id, print_chat, "[XJ] Strafe stat disabled. To enable, type /strafestat.");
  4018.     }
  4019.    
  4020.     return ( (get_pcvar_num(kz_ljs_viscmds))?PLUGIN_CONTINUE:PLUGIN_HANDLED );
  4021. }
  4022.  
  4023. public cmdljhelp(id)
  4024. {
  4025.     if( get_pcvar_num(kz_ljs_enabled) && !(bljhelp[id]) )
  4026.     {
  4027.         bljhelp[id] = true;
  4028.         client_print(id, print_chat, "enabled");
  4029.     }
  4030.     else if( get_pcvar_num(kz_ljs_enabled) )
  4031.     {
  4032.         bljhelp[id] = false;
  4033.         client_print(id, print_chat, "disabled");
  4034.     }
  4035.    
  4036.     return ( (get_pcvar_num(kz_ljs_viscmds))?PLUGIN_CONTINUE:PLUGIN_HANDLED );
  4037. }
  4038. public cmdljbeam(id)
  4039. {
  4040.     if( get_pcvar_num(kz_ljs_enabled) && !(bljbeam[id]) && get_pcvar_num(kz_ljs_beam) > 0)
  4041.     {
  4042.         bljbeam[id] = true;
  4043.         client_print(id, print_chat, "[XJ] Lj beam enabled. To disable, type /ljbeam.");
  4044.     }
  4045.     else if( get_pcvar_num(kz_ljs_enabled) )
  4046.     {
  4047.         bljbeam[id] = false;
  4048.         if (get_pcvar_num(kz_ljs_beam) > 0)
  4049.             client_print(id, print_chat, "[XJ] Lj beam disabled. To enable, type /ljbeam.");
  4050.         else
  4051.             client_print(id, print_chat, "[XJ] Lj beam disabled in plugin configuration.");
  4052.     }
  4053.    
  4054.     return ( (get_pcvar_num(kz_ljs_viscmds))?PLUGIN_CONTINUE:PLUGIN_HANDLED );
  4055. }
  4056.  
  4057. public tskSpeed(taskid)
  4058. {
  4059.     taskid-=334490;
  4060.     static alive, aliveflags, spectatedplayer, specflags;
  4061.     alive = is_user_alive(taskid);
  4062.     aliveflags = pev(taskid, pev_flags);
  4063.     spectatedplayer = get_spectated_player(taskid);
  4064.     if( spectatedplayer )
  4065.         specflags = pev(spectatedplayer, pev_flags);
  4066.     else
  4067.         specflags = INFO_ZERO;
  4068.    
  4069.     if( (alive || spectatedplayer > 0) && get_pcvar_num(kz_ljs_enabled) )
  4070.     {
  4071.         if( alive )
  4072.         {
  4073.             pev(taskid, pev_velocity, vVelocity);
  4074.             if( aliveflags&FL_ONGROUND && aliveflags&FL_INWATER )
  4075.                 vVelocity[2]-=vVelocity[2];
  4076.         }
  4077.         else
  4078.         {
  4079.             pev(spectatedplayer, pev_velocity, vVelocity);
  4080.             if( specflags&FL_ONGROUND && specflags&FL_INWATER )
  4081.                 vVelocity[2]-=vVelocity[2];
  4082.         }
  4083.                
  4084.         if( get_pcvar_num(kz_ljs_fastserver) == 1 )
  4085.             set_hudmessage(255, 255, 255, -1.0, 0.65, 0, 0.0, 0.2, 0.0, 0.0, 2);
  4086.         else if( !(get_pcvar_num(kz_ljs_fastserver) == 1 || get_pcvar_num(kz_ljs_fastserver) == 2) )
  4087.             set_hudmessage(255, 255, 255, -1.0, 0.65, 0, 0.0, 0.6, 0.0, 0.0, 2);
  4088.        
  4089.         if( get_pcvar_num(kz_ljs_speedtype) == 1 )
  4090.             show_hudmessage(taskid, "%d units/second", floatround(vector_length(vVelocity), floatround_floor));
  4091.         else if( get_pcvar_num(kz_ljs_speedtype) == 2 )
  4092.         {
  4093.             if( vVelocity[2] != 0 )
  4094.                 vVelocity[2]-=vVelocity[2];
  4095.             gSpeed = vector_length(vVelocity);
  4096.             show_hudmessage(taskid, "%d velocity", floatround(gSpeed, floatround_floor));
  4097.         }
  4098.         else
  4099.         {
  4100.             if( vVelocity[2] != 0 )
  4101.                 vVelocity[2]-=vVelocity[2];
  4102.             gSpeed = vector_length(vVelocity);
  4103.             if( alive )
  4104.             {
  4105.                 pev(taskid, pev_velocity, vVelocity);
  4106.                 if( aliveflags&FL_ONGROUND && aliveflags&FL_INWATER )
  4107.                     vVelocity[2]-=vVelocity[2];
  4108.             }
  4109.             else
  4110.             {
  4111.                 pev(spectatedplayer, pev_velocity, vVelocity);
  4112.                 if( specflags&FL_ONGROUND && specflags&FL_INWATER )
  4113.                     vVelocity[2]-=vVelocity[2];
  4114.             }
  4115.             show_hudmessage(taskid, "%d units/second^n%d velocity", floatround(vector_length(vVelocity), floatround_floor), floatround(gSpeed, floatround_floor));
  4116.         }
  4117.     }
  4118. }
  4119.  
  4120. public cmdVersion(id)
  4121. {
  4122.     ColorChat(id, GREY, "^x04[XJ] Plugin: ^x01%s^x04 by: ^x03%s", gPLUGIN, gAUTHOR);
  4123.     if( get_pcvar_num(kz_ljs_enabled) )
  4124.         ColorChat(id, BLUE, "^x04[XJ] Version: ^x01%s^x04, Status:^x03 enabled", gVERSION);
  4125.     else
  4126.         ColorChat(id, RED, "^x04[XJ] Version: ^x01%s^x04, Status:^x03 disabled", gVERSION);
  4127.    
  4128.     return ( (get_pcvar_num(kz_ljs_viscmds))?PLUGIN_CONTINUE:PLUGIN_HANDLED );
  4129. }
  4130.  
  4131. public fwdStartFrame()
  4132. {
  4133.     if( get_pcvar_num(kz_legal_settings) && get_pcvar_num(kz_ljs_enabled) )
  4134.     {
  4135.         if( get_pcvar_num(edgefriction) != 2 )
  4136.             set_pcvar_num(edgefriction, 2);
  4137.        
  4138.         if( get_pcvar_num(mp_footsteps) != 1 )
  4139.             set_pcvar_num(mp_footsteps, 1);
  4140.        
  4141.         if( get_pcvar_num(sv_cheats) != 0 )
  4142.             set_pcvar_num(sv_cheats, 0);
  4143.        
  4144.         if( get_pcvar_num(sv_gravity) != 800 )
  4145.             set_pcvar_num(sv_gravity, 800);
  4146.        
  4147.         if( get_pcvar_num(sv_airaccelerate) != 10 )
  4148.             set_pcvar_num(sv_airaccelerate, 10);
  4149.        
  4150.         if( get_pcvar_num(sv_maxspeed) != 320 )
  4151.             set_pcvar_num(sv_maxspeed, 320);
  4152.        
  4153.         if( get_pcvar_num(sv_stepsize) != 18 )
  4154.             set_pcvar_num(sv_stepsize, 18);
  4155.        
  4156.         if( get_pcvar_num(sv_maxvelocity) != 2000 )
  4157.             set_pcvar_num(sv_maxvelocity, 2000);
  4158.     }
  4159.    
  4160.     if( FindPlayer() > -1)
  4161.     {
  4162.         if( get_pcvar_num(kz_ljs_enabled) )
  4163.         {
  4164.             set_hudmessage(255, 255, 255, -1.0, 0.65, 0, 0.0, 0.1, 0.0, 0.0, 2);
  4165.             if( !pluginstatus )
  4166.             {
  4167.                 ColorChat(0, BLUE, "^x04[XJ] ^x01%s ^x04plugin^x03 enabled ^x04!", gPLUGIN);
  4168.                 pluginstatus = INFO_ONE;
  4169.             }
  4170.         }
  4171.         else
  4172.         {
  4173.             if( pluginstatus )
  4174.             {
  4175.                 ColorChat(0, RED, "^x04[XJ] ^x01%s ^x04plugin^x03 disabled ^x04!", gPLUGIN);
  4176.                 pluginstatus = INFO_ZERO;
  4177.             }
  4178.         }
  4179.     }
  4180.     static id, fastserver, speedtype, spectatedplayer, alive, aliveflags, specflags;
  4181.     fastserver = get_pcvar_num(kz_ljs_fastserver);
  4182.     speedtype = get_pcvar_num(kz_ljs_speedtype);
  4183.     for( id = INFO_ONE; id < 33; id++ )
  4184.     {
  4185.         if( pev_valid(id) && pluginstatus )
  4186.         {
  4187.             alive = is_user_alive(id);
  4188.             aliveflags = pev(id, pev_flags);
  4189.             spectatedplayer = get_spectated_player(id);
  4190.             if( spectatedplayer )
  4191.                 specflags = pev(spectatedplayer, pev_flags);
  4192.             else
  4193.                 specflags = INFO_ZERO;
  4194.             if( alive || spectatedplayer )
  4195.             {
  4196.                 if( alive )
  4197.                 {
  4198.                     pev(id, pev_velocity, vVelocity);
  4199.                     if( aliveflags&FL_ONGROUND && aliveflags&FL_INWATER )
  4200.                         vVelocity[2]-=vVelocity[2];
  4201.                 }
  4202.                 else
  4203.                 {
  4204.                     pev(spectatedplayer, pev_velocity, vVelocity);
  4205.                     if( specflags&FL_ONGROUND && specflags&FL_INWATER )
  4206.                         vVelocity[2]-=vVelocity[2];
  4207.                 }
  4208.                
  4209.                 if( fastserver == 2 && gHasSpeed[id] )
  4210.                 {
  4211.                     if( task_exists(id+334490, 0) )
  4212.                         remove_task(id+334490, 0);
  4213.                    
  4214.                     if( speedtype == 1 )
  4215.                         show_hudmessage(id, "%d units/second", floatround(vector_length(vVelocity), floatround_floor));
  4216.                     else if( speedtype == 2 )
  4217.                     {
  4218.                         if( vVelocity[2] != 0 )
  4219.                             vVelocity[2]-=vVelocity[2];
  4220.                         gSpeed = vector_length(vVelocity);
  4221.                         show_hudmessage(id, "%d velocity", floatround(gSpeed, floatround_floor));
  4222.                     }
  4223.                     else
  4224.                     {
  4225.                         if( vVelocity[2] != 0 )
  4226.                             vVelocity[2]-=vVelocity[2];
  4227.                         gSpeed = vector_length(vVelocity);
  4228.                         if( alive )
  4229.                         {
  4230.                             pev(id, pev_velocity, vVelocity);
  4231.                             if( aliveflags&FL_ONGROUND && aliveflags&FL_INWATER )
  4232.                                 vVelocity[2]-=vVelocity[2];
  4233.                         }
  4234.                         else
  4235.                         {
  4236.                             pev(spectatedplayer, pev_velocity, vVelocity);
  4237.                             if( specflags&FL_ONGROUND && specflags&FL_INWATER )
  4238.                                 vVelocity[2]-=vVelocity[2];
  4239.                         }
  4240.                         show_hudmessage(id, "%d units/second^n%d velocity", floatround(vector_length(vVelocity), floatround_floor), floatround(gSpeed, floatround_floor));
  4241.                     }          
  4242.                 }
  4243.                 else if( gHasSpeed[id]
  4244.                 && fastserver != 2
  4245.                 && !task_exists(id+334490, 0) )
  4246.                 {
  4247.                     if( fastserver )
  4248.                         set_task(0.1, "tskSpeed", id+334490, "", 0, "b", 0);
  4249.                     else
  4250.                         set_task(0.5, "tskSpeed", id+334490, "", 0, "b", 0);
  4251.                 }
  4252.             }
  4253.         }
  4254.     }
  4255.    
  4256.     return FMRES_IGNORED;
  4257. }
  4258.  
  4259. public fwdPlayerPreThink(id)
  4260. {
  4261.     if( is_user_alive(id) && get_pcvar_num(kz_ljs_enabled) )
  4262.     {      
  4263.         static Float:fGravity;
  4264.         pev(id, pev_gravity, fGravity);
  4265.        
  4266.         pev(id, pev_origin, vOrigin);
  4267.         fDistance = get_distance_f(vOldOrigin[id], vOrigin);
  4268.  
  4269.         weapSpeedOld[id] = weapSpeed[id];
  4270.  
  4271.         pev(id, pev_origin, vOldOrigin[id]);
  4272.  
  4273.         pev(id, pev_velocity, vVelocity);
  4274.         if( vVelocity[2] != 0 )
  4275.             vVelocity[2]-=vVelocity[2];
  4276.  
  4277.         pev(id, pev_maxspeed, weapSpeed[id]);
  4278. //1111
  4279. //      static flags, buttons, oldbuttons;
  4280. //      if (weapSpeed > 250)
  4281. //      {
  4282. //          static Float:baseveloc[3];
  4283. //          pev(id, pev_basevelocity, baseveloc);
  4284. //          client_print(id, print_chat,"baseveloc[0] %f baseveloc[1] %f baseveloc[2] %f",baseveloc[0],baseveloc[1],baseveloc[2]);
  4285. //      }
  4286.        
  4287.         if( vector_length(vVelocity) > (fMaxGroundSpeed[id] + 105.0)
  4288.         || pev(id, pev_movetype) != MOVETYPE_WALK
  4289.         || fGravity != 1.0
  4290.         || get_pcvar_num(edgefriction) != 2
  4291.         || get_pcvar_num(mp_footsteps) != 1
  4292.         || get_pcvar_num(sv_cheats) != 0
  4293.         || get_pcvar_num(sv_gravity) != 800
  4294.         || get_pcvar_num(sv_airaccelerate) != 10
  4295.         || get_pcvar_num(sv_maxspeed) != 320
  4296.         || get_pcvar_num(sv_stepsize) != 18
  4297.         || get_pcvar_num(sv_maxvelocity) != 2000
  4298.         || pev(id, pev_waterlevel) >= 2
  4299.         || fDistance > 22
  4300.         || weapSpeedOld[id] != weapSpeed[id])
  4301.         {
  4302.             gocheckBoth(id);
  4303.  
  4304.             return FMRES_IGNORED;
  4305.         }
  4306.  
  4307.         static flags, oldbuttons;
  4308.         flags = pev(id, pev_flags);
  4309.         buttons = pev(id, pev_button);
  4310.         oldbuttons = pev(id, pev_oldbuttons);
  4311.  
  4312.         if( (gInAir[id] == true || isBhop[id] == true) && !(flags&FL_ONGROUND) )
  4313.         {
  4314.             static i;
  4315.             for( i = INFO_ZERO; i < 2; i++ )
  4316.             {
  4317.                 if( (i == 1)
  4318.                 || (vFramePos[id][i][0] == 0
  4319.                 && vFramePos[id][i][1] == 0
  4320.                 && vFramePos[id][i][2] == 0
  4321.                 && vFrameSpeed[id][i][0] == 0
  4322.                 && vFrameSpeed[id][i][1] == 0
  4323.                 && vFrameSpeed[id][i][2] == 0 )) //or amxx platform very intellectual :D
  4324.                 {
  4325.                     //pev(id, pev_origin, vOrigin);
  4326.                     vFramePos[id][i][0] = vOrigin[0];
  4327.                     vFramePos[id][i][1] = vOrigin[1];
  4328.                     vFramePos[id][i][2] = vOrigin[2];
  4329.                    
  4330.                     pev(id, pev_velocity, vVelocity);
  4331.                     vFrameSpeed[id][i][0] = vVelocity[0];
  4332.                     vFrameSpeed[id][i][1] = vVelocity[1];
  4333.                     vFrameSpeed[id][i][2] = vVelocity[2];
  4334.                     i=2;
  4335.                     //client_print(id, print_console,"Numb Origin %f %f %f", vOrigin[0],vOrigin[1],vOrigin[2]);
  4336.                 }
  4337.             }
  4338.         }
  4339.  
  4340.         pev(id, pev_velocity, vVelocity);
  4341.         //if (weapSpeed == 260)
  4342.         //  client_print(id, print_console,"Pre %f  %f  %f  %f  %f  %f", vOrigin[0],vOrigin[1],vOrigin[2],vVelocity[0],vVelocity[1],vVelocity[2]);
  4343.  
  4344.         pev(id, pev_velocity, vVelocity);
  4345.         if( flags&FL_ONGROUND && flags&FL_INWATER )  //??
  4346.             vVelocity[2] = 0.0;
  4347.         fSpeed = vector_length(vVelocity);
  4348.  
  4349.         if( vVelocity[2] != 0 )
  4350.             vVelocity[2]-=vVelocity[2];
  4351.  
  4352.         gSpeed = vector_length(vVelocity);
  4353.  
  4354.         if( !(flags&FL_ONGROUND) )
  4355.             lasttime[id] = get_gametime()
  4356.  
  4357.         if( gInAir[id] || isBhop[id])
  4358.         {
  4359.             if (((vOrigin[2] + 18.0 - vJumpedAt[id][2]) < 0)
  4360.                 && !(flags&FL_ONGROUND) )
  4361.             {
  4362.                 fallDown[id] = true;
  4363.                 static Float:fJAt2;
  4364.                 fJAt2 = vJumpedAt[id][2];
  4365.  
  4366.                 if( is_in_duck(id) )
  4367.                 {
  4368.                     vOrigin[2]-=18.0;
  4369.                     fJAt2-=18.0;
  4370.                 }
  4371.  
  4372.                 static Float:koeff1;
  4373.                 koeff1 = (fJAt2-vLastFrameOrigin[id][2])/(vOrigin[2]-vLastFrameOrigin[id][2]);
  4374.  
  4375.                 vLastFrameOrigin[id][2] = fJAt2;
  4376.                 vLastFrameOrigin[id][0] = koeff1*(vOrigin[0]-vLastFrameOrigin[id][0])+vLastFrameOrigin[id][0];
  4377.                 vLastFrameOrigin[id][1] = koeff1*(vOrigin[1]-vLastFrameOrigin[id][1])+vLastFrameOrigin[id][1];
  4378.  
  4379.                 //TODO make it better
  4380.             }
  4381.             else
  4382.             {
  4383.                 fallDown[id] = false;
  4384.                 vLastFrameOrigin[id] = vOrigin;
  4385.                 vOrigin[2] = vJumpedAt[id][2];
  4386.             }
  4387.        
  4388. /*          if( flags&FL_ONGROUND )
  4389.             {
  4390.                 fallDown[id] = false;
  4391.                
  4392.                 //vOrigin[2] = vJumpedAt[id][2];   
  4393.             }
  4394.             //vLastFrameOrigin[id] = vOrigin;*/
  4395.  
  4396.             if( gSpeed > fMaxAirSpeed[id] )
  4397.             {
  4398.                 if (strafes[id] < NSTRAFES)
  4399.                 {
  4400.                     strafe_stat_speed[id][strafes[id]][0] += gSpeed - fMaxAirSpeed[id];
  4401.                 }
  4402.                 fMaxAirSpeed[id] = gSpeed;
  4403.             }
  4404.             if ((gSpeed < TempSpeed[id]) && (strafes[id] < NSTRAFES))
  4405.             {
  4406.                 strafe_stat_speed[id][strafes[id]][1] += TempSpeed[id] - gSpeed;
  4407.             }
  4408.             TempSpeed[id] = gSpeed;
  4409.         }
  4410.  
  4411.         maxPreSpeedWeapon = weapSpeed[id]*1.115;
  4412.         maxBhopPreSpeedWeap = weapSpeed[id]*1.2;
  4413.  
  4414.         if( isBhop[id] )
  4415.         {  
  4416.             if (flags&FL_ONGROUND || fallDown[id])
  4417.             {
  4418.                 func69(id, TYPE_BJ);   
  4419.  
  4420.                 //is it good, mb better to do it with pev_flDuckTime ?
  4421.                 if (vFrameSpeed[id][0][2] > 229)
  4422.                     jumptype[id] = TYPE_SBJ;
  4423.                 else
  4424.                     jumptype[id] = TYPE_BJ;
  4425.  
  4426.                 if( ((vJumpedAt[id][2] == vOrigin[2]) || fallDown[id] )
  4427.                 && fDistance > get_pcvar_float(kz_min_bhop)
  4428.                 && !(fDistance > get_pcvar_float(kz_max_lj)) )         
  4429.                 {
  4430.                     sync_ = INFO_ZERO;
  4431.                     strMess[0] = '^0'; //unnecessary?
  4432.                     strMessBuf[0] = '^0'; //unnecessary?
  4433.                     strLen = INFO_ZERO;
  4434.                     badSyncTemp = INFO_ZERO;
  4435.                     goodSyncTemp = INFO_ZERO;
  4436.  
  4437.                     Fulltime = lasttime[id]-jumptime[id];
  4438.                    
  4439.                     if(strafes[id] < NSTRAFES)
  4440.                     {
  4441.                         strafe_stat_time[id][0] = jumptime[id];
  4442.                         strafe_stat_time[id][strafes[id]] = lasttime[id];
  4443.                        
  4444.                         for(jj = INFO_ONE;jj <= strafes[id]; jj++)
  4445.                         {
  4446.                             time_ = ((strafe_stat_time[id][jj] - strafe_stat_time[id][jj-1])*100) / (Fulltime);
  4447.                             if ((strafe_stat_sync[id][jj][0]+strafe_stat_sync[id][jj][1]) > 0)
  4448.                             {
  4449.                                 sync_ = (strafe_stat_sync[id][jj][0] * 100)/(strafe_stat_sync[id][jj][0]+strafe_stat_sync[id][jj][1]); //using like a buffer       
  4450.                             }              
  4451.                             else
  4452.                             {
  4453.                                 sync_ = 0;
  4454.                             }
  4455.                             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_);
  4456.  
  4457.                             goodSyncTemp += strafe_stat_sync[id][jj][0];
  4458.                             badSyncTemp += strafe_stat_sync[id][jj][1];
  4459.                         }
  4460.                         if (jumptype[id] == TYPE_SBJ)
  4461.                         {
  4462.                             strLen += format(strMess[strLen],(40*NSTRAFES)-strLen-1, "^tStand-up");
  4463.                         }
  4464.                     }
  4465.    
  4466.                     //Standart Sync
  4467.                     if( goodSyncTemp > 0 )
  4468.                         sync_ = (goodSyncTemp*100/(goodSyncTemp+badSyncTemp));
  4469.                     else
  4470.                         sync_ = INFO_ZERO;
  4471.                    
  4472.                     if( !(possible_lj_script[id][0] || possible_lj_script[id][1] || fallDown[id] || weapSpeed[id] != 250.0 || pev(id, pev_fuser2) == 0.0))
  4473.                     {
  4474.                         check_maintop(id, floatround((fDistance*1000000), floatround_floor), floatround((fMaxAirSpeed[id]*1000000), floatround_floor), floatround((fMaxGroundSpeed[id]*1000000), floatround_floor), strafes[id], sync_, jumptype[id]);
  4475.                     }
  4476.  
  4477.                     ljStatsRed = get_pcvar_num(kz_ljstats_red);
  4478.                     ljStatsGreen = get_pcvar_num(kz_ljstats_green);
  4479.                     ljStatsBlue = get_pcvar_num(kz_ljstats_blue);
  4480.                     ljs_beam = get_pcvar_num(kz_ljs_beam);
  4481.                     static i;
  4482.                    
  4483.                     if( gHasLjStats[id] && bljbeam[id] )
  4484.                     {
  4485.                         i = DrawBeam(id, ljs_beam, 1);
  4486.                     }
  4487.  
  4488.                     static strdist[128];
  4489.                     num_to_word(floatround(fDistance, floatround_floor), strdist, 127);
  4490.  
  4491.                     for( i = INFO_ONE; i < 33; i++ )
  4492.                     {
  4493.                         if( (i == id || is_user_spectating_player(i, id)) && gHasLjStats[i] )
  4494.                         {
  4495.                             copy(strMessBuf,strLen,strMess);
  4496.  
  4497.                             if ( fallDown[id] || weapSpeed[id] != 250.0 || pev(id, pev_fuser2) == 0.0)
  4498.                             {
  4499.                                 set_hudmessage(255, 0, 109, -1.0, 0.70, 0, 0.0, (vBeamLastTime[id]*0.1), 0.1, 0.1, 3);
  4500.                             }
  4501.                             else
  4502.                             {
  4503.                                 set_hudmessage(ljStatsRed, ljStatsGreen, ljStatsBlue, -1.0, 0.70, 0, 0.0, (vBeamLastTime[id]*0.1), 0.1, 0.1, 3);
  4504.                             }
  4505.  
  4506.                             show_hudmessage(i, "Bhop Distance: %f^nMaxSpeed: %f (%.3f)^nPreStrafe: %f (%.3f)^nStrafes: %d^nSync: %d%%", fDistance, fMaxAirSpeed[id], fMaxAirSpeed[id] - fMaxGroundSpeed[id], fMaxGroundSpeed[id],fMaxGroundBhopSpeed[id], strafes[id], sync_ );
  4507.                             client_print(i, print_console, "Bhop Distance: %f MaxSpeed: %f (%.3f) PreStrafe: %f (%.3f) Strafes: %d Sync: %d", fDistance, fMaxAirSpeed[id], fMaxAirSpeed[id] - fMaxGroundSpeed[id], fMaxGroundSpeed[id],fMaxGroundBhopSpeed[id], strafes[id], sync_ );
  4508.                             if ( StrafeStat[i] && strLen != 0 )
  4509.                             {
  4510.                                 if ( fallDown[id] || weapSpeed[id] != 250.0 || pev(id, pev_fuser2) == 0.0)
  4511.                                 {
  4512.                                     set_hudmessage(255, 0, 109, 0.70, 0.35, 0, 0.0, (vBeamLastTime[id]*0.1), 0.1, 0.1, 4);
  4513.                                 }
  4514.                                 else
  4515.                                 {
  4516.                                     set_hudmessage(ljStatsRed, ljStatsGreen, ljStatsBlue, 0.70, 0.35, 0, 0.0, (vBeamLastTime[id]*0.1), 0.1, 0.1, 4);
  4517.                                 }
  4518.                                 show_hudmessage(i,"%s",strMessBuf);
  4519.                                 static strMessHalf[40];
  4520.  
  4521.                                 for(jj=INFO_ONE; (jj <= strafes[id]) && (jj < NSTRAFES);jj++)
  4522.                                 {
  4523.                                     strtok(strMessBuf,strMessHalf,40,strMessBuf,40*NSTRAFES,'^n');
  4524.                                     replace(strMessHalf,40,"^n","");
  4525.                                     client_print(i, print_console, "%s", strMessHalf)
  4526.                                 }
  4527.                             }
  4528.  
  4529.                             if( possible_lj_script[id][0] || possible_lj_script[id][1] )
  4530.                             {
  4531.                                 if( possible_lj_script[id][0] && possible_lj_script[id][1] )
  4532.                                     client_print(i, print_center, "No ljtop access (possible lj script)");
  4533.                                 else
  4534.                                     client_print(i, print_center, "No ljtop access (possible %s script)", (possible_lj_script[id][0])?"prestrafe":"strafe");
  4535.                             }
  4536.                                
  4537.                             if( get_pcvar_num(kz_lj_sounds) == 2 && gHasColorChat[i] && !(fallDown[id]) && weapSpeed[id] == 250.0 && pev(id, pev_fuser2) > 0.0)
  4538.                                 client_cmd(i, "speak ^"vox/%s uniform(e30) it south(e15)^"", strdist);
  4539.  
  4540.                             if( i != id && (ljs_beam == 1 || ljs_beam == 2) && bljbeam[i] )
  4541.                             {
  4542.                                 DrawSpecBeam(i);
  4543.                             }
  4544.                         }
  4545.                     }
  4546.                     if (!(fallDown[id]) && weapSpeed[id] == 250.0 && pev(id, pev_fuser2) > 0.0)
  4547.                     {
  4548.                         static Float:max_lj, Float:leet_lj, Float:pro_lj, Float:good_lj, ljtop, Float:god_lj;
  4549.                         ljtop = get_pcvar_num(kz_ljs_tops);
  4550.  
  4551.                         if( (!(possible_lj_script[id][0] || possible_lj_script[id][1] )) && (ljtop == 1 || ljtop == 3) )
  4552.                         {
  4553.  
  4554.                             max_lj = get_pcvar_float(kz_max_lj);
  4555.                         /*  leet_lj = get_pcvar_float(kz_leet_lj) - 10;
  4556.                             pro_lj = get_pcvar_float(kz_pro_lj) - 10;
  4557.                             good_lj = get_pcvar_float(kz_good_lj) - 10;
  4558.                             ljtop = get_pcvar_num(kz_ljs_tops);
  4559.                         */
  4560.                             leet_lj = 240.0;
  4561.                             pro_lj = 235.0;
  4562.                             good_lj = 230.0;
  4563.                             god_lj = 245.0;
  4564.  
  4565.                             if( fDistance < max_lj
  4566.                             && !(fDistance < god_lj)
  4567.                             && !(0 > god_lj))
  4568.                             {
  4569.                                 PrintChatMess(id, 3, DIST_GOD, jumptype[id]);
  4570.                             }
  4571.                             else if( fDistance < max_lj
  4572.                             && !(fDistance < leet_lj)
  4573.                             && !(0 > leet_lj))
  4574.                             {
  4575.                                 PrintChatMess(id, get_pcvar_num(kz_leet_lj_clr), DIST_LEET, jumptype[id]);
  4576.                             }              
  4577.                             else if( fDistance < max_lj
  4578.                             && !(fDistance < pro_lj)
  4579.                             && !(0 > pro_lj))
  4580.                             {
  4581.                                 PrintChatMess(id, get_pcvar_num(kz_pro_lj_clr), DIST_PRO, jumptype[id]);
  4582.                             }                      
  4583.                             else if( fDistance < max_lj
  4584.                             && !(fDistance < good_lj)
  4585.                             && !(0 > good_lj))
  4586.                             {
  4587.                                 PrintChatMess(id, get_pcvar_num(kz_good_lj_clr), DIST_GOOD, jumptype[id]);
  4588.                             }
  4589.                         }
  4590.                     }
  4591.                 }
  4592.                 jumptype[id] = TYPE_NONE;
  4593.             }
  4594.         }
  4595.         else
  4596.         {
  4597.             if( testBhop[id] && buttons&IN_JUMP && !(oldbuttons&IN_JUMP) && flags&FL_ONGROUND)
  4598.             {
  4599.                 set_task(0.71,"gocheckbhop", id);
  4600.                
  4601.                 //client_print(id, print_console, "fMaxGroundBhopSpeed %f gSpeed %f fMaxGroundSpeed %f fMaxAirSpeed[id] %f OldSpeed[id] %f",fMaxGroundBhopSpeed[id], gSpeed, fMaxGroundSpeed[id], fMaxAirSpeed[id],OldSpeed[id]);
  4602.                 fMaxGroundBhopSpeed[id] = gSpeed - fMaxAirSpeed[id];
  4603.                 fMaxGroundSpeed[id] = gSpeed;
  4604.                 fMaxAirSpeed[id] = gSpeed;
  4605.  
  4606.                 //client_print(id, print_console, "fMaxGroundBhopSpeed %f gSpeed %f fMaxGroundSpeed %f fMaxAirSpeed[id] %f OldSpeed[id] %f",fMaxGroundBhopSpeed[id], gSpeed, fMaxGroundSpeed[id], fMaxAirSpeed[id],OldSpeed[id]);
  4607.                 set_hudmessage(255, 255, 255, -1.0, 0.70, 0, 0.0, 0.7, 0.1, 0.1, 3);
  4608.                 static i;
  4609.  
  4610. /*
  4611.                 if (fMaxGroundSpeed[id] > maxBhopPreSpeedWeap)
  4612.                 {
  4613.                     for( i = INFO_ONE; i < 33; i++ )
  4614.                     {
  4615.                         if( (i == id || is_user_spectating_player(i, id)) && gHasLjStats[i])
  4616.                         {
  4617.                             show_hudmessage(i, "Prestrafe: %f (%.3f)^nYour Maxspeed was too high^nMaxspeed have to be under %.3f", fMaxGroundSpeed[id], fMaxGroundBhopSpeed[id], maxBhopPreSpeedWeap);
  4618.                             //client_print(i, print_console, "Prestrafe: %f (%.3f) Your Maxspeed was too high, Maxspeed have to be under %.3f", fMaxGroundSpeed[id], fMaxGroundBhopSpeed[id], maxBhopPreSpeedWeap);
  4619.                         }
  4620.                     }
  4621.                 }
  4622.                 else
  4623.                 {
  4624.                     for( i = INFO_ONE; i < 33; i++ )
  4625.                     {
  4626.                         if( (i == id || is_user_spectating_player(i, id)) && gHasLjStats[i])
  4627.                         {
  4628.                             show_hudmessage(i, "Prestrafe: %f (%.3f)", fMaxGroundSpeed[id], fMaxGroundBhopSpeed[id]);
  4629.                             //client_print(i, print_console, "Prestrafe: %f (%.3f)", fMaxGroundSpeed[id], fMaxGroundBhopSpeed[id]);
  4630.                         }
  4631.                     }
  4632.                 }
  4633. */
  4634.                 if (fMaxGroundSpeed[id] < maxBhopPreSpeedWeap)
  4635.                 {
  4636.                     for( i = INFO_ONE; i < 33; i++ )
  4637.                     {
  4638.                         if( (i == id || is_user_spectating_player(i, id)) && gHasLjStats[i])
  4639.                         {
  4640.                             show_hudmessage(i, "Prestrafe: %f (%.3f)", fMaxGroundSpeed[id], fMaxGroundBhopSpeed[id]);
  4641.                             client_print(i, print_console, "OLDPrestrafe: %f (%.3f)", fMaxGroundSpeed[id], fMaxGroundBhopSpeed[id]);
  4642.                         }
  4643.                     }
  4644.                 }
  4645.                 isBhop[id] = true;
  4646.                 testBhop[id] = false;
  4647.                 jumptype[id] = TYPE_NONE; // ???
  4648.  
  4649.             }
  4650.             else
  4651.             { //TODO pravilnie yslovi9??
  4652.                 if( testBhop[id] && (isBhop[id] == false))
  4653.                 {
  4654.                     if (!(buttons&IN_JUMP) && oldbuttons&IN_JUMP)
  4655.                     {
  4656.                         //client_print(id, print_console, "slishkom rano");
  4657.                         set_hudmessage(255, 0, 109, -1.0, 0.70, 0, 0.0, 0.5, 0.1, 0.1, 3);
  4658.                         static i;
  4659.                         for( i = INFO_ONE; i < 33; i++ )
  4660.                         {
  4661.                             if( (i == id || is_user_spectating_player(i, id)) && gHasLjStats[i])
  4662.                             {
  4663.                                 show_hudmessage(id,"You pressed jump too early");
  4664.                                 //client_print(id, print_console, "You pressed jump too early");
  4665.                             }
  4666.                         }
  4667.                     }
  4668.                     jumptype[id] = TYPE_NONE;
  4669.                 }
  4670.                 testBhop[id] = false;
  4671.             }
  4672.  
  4673.             if( buttons&IN_JUMP
  4674.             && !(oldbuttons&IN_JUMP)
  4675.             && flags&FL_ONGROUND
  4676.             && gInAir[id] == false )
  4677.             {
  4678.                 pev(id, pev_origin, vOrigin);
  4679.  
  4680.                 static Float:temp[3],Float:temp2[3];
  4681.                 temp[0] = vFallAt[id][0];
  4682.                 temp[1] = vFallAt[id][1];
  4683.                 temp[2] = 0.0;
  4684.  
  4685.                 temp2[0] = vOrigin[0];
  4686.                 temp2[1] = vOrigin[1];
  4687.                 temp2[2] = 0.0;
  4688.  
  4689.                 //client_print(id, print_console,"wj %f",get_distance_f(vFallAt[id], vOrigin) );
  4690.                 //client_print(id, print_console,"wj %f",get_distance_f(temp, temp2) );
  4691.  
  4692.                 if (jumptype[id] == TYPE_WJ && get_distance_f(temp, temp2) > 5.2)
  4693.                 {
  4694.                     jumptype[id] = TYPE_NONE;
  4695.  
  4696.                     if ( get_distance_f(temp, temp2) < 12.0 )
  4697.                     {
  4698.                         gocheck(id);
  4699.  
  4700.                         //BUGBUGBUG it possible to do CJ with good prestrafe after unsucessfull Wj
  4701.  
  4702.                         //client_print(id, print_chat,"obnylili wj %f",get_distance_f(vFallAt[id], vOrigin) ); 
  4703.                         return FMRES_IGNORED;
  4704.                     }
  4705.                 }
  4706.                 set_task(0.8,"gocheck", id);
  4707.            
  4708.                 jumptime[id] = get_gametime();
  4709.                 static i;
  4710.                 gInAir[id] = true
  4711.  
  4712.                 //strafecounter_oldbuttons[id] = 0;
  4713.                 //TODO is such IF is right? i think that isBhop[id] is useless
  4714.                 if (!isBhop[id] && !testBhop[id])
  4715.                 {
  4716.                     //vOldOrigin2[id] = vOrigin[2];
  4717.                     fMaxGroundSpeed[id] = fSpeed;
  4718.                     fMaxAirSpeed[id] = fSpeed;
  4719.                     vJumpedAt[id][2] = vOrigin[2];
  4720.  
  4721.                     //strafecounter_oldbuttons[id] = buttons;
  4722.                 }
  4723.                 strafecounter_oldbuttons[id] = INFO_ZERO;
  4724.                    
  4725.                 fallDown[id] = false;
  4726.    
  4727.                 vJumpedAt[id][0] = vOrigin[0];
  4728.                 vJumpedAt[id][1] = vOrigin[1];
  4729.                
  4730.                 //client_print(id, print_console,"Numb JAT %f %f %f",vOrigin[0], vOrigin[1],vOrigin[2]);
  4731.            
  4732.                 if( doubleducked[id] && vOrigin[2] == vDuckedAt[id][2] )
  4733.                     cjumped[id] = true;
  4734.                 else
  4735.                     cjumped[id] = false;
  4736.            
  4737.                 doubleducked[id] = false;
  4738.            
  4739.                 strafes[id] = INFO_ZERO;
  4740.    
  4741.                 TempSpeed[id] = 0.0;
  4742.                 //vOrigin[2] -= 70;
  4743.                 //engfunc( EngFunc_TraceHull, vJumpedAt[id], vOrigin, DONT_IGNORE_MONSTERS, HULL_HUMAN, id, 0 );
  4744.                 //vJumpedAtEnt[id] = get_tr2( 0, TR_pHit );
  4745.  
  4746.                 for( i = INFO_ZERO; i < NSTRAFES; i++ )
  4747.                 {
  4748.                     strafe_stat_speed[id][i][0] = 0.0;
  4749.                     strafe_stat_speed[id][i][1] = 0.0;
  4750.                     strafe_stat_sync[id][i][0] = INFO_ZERO;
  4751.                     strafe_stat_sync[id][i][1] = INFO_ZERO;
  4752.                     strafe_stat_time[id][i] = 0.0;
  4753.                 }
  4754.            
  4755.                 turning_right[id] = false;
  4756.                 turning_left[id] = false;
  4757.                 strafing_aw[id] = false;
  4758.                 strafing_sd[id] = false;
  4759.  
  4760.                 ljhel[id][0] = 0.0;
  4761.                 ljhel[id][1] = 0.0;
  4762.                 ljhel[id][2] = 0.0;
  4763.  
  4764.                 if( cjumped[id] == false )
  4765.                 {
  4766.                     vBeamLastTime[id] = 0.0;
  4767.                     beam_jump_off_time[id] = jumptime[id];
  4768.                     for( i = INFO_ZERO; i < 127; i++ )
  4769.                     {
  4770.                         vBeamPos[id][i][0] = 0.0;
  4771.                         vBeamPos[id][i][1] = 0.0;
  4772.                         vBeamPos[id][i][2] = 0.0;
  4773.                         vBeamTime[id][i] = 0.0;
  4774.                     }
  4775.                     if (jumptype[id] != TYPE_WJ)
  4776.                         jumptype[id] = TYPE_LJ;
  4777.                 }
  4778.                 /*else if (isBhop[id] == true)
  4779.                 {
  4780.                     //TODO: we really need this here??
  4781.                     jumptype[id] = TYPE_BJ;
  4782.                 }*/
  4783.                 else
  4784.                 {
  4785.                     jumptype[id] = TYPE_CJ;
  4786.                 }
  4787.  
  4788.                 for( i = INFO_ZERO; i < 2; i++ )
  4789.                 {
  4790.                     vFramePos[id][i][0] = 0.0;
  4791.                     vFramePos[id][i][1] = 0.0;
  4792.                     vFramePos[id][i][2] = 0.0;
  4793.            
  4794.                     vFrameSpeed[id][i][0] = 0.0;
  4795.                     vFrameSpeed[id][i][1] = 0.0;
  4796.                     vFrameSpeed[id][i][2] = 0.0;
  4797.                 }
  4798.  
  4799.                 if( jumptype[id] == TYPE_WJ && !(is_in_duck(id)) )
  4800.                 {
  4801.                     set_hudmessage(255, 255, 255, -1.0, 0.70, 0, 0.0, 0.7, 0.1, 0.1, 3);
  4802.                     if (fSpeed > maxBhopPreSpeedWeap)
  4803.                     {
  4804.                         //TODO redone it in PostThink with better msg
  4805.                         for( i = INFO_ONE; i < 33; i++ )
  4806.                         {
  4807.                             if( (i == id || is_user_spectating_player(i, id)) && gHasLjStats[i])
  4808.                             {
  4809.                                 show_hudmessage(i, "Prestrafe: %f ^nYour Maxspeed was too high^nMaxspeed have to be under %.3f", fMaxGroundSpeed[id], maxBhopPreSpeedWeap);
  4810.                                 client_print(i, print_console, "OLDPrestrafe: %f ^nYour Maxspeed was too high^nMaxspeed have to be under %.3f", fMaxGroundSpeed[id], maxBhopPreSpeedWeap);
  4811.                             }
  4812.                         }
  4813.                     }
  4814.                     else
  4815.                     {
  4816.                         for( i = INFO_ONE; i < 33; i++ )
  4817.                         {
  4818.                             if( (i == id || is_user_spectating_player(i, id)) && gHasLjStats[i])
  4819.                             {
  4820.                                 show_hudmessage(i, "Prestrafe: %f", fMaxGroundSpeed[id]);
  4821.                                 client_print(i, print_console, "OLDPrestrafe: %f", fMaxGroundSpeed[id]);
  4822.                             }
  4823.                         }
  4824.                     }
  4825.                 }
  4826.  
  4827.                 vFallAt[id][0] = 0.0;
  4828.                 vFallAt[id][1] = 0.0;
  4829.                 vFallAt[id][2] = 0.0;
  4830.  
  4831.                 //client_print(id, print_console,"wj jumptype[id] %d",jumptype[id] );
  4832.  
  4833.             //  if (weapSpeed[id] > 250)
  4834.         //      {
  4835.     //              client_print(id, print_chat,"vot i prignyli %d flag1 %d ",jumptype[id],flags&FL_ONGROUND);
  4836. //              }
  4837.  
  4838.             }
  4839.             else if( ( fallDown[id] || flags&FL_ONGROUND ) && gInAir[id])
  4840.             {      
  4841. //              if (weapSpeed[id] > 250)
  4842. //              {
  4843. //                  client_print(id, print_chat,"vot i prizemlilis %d",jumptype[id]);
  4844. //              }
  4845.                 func69(id, TYPE_LCHJ);
  4846. //              if (weapSpeed[id] > 250)
  4847. //              {
  4848. //                  client_print(id, print_chat,"vot i prizemlilis2 %d",jumptype[id]);
  4849. //              }
  4850.  
  4851.                 vJumpedAt[id][0] = vFramePos[id][1][0];        //for bhop
  4852.                 vJumpedAt[id][1] = vFramePos[id][1][1];        //for bhop
  4853.  
  4854.                 if (!fallDown[id]
  4855.                 && vJumpedAt[id][2] == vOrigin[2]
  4856.                 && fm_get_user_longjump(id) == false)
  4857.                     testBhop[id] = true;
  4858.                    
  4859.  
  4860.  
  4861.                 if ((vJumpedAt[id][2] == vOrigin[2]) || fallDown[id] )
  4862.                 {
  4863.                     strMess[0] = '^0'; //unnecessary?
  4864.                     strLen = INFO_ZERO;
  4865.                     sync_ = INFO_ZERO;
  4866.                     badSyncTemp = INFO_ZERO;
  4867.                     goodSyncTemp = INFO_ZERO;
  4868.    
  4869.                     Fulltime = lasttime[id]-jumptime[id];
  4870.    
  4871.                     if(strafes[id] < NSTRAFES)
  4872.                     {
  4873.                         strafe_stat_time[id][0] = jumptime[id];
  4874.                         strafe_stat_time[id][strafes[id]] = lasttime[id];
  4875.    
  4876.                         for(jj = 1;jj <= strafes[id]; jj++)
  4877.                         {
  4878.                             time_ = ((strafe_stat_time[id][jj] - strafe_stat_time[id][jj-1])*100) / (Fulltime);
  4879.                             if ((strafe_stat_sync[id][jj][0]+strafe_stat_sync[id][jj][1]) > 0)
  4880.                             {
  4881.                                 sync_ = (strafe_stat_sync[id][jj][0] * 100)/(strafe_stat_sync[id][jj][0]+strafe_stat_sync[id][jj][1]); //using like a buffer       
  4882.                             }              
  4883.                             else
  4884.                             {
  4885.                                 sync_ = 0;
  4886.                             }
  4887.                             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_);
  4888.    
  4889.                             goodSyncTemp += strafe_stat_sync[id][jj][0];
  4890.                             badSyncTemp += strafe_stat_sync[id][jj][1];
  4891.                         }
  4892.                         if (jumptype[id] == TYPE_HJ)
  4893.                         {
  4894.                             strLen += format(strMess[strLen],(40*NSTRAFES)-strLen-1, "^t^tHJ");
  4895.                         }
  4896.                         //if (BlockDist > 210.0 && BlockDist < get_pcvar_float(kz_max_lj))
  4897.                         //  strLen += format(strMess[strLen],(40*NSTRAFES)-strLen-1, "Block %3.3f", BlockDist);
  4898.                         //strLen += format(strMess[strLen],(40*NSTRAFES)-strLen-1, "        WeirdJump");
  4899.                     }
  4900.  
  4901.                     //Standart Sync
  4902.                     if( goodSyncTemp > 0 )
  4903.                         sync_ = (goodSyncTemp*100/(goodSyncTemp+badSyncTemp));
  4904.                     else
  4905.                         sync_ = INFO_ZERO;
  4906.  
  4907.                     //weird jump
  4908.                     if(fDistance > get_pcvar_float(kz_min_lj) //TODO mb another cvar
  4909.                     && jumptype[id] == TYPE_WJ
  4910.                     && !(fDistance > get_pcvar_float(kz_max_lj) + 23.0) )
  4911.                     {
  4912.                         if( !(possible_lj_script[id][0] || possible_lj_script[id][1] || fallDown[id] || weapSpeed[id] != 250.0 || pev(id, pev_fuser2) == 0.0))
  4913.                         {
  4914.                             check_maintop(id, floatround((fDistance*1000000), floatround_floor), floatround((fMaxAirSpeed[id]*1000000), floatround_floor), floatround((fMaxGroundSpeed[id]*1000000), floatround_floor), strafes[id], sync_, TYPE_WJ);
  4915.                         }
  4916.                        
  4917.                         ljStatsRed = get_pcvar_num(kz_ljstats_red);
  4918.                         ljStatsGreen = get_pcvar_num(kz_ljstats_green);
  4919.                         ljStatsBlue = get_pcvar_num(kz_ljstats_blue);
  4920.                         ljs_beam = get_pcvar_num(kz_ljs_beam);
  4921.                         static i;
  4922.    
  4923.                         if( gHasLjStats[id] && bljbeam[id] )
  4924.                         {
  4925.                             DrawBeam(id, ljs_beam, 1);
  4926.                         }
  4927.  
  4928.                         static strdist[128];
  4929.                         num_to_word(floatround(fDistance, floatround_floor), strdist, 127);
  4930.                        
  4931.                         for( i = INFO_ONE; i < 33; i++ )
  4932.                         {
  4933.                             if( (i == id || is_user_spectating_player(i, id)) && gHasLjStats[i] )
  4934.                             {
  4935.                                 copy(strMessBuf,strLen,strMess);
  4936.  
  4937.                                 if ( fallDown[id] || weapSpeed[id] != 250.0 || pev(id, pev_fuser2) == 0.0)
  4938.                                 {
  4939.                                     set_hudmessage(255, 0, 109, -1.0, 0.70, 0, 0.0, (vBeamLastTime[id]*0.1), 0.1, 0.1, 3);
  4940.                                 }
  4941.                                 else
  4942.                                 {
  4943.                                     set_hudmessage(ljStatsRed, ljStatsGreen, ljStatsBlue, -1.0, 0.70, 0, 0.0, (vBeamLastTime[id]*0.1), 0.1, 0.1, 3);
  4944.                                 }
  4945.  
  4946.                                 show_hudmessage(i, "WJ Distance: %f^nMaxSpeed: %f (%.3f)^nPreStrafe: %f^nStrafes: %d^nSync: %d%%", fDistance, fMaxAirSpeed[id], fMaxAirSpeed[id] - fMaxGroundSpeed[id], fMaxGroundSpeed[id], strafes[id], sync_ );
  4947.                                 client_print(i, print_console, "WJ Distance: %f MaxSpeed: %f (%.3f) PreStrafe: %f Strafes: %d Sync: %d", fDistance, fMaxAirSpeed[id], fMaxAirSpeed[id] - fMaxGroundSpeed[id], fMaxGroundSpeed[id], strafes[id], sync_ );
  4948.                                
  4949.                                 if ( StrafeStat[i] && strLen != 0 )
  4950.                                 {
  4951.                                     if ( fallDown[id] || weapSpeed[id] != 250.0)
  4952.                                     {
  4953.                                         set_hudmessage(255, 0, 109, 0.70, 0.35, 0, 0.0, ((vBeamLastTime[id]*0.1)), 0.1, 0.1, 4);
  4954.                                     }
  4955.                                     else
  4956.                                     {
  4957.                                         set_hudmessage(ljStatsRed, ljStatsGreen, ljStatsBlue, 0.70, 0.35, 0, 0.0, ((vBeamLastTime[id]*0.1)), 0.1, 0.1, 4);
  4958.                                     }
  4959.                                     show_hudmessage(i,"%s",strMessBuf);
  4960.                                     static strMessHalf[40];
  4961.                                     //if (jumptype[id] == TYPE_HJ || (BlockDist > 210.0 && BlockDist < get_pcvar_float(kz_max_lj)))
  4962.                                     //  strafes[id] += 1;
  4963.                                     for(jj=INFO_ONE; (jj <= strafes[id]) && (jj < NSTRAFES);jj++)
  4964.                                     {
  4965.                                         strtok(strMessBuf,strMessHalf,40,strMessBuf,40*NSTRAFES,'^n');
  4966.                                         replace(strMessHalf,40,"^n","");
  4967.                                         client_print(i, print_console, "%s", strMessHalf)
  4968.                                     }
  4969.                                 }
  4970.    
  4971.                                 if( possible_lj_script[id][0] || possible_lj_script[id][1] )
  4972.                                 {
  4973.                                     if( possible_lj_script[id][0] && possible_lj_script[id][1] )
  4974.                                         client_print(i, print_center, "No ljtop access (possible lj script)");
  4975.                                     else
  4976.                                         client_print(i, print_center, "No ljtop access (possible %s script)", (possible_lj_script[id][0])?"prestrafe":"strafe");
  4977.                                 }
  4978.                            
  4979.                                 if( get_pcvar_num(kz_lj_sounds) == 2 && gHasColorChat[i] && !(fallDown[id]) && weapSpeed[id] == 250.0 && pev(id, pev_fuser2) > 0.0)
  4980.                                     client_cmd(i, "speak ^"vox/%s uniform(e30) it south(e15)^"", strdist);
  4981.                                
  4982.                                 if( i != id && (ljs_beam == 1 || ljs_beam == 2) && bljbeam[i] )
  4983.                                 {
  4984.                                     DrawSpecBeam(i);
  4985.                                 }
  4986.                             }
  4987.                         }
  4988.                         //still weird jump
  4989.                         if (!(fallDown[id]) && weapSpeed[id] == 250.0 && pev(id, pev_fuser2) > 0.0)
  4990.                         {
  4991.                             if( !(possible_lj_script[id][0] || possible_lj_script[id][1] ))
  4992.                             {
  4993.                                 static Float:cj_dif, Float:max_cj, Float:leet_cj, Float:pro_cj, Float:good_cj, Float:god_cj, ljtop;
  4994.                                 cj_dif = get_pcvar_float(kz_cj_dif);
  4995.                                 cj_dif += 5;
  4996.                                 max_cj = get_pcvar_float(kz_max_lj) + 23;
  4997.  
  4998.                             /*  leet_cj = get_pcvar_float(kz_leet_lj) + cj_dif;
  4999.                                 pro_cj = get_pcvar_float(kz_pro_lj) + cj_dif;
  5000.                                 good_cj = get_pcvar_float(kz_good_lj) + cj_dif;
  5001.                             */
  5002.  
  5003.                                 leet_cj = 265.0;
  5004.                                 pro_cj = 260.0;
  5005.                                 good_cj = 255.0;
  5006.                                 god_cj = 270.0;
  5007.                            
  5008.                                 ljtop = get_pcvar_num(kz_ljs_tops);
  5009.  
  5010.                                 if( ljtop == 1 || ljtop == 3 )
  5011.                                 {
  5012.                                     if( fDistance < max_cj
  5013.                                     && !(fDistance < god_cj)
  5014.                                     && !(0 > god_cj))
  5015.                                     {
  5016.                                         PrintChatMess(id, 3, DIST_GOD, TYPE_WJ);
  5017.                                     }
  5018.                                     else if( fDistance < max_cj
  5019.                                     && !(fDistance < leet_cj)
  5020.                                     && !(0 > leet_cj))
  5021.                                     {
  5022.                                         PrintChatMess(id, get_pcvar_num(kz_leet_lj_clr), DIST_LEET, TYPE_WJ);
  5023.                                     }
  5024.                                     else if( fDistance < max_cj
  5025.                                     && !(fDistance < pro_cj)
  5026.                                     && !(0 > pro_cj))
  5027.                                     {
  5028.                                         PrintChatMess(id, get_pcvar_num(kz_pro_lj_clr), DIST_PRO, TYPE_WJ);
  5029.                                     }                      
  5030.                                     else if( fDistance < max_cj
  5031.                                     && !(fDistance < good_cj)
  5032.                                     && !(0 > good_cj))
  5033.                                     {
  5034.                                         PrintChatMess(id, get_pcvar_num(kz_good_lj_clr), DIST_GOOD, TYPE_WJ);
  5035.                                     }
  5036.                                 }
  5037.                             }
  5038.                         }
  5039.                         //jumptype[id] = TYPE_NONE;
  5040.                     } //long jump
  5041.                     else if( fDistance > get_pcvar_float(kz_min_lj)
  5042.                     && fMaxGroundSpeed[id] < maxPreSpeedWeapon
  5043.                     && cjumped[id] == false
  5044.                     && !(fDistance > get_pcvar_float(kz_max_lj)) )
  5045.                     {
  5046.                         if( !(possible_lj_script[id][0] || possible_lj_script[id][1] || fallDown[id] || weapSpeed[id] != 250.0))
  5047.                         {
  5048.                             check_maintop(id, floatround((fDistance*1000000), floatround_floor), floatround((fMaxAirSpeed[id]*1000000), floatround_floor), floatround((fMaxGroundSpeed[id]*1000000), floatround_floor), strafes[id], sync_, TYPE_LJ);
  5049.                         }
  5050.                        
  5051.                         ljStatsRed = get_pcvar_num(kz_ljstats_red);
  5052.                         ljStatsGreen = get_pcvar_num(kz_ljstats_green);
  5053.                         ljStatsBlue = get_pcvar_num(kz_ljstats_blue);
  5054.                         ljs_beam = get_pcvar_num(kz_ljs_beam);
  5055.                         static i;
  5056.    
  5057.                         if( gHasLjStats[id] && bljbeam[id] )
  5058.                         {
  5059.                             DrawBeam(id, ljs_beam, 1);
  5060.                         }
  5061.  
  5062.                         static strdist[128];
  5063.                         num_to_word(floatround(fDistance, floatround_floor), strdist, 127);
  5064.                        
  5065.                         for( i = INFO_ONE; i < 33; i++ )
  5066.                         {
  5067.                             if( (i == id || is_user_spectating_player(i, id)) && gHasLjStats[i] )
  5068.                             {
  5069.                                 copy(strMessBuf,strLen,strMess);
  5070.    
  5071.                                 if ( fallDown[id] || weapSpeed[id] != 250.0)
  5072.                                 {
  5073.                                     set_hudmessage(255, 0, 109, -1.0, 0.70, 0, 0.0, ((vBeamLastTime[id]*0.1)), 0.1, 0.1, 3);
  5074.                                 }
  5075.                                 else
  5076.                                 {
  5077.                                     set_hudmessage(ljStatsRed, ljStatsGreen, ljStatsBlue, -1.0, 0.70, 0, 0.0, ((vBeamLastTime[id]*0.1)), 0.1, 0.1, 3);
  5078.                                 }
  5079.    
  5080.                                 show_hudmessage(i, "Distance: %f^nMaxSpeed: %f (%.3f)^nPreStrafe: %f^nStrafes: %d^nSync: %d%%", fDistance, fMaxAirSpeed[id], fMaxAirSpeed[id] - fMaxGroundSpeed[id], fMaxGroundSpeed[id], strafes[id], sync_ );
  5081.                                 client_print(i, print_console, "Distance: %f MaxSpeed: %f (%.3f) PreStrafe: %f Strafes: %d Sync: %d", fDistance, fMaxAirSpeed[id], fMaxAirSpeed[id] - fMaxGroundSpeed[id], fMaxGroundSpeed[id], strafes[id], sync_ );
  5082.                                
  5083.                                 if ( StrafeStat[i] && strLen != 0 )
  5084.                                 {
  5085.                                     if ( fallDown[id] || weapSpeed[id] != 250.0)
  5086.                                     {
  5087.                                         set_hudmessage(255, 0, 109, 0.70, 0.35, 0, 0.0, ((vBeamLastTime[id]*0.1)), 0.1, 0.1, 4);
  5088.                                     }
  5089.                                     else
  5090.                                     {
  5091.                                         set_hudmessage(ljStatsRed, ljStatsGreen, ljStatsBlue, 0.70, 0.35, 0, 0.0, ((vBeamLastTime[id]*0.1)), 0.1, 0.1, 4);
  5092.                                     }
  5093.                                     show_hudmessage(i,"%s",strMessBuf);
  5094.                                     static strMessHalf[40];
  5095.                                     //if (jumptype[id] == TYPE_HJ || (BlockDist > 210.0 && BlockDist < get_pcvar_float(kz_max_lj)))
  5096.                                     //  strafes[id] += 1;
  5097.                                     for(jj=INFO_ONE; (jj <= strafes[id]) && (jj < NSTRAFES);jj++)
  5098.                                     {
  5099.                                         strtok(strMessBuf,strMessHalf,40,strMessBuf,40*NSTRAFES,'^n');
  5100.                                         replace(strMessHalf,40,"^n","");
  5101.                                         client_print(i, print_console, "%s", strMessHalf)
  5102.                                     }
  5103.                                 }
  5104.  
  5105.                                 if( possible_lj_script[id][0] || possible_lj_script[id][1] )
  5106.                                 {
  5107.                                     if( possible_lj_script[id][0] && possible_lj_script[id][1] )
  5108.                                         client_print(i, print_center, "No ljtop access (possible lj script)");
  5109.                                     else
  5110.                                         client_print(i, print_center, "No ljtop access (possible %s script)", (possible_lj_script[id][0])?"prestrafe":"strafe");
  5111.                                 }
  5112.                                
  5113.                                 if( get_pcvar_num(kz_lj_sounds) == 2 && gHasColorChat[i] && !(fallDown[id]) && weapSpeed[id] == 250.0)
  5114.                                     client_cmd(i, "speak ^"vox/%s uniform(e30) it south(e15)^"", strdist);
  5115.                                
  5116.                                 if( i != id && (ljs_beam == 1 || ljs_beam == 2) && bljbeam[i] )
  5117.                                 {
  5118.                                     DrawSpecBeam(i);
  5119.                                 }
  5120.                             }
  5121.                         }
  5122.    
  5123.                         if (!(fallDown[id]) && weapSpeed[id] == 250.0)
  5124.                         {
  5125.                             if( !(possible_lj_script[id][0] || possible_lj_script[id][1] ))
  5126.                             {
  5127.                                 static Float:max_lj, Float:leet_lj, Float:pro_lj, Float:good_lj, Float:god_lj, ljtop;
  5128.                                 max_lj = get_pcvar_float(kz_max_lj);
  5129. /*                              leet_lj = get_pcvar_float(kz_leet_lj);
  5130.                                 pro_lj = get_pcvar_float(kz_pro_lj);
  5131.                                 good_lj = get_pcvar_float(kz_good_lj);
  5132. */
  5133.                                 leet_lj = 250.0;
  5134.                                 pro_lj = 245.0;
  5135.                                 good_lj = 240.0;
  5136.                                 god_lj = 255.0;
  5137.  
  5138.                                 ljtop = get_pcvar_num(kz_ljs_tops);
  5139.    
  5140.                                 if( ljtop == 1 || ljtop == 3 )
  5141.                                 {
  5142.                                     if( fDistance < max_lj
  5143.                                     && !(fDistance < god_lj)
  5144.                                     && !(0 > god_lj))
  5145.                                     {
  5146.                                         PrintChatMess(id, 3, DIST_GOD, TYPE_LJ);
  5147.                                     }
  5148.                                     else if( fDistance < max_lj
  5149.                                     && !(fDistance < leet_lj)
  5150.                                     && !(0 > leet_lj))
  5151.                                     {
  5152.                                         PrintChatMess(id, get_pcvar_num(kz_leet_lj_clr), DIST_LEET, TYPE_LJ);
  5153.                                     }
  5154.                                     else if( fDistance < max_lj
  5155.                                     && !(fDistance < pro_lj)
  5156.                                     && !(0 > pro_lj))
  5157.                                     {
  5158.                                         PrintChatMess(id, get_pcvar_num(kz_pro_lj_clr), DIST_PRO, TYPE_LJ);
  5159.                                     }                      
  5160.                                     else if( fDistance < max_lj
  5161.                                     && !(fDistance < good_lj)
  5162.                                     && !(0 > good_lj))
  5163.                                     {
  5164.                                         PrintChatMess(id, get_pcvar_num(kz_good_lj_clr), DIST_GOOD, TYPE_LJ);
  5165.                                     }
  5166.                                 }
  5167.                             }
  5168.                         }
  5169.                         //jumptype[id] = TYPE_NONE;
  5170.                     } //CountJump
  5171.                     else if( fDistance > get_pcvar_float(kz_min_lj)
  5172.                     && fMaxGroundSpeed[id] < maxBhopPreSpeedWeap       //TODO: is it right?
  5173.                     && cjumped[id] == true
  5174.                     && !(fDistance > (get_pcvar_float(kz_max_lj) + 18)) )
  5175.                     {
  5176.                         if( !(possible_lj_script[id][0] || possible_lj_script[id][1] || fallDown[id] || weapSpeed[id] != 250.0))
  5177.                         {
  5178.                             check_maintop(id, floatround((fDistance*1000000), floatround_floor), floatround((fMaxAirSpeed[id]*1000000), floatround_floor), floatround((fMaxGroundSpeed[id]*1000000), floatround_floor), strafes[id], sync_, TYPE_CJ);
  5179.                         }
  5180.    
  5181.                         ljStatsRed = get_pcvar_num(kz_ljstats_red);
  5182.                         ljStatsGreen = get_pcvar_num(kz_ljstats_green);
  5183.                         ljStatsBlue = get_pcvar_num(kz_ljstats_blue);
  5184.                         ljs_beam = get_pcvar_num(kz_ljs_beam);
  5185.                         static i;
  5186.    
  5187.                         if( gHasLjStats[id] && bljbeam[id])
  5188.                         {
  5189.                             i = DrawBeam(id, ljs_beam, 2);
  5190.                         }
  5191.        
  5192.                         static strdist[128];
  5193.                         num_to_word(floatround(fDistance, floatround_floor), strdist, 127);
  5194.    
  5195.                         for( i = INFO_ONE; i < 33; i++ )
  5196.                         {
  5197.                             if( (i == id || is_user_spectating_player(i, id)) && gHasLjStats[i] )
  5198.                             {
  5199.                                 copy(strMessBuf,strLen,strMess);
  5200.  
  5201.                                 if ( fallDown[id] || weapSpeed[id] != 250.0)
  5202.                                 {
  5203.                                     set_hudmessage(255, 0, 109, -1.0, 0.70, 0, 0.0, ((vBeamLastTime[id]*0.1)), 0.1, 0.1, 3);
  5204.                                 }
  5205.                                 else
  5206.                                 {
  5207.                                     set_hudmessage(ljStatsRed, ljStatsGreen, ljStatsBlue, -1.0, 0.70, 0, 0.0, ((vBeamLastTime[id]*0.1)), 0.1, 0.1, 3);
  5208.                                 }
  5209.  
  5210.                                 show_hudmessage(i, "CJ Distance: %f^nMaxSpeed: %f (%.3f)^nPreStrafe: (%.3f) %f^nStrafes: %d^nSync: %d%%", fDistance, fMaxAirSpeed[id], fMaxAirSpeed[id] - fMaxGroundSpeed[id], fCjPreSpeed[id],fMaxGroundSpeed[id], strafes[id], sync_ );
  5211.                                 client_print(i, print_console, "CJ Distance: %f MaxSpeed: %f (%.3f) PreStrafe: (%.3f) %f Strafes: %d Sync: %d", fDistance, fMaxAirSpeed[id], fMaxAirSpeed[id] - fMaxGroundSpeed[id], fCjPreSpeed[id], fMaxGroundSpeed[id], strafes[id], sync_ );
  5212.                                
  5213.                                 if ( StrafeStat[i] && strLen != 0 )
  5214.                                 {
  5215.                                     if ( fallDown[id] || weapSpeed[id] != 250.0)
  5216.                                     {
  5217.                                         set_hudmessage(255, 0, 109, 0.70, 0.35, 0, 0.0, ((vBeamLastTime[id]*0.1)), 0.1, 0.1, 4);
  5218.                                     }
  5219.                                     else
  5220.                                     {
  5221.                                         set_hudmessage(ljStatsRed, ljStatsGreen, ljStatsBlue, 0.70, 0.35, 0, 0.0, ((vBeamLastTime[id]*0.1)), 0.1, 0.1, 4);
  5222.                                     }
  5223.                                     show_hudmessage(i,"%s",strMessBuf);
  5224.                                     static strMessHalf[40];
  5225.                                     for(jj=INFO_ONE; (jj <= strafes[id]) && (jj < NSTRAFES);jj++)
  5226.                                     {
  5227.                                         strtok(strMessBuf,strMessHalf,40,strMessBuf,40*NSTRAFES,'^n');
  5228.                                         replace(strMessHalf,40,"^n","");
  5229.                                         client_print(i, print_console, "%s", strMessHalf)
  5230.                                     }
  5231.                                 }  
  5232.        
  5233.                                 if( possible_lj_script[id][0] || possible_lj_script[id][1] )
  5234.                                 {
  5235.                                     if( possible_lj_script[id][0] && possible_lj_script[id][1] )
  5236.                                         client_print(i, print_center, "No ljtop access (possible cj script)");
  5237.                                     else
  5238.                                         client_print(i, print_center, "No ljtop access (possible %s script)", (possible_lj_script[id][0])?"prestrafe":"strafe");
  5239.                                 }
  5240.                                
  5241.                                 if( get_pcvar_num(kz_lj_sounds) == 2 && gHasColorChat[i] && !(fallDown[id]) && weapSpeed[id] == 250.0)
  5242.                                     client_cmd(i, "speak ^"vox/%s uniform(e30) it south(e15)^"", strdist);
  5243.                                
  5244.                                 if( i != id && (ljs_beam == 1 || ljs_beam == 2) && bljbeam[i])
  5245.                                 {
  5246.                                     DrawSpecBeam(i);
  5247.                                 }
  5248.                             }
  5249.                         }
  5250.                        
  5251.                         if (!(fallDown[id]) && weapSpeed[id] == 250.0)
  5252.                         {
  5253.                             if( !(possible_lj_script[id][0] || possible_lj_script[id][1] ))
  5254.                             {
  5255.                                 static Float:cj_dif, Float:max_cj, Float:leet_cj, Float:pro_cj, Float:good_cj, Float:god_cj, ljtop;
  5256.                                 cj_dif = get_pcvar_float(kz_cj_dif);
  5257.                                 max_cj = get_pcvar_float(kz_max_lj) + 18;
  5258.  
  5259. /*                              leet_cj = get_pcvar_float(kz_leet_lj) + cj_dif;
  5260.                                 pro_cj = get_pcvar_float(kz_pro_lj) + cj_dif;
  5261.                                 good_cj = get_pcvar_float(kz_good_lj) + cj_dif; */
  5262.  
  5263.                                 leet_cj = 260.0;
  5264.                                 pro_cj = 255.0;
  5265.                                 good_cj = 250.0;
  5266.                                 god_cj = 265.0;
  5267.  
  5268.                                 ljtop = get_pcvar_num(kz_ljs_tops);
  5269.    
  5270.                                 if( ljtop == 1 || ljtop == 3 )
  5271.                                 {
  5272.                                     if( fDistance < max_cj
  5273.                                     && !(fDistance < god_cj)
  5274.                                     && !(cj_dif > god_cj) )
  5275.                                     {
  5276.                                         PrintChatMess(id, 3, DIST_GOD, TYPE_CJ);
  5277.                                     }                  
  5278.                                     else if( fDistance < max_cj
  5279.                                     && !(fDistance < leet_cj)
  5280.                                     && !(cj_dif > leet_cj) )
  5281.                                     {
  5282.                                         PrintChatMess(id, get_pcvar_num(kz_leet_cj_clr), DIST_LEET, TYPE_CJ);
  5283.                                     }                  
  5284.                                     else if( fDistance < max_cj
  5285.                                     && !(fDistance < pro_cj)
  5286.                                     && !(cj_dif > pro_cj) )
  5287.                                     {
  5288.                                         PrintChatMess(id, get_pcvar_num(kz_pro_cj_clr), DIST_PRO, TYPE_CJ);
  5289.                                     }                  
  5290.                                     else if( fDistance < max_cj
  5291.                                     && !(fDistance < good_cj)
  5292.                                     && !(cj_dif > good_cj) )
  5293.                                     {
  5294.                                         PrintChatMess(id, get_pcvar_num(kz_good_cj_clr), DIST_GOOD, TYPE_CJ);
  5295.                                     }
  5296.                                 }
  5297.                             }
  5298.                         }
  5299.                     }
  5300.                     //jumptype[id] = TYPE_NONE;
  5301.                 }
  5302.                 if (testBhop[id] == false)
  5303.                 {
  5304.                     fMaxAirSpeed[id] = 0.0;
  5305.                     fMaxGroundSpeed[id] = 250.0;
  5306.                 }
  5307.                 cjumped[id] = false;
  5308.  
  5309.                 jumptype[id] = TYPE_NONE;
  5310.  
  5311.                 //gInAir[id] = false; //why??
  5312.             }
  5313.             else if( flags&FL_ONGROUND
  5314.             && gInAir[id] == false )
  5315.             {
  5316. /*
  5317.                 //TODO: Vashe strannaia zashita; very strange protection, why we need it
  5318.                 pev(id, pev_velocity, vVelocity);
  5319.                 vVelocity[2]-=vVelocity[2];
  5320.  
  5321.                 if( vector_length(vVelocity) > maxPreSpeedWeapon
  5322.                 && doubleducked[id] == false)
  5323.                 {
  5324.                     set_task(0.5,"gocheck", id);               
  5325.                 }
  5326. */
  5327.                 //gInAir[id] = false; //why?
  5328.                 fMaxAirSpeed[id] = 0.0;
  5329.                 fMaxGroundSpeed[id] = 250.0;
  5330.                 cjumped[id] = false;
  5331.             }
  5332.         }
  5333.  
  5334.         if (gInAir[id] || isBhop[id] || doubleducked[id])
  5335.         {
  5336.             static i, j;
  5337.             j = 0;
  5338.             for( i = INFO_ZERO; i < 127; i++ )
  5339.             {
  5340.                 if( i == 126 || (vBeamPos[id][i][0] == 0
  5341.                 && vBeamPos[id][i][1] == 0
  5342.                 && vBeamPos[id][i][2] == 0
  5343.                 && vBeamTime[id][i] == 0) )
  5344.                 {
  5345.                     pev(id, pev_origin, vBeamPos[id][i]);
  5346.                     //client_print(id, print_console,"%d    %f  %f",i, vBeamPos[id][i][0],vBeamPos[id][i][1]);
  5347.                     if( i == 0 )
  5348.                         vBeamTime[id][i] = 15.0;
  5349.                     else
  5350.                         vBeamTime[id][i] = (get_gametime()-beam_jump_off_time[id])*10+15;
  5351.                    
  5352.                     if( doubleducked[id] == true || induck[id] == true )
  5353.                         vBeamPosStatus[id][i] = -1.0;
  5354.                     else if( is_in_duck(id) )
  5355.                         vBeamPosStatus[id][i] = 1.0;
  5356.                     else
  5357.                         vBeamPosStatus[id][i] = 0.0;
  5358.  
  5359.                     vBeamLastTime[id] = vBeamTime[id][i];
  5360.  
  5361.                     j=i;
  5362.                    
  5363.                     {
  5364.                         ljhel[id][0] += vBeamPos[id][i][0];
  5365.                         ljhel[id][1] += vBeamPos[id][i][1];
  5366.                     }
  5367.                     if (i < 13 && i > 2 && (i%3)==0 && jumptype[id] != TYPE_HJ && jumptype[id] != TYPE_WJ)
  5368.                     {
  5369.                         pev(id, pev_origin, vOrigin);
  5370.                         vOrigin[2] = vJumpedAt[id][2] - 38.0;
  5371.                         if (HJdetect(id, vOrigin))
  5372.                               jumptype[id] = TYPE_HJ;
  5373.                     }
  5374.                     i=127;
  5375.                 }
  5376.             }
  5377.  
  5378.             if ( j > 3 && (j%4)==0 && (gInAir[id] == true || isBhop[id] == true) && bljhelp[id])
  5379.             {
  5380.                 message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id);
  5381.                 write_byte (0);
  5382.                 write_coord(floatround(vJumpedAt[id][0]));
  5383.                 write_coord(floatround(vJumpedAt[id][1]));
  5384.                 //write_coord(floatround(vOldOrigin2[id]-34));
  5385.                 write_coord(floatround(vJumpedAt[id][2]-34));
  5386.                 write_coord(floatround((220/j)*((ljhel[id][0]/(j+1))-vJumpedAt[id][0])+vJumpedAt[id][0]));
  5387.                 write_coord(floatround((220/j)*((ljhel[id][1]/(j+1))-vJumpedAt[id][1])+vJumpedAt[id][1]));
  5388.                 //write_coord(floatround(vOldOrigin2[id]-34));
  5389.                 write_coord(floatround(vJumpedAt[id][2]-34));
  5390.                 write_short(gBeam);
  5391.                 write_byte(0);         
  5392.                 write_byte(0);
  5393.                 if (j < 70)
  5394.                 {
  5395.                     write_byte(2);
  5396.                 }
  5397.                 else
  5398.                 {
  5399.                     write_byte(17);
  5400.                 }
  5401.                 write_byte(20);
  5402.                 write_byte(0);
  5403.                 write_byte(random_num(32, 255));
  5404.                 write_byte(random_num(32, 255));
  5405.                 write_byte(random_num(32, 255));
  5406.                 write_byte(200);
  5407.                 write_byte(0);
  5408.                 message_end();
  5409.             }
  5410.         }
  5411.  
  5412.         if( flags&FL_ONGROUND )
  5413.         {
  5414.             if (!pev( id, pev_solid ))
  5415.             {
  5416.                 static ClassName[32];
  5417.                 pev(pev(id, pev_groundentity), pev_classname, ClassName, 32);
  5418.    
  5419.                 if( equal(ClassName, "func_train")
  5420.                     || equal(ClassName, "func_conveyor")
  5421.                     || equal(ClassName, "trigger_push") || equal(ClassName, "trigger_gravity"))
  5422.                 {
  5423.                     gocheck(id);
  5424.                     set_task(0.4,"gocheck", id);
  5425.                     gocheckbhop(id);
  5426.                     set_task(0.4,"gocheckbhop", id);
  5427.                 }
  5428.                 else if(equal(ClassName, "func_door") || equal(ClassName, "func_door_rotating") )
  5429.                 {
  5430.                     gocheck(id);
  5431.                     set_task(0.4,"gocheck", id);           
  5432.                 }
  5433.             }
  5434.  
  5435.         /*  if (jumptype[id] == TYPE_WJ && OnGround[id] && !(gInAir[id])) //2nd frame
  5436.             {
  5437.                 set_hudmessage(255, 0, 109, -1.0, 0.70, 0, 0.0, 0.5, 0.1, 0.1, 3);
  5438.                 static i;
  5439.                 for( i = INFO_ONE; i < 33; i++ )
  5440.                 {
  5441.                     if( (i == id || is_user_spectating_player(i, id)) && gHasLjStats[i])
  5442.                     {
  5443.                         show_hudmessage(id,"Too late for weird jump");
  5444.                         //client_print(id, print_console, "You pressed jump too early");
  5445.                     }
  5446.                 }
  5447.                 gocheck(id);
  5448.                 set_task(0.2,"gocheck", id);
  5449.                 //jumptype[id] = TYPE_NONE;
  5450.             }       */
  5451.     /*     
  5452.             //TODO: hates this detection of CJ, need to redone it with better detection type
  5453.             if( OnGround[id] == false && !(jumptype[id] == TYPE_WJ) )
  5454.             {
  5455.                 //pev(id, pev_origin, vOrigin); //why we need it?
  5456.                 if( doubleducked[id] == false
  5457.                 && !(cjumped[id] == true
  5458.                 && buttons&IN_JUMP
  5459.                 && !(oldbuttons&IN_JUMP)) )
  5460.                 {
  5461.                     set_task(0.4,"gocheck", id);
  5462.                 }
  5463.                 else if( doubleducked[id] == true
  5464.                 && vOrigin[2] != vDuckedAt[id][2] )
  5465.                 {
  5466.                     set_task(0.5,"gocheck", id);
  5467.                 }
  5468.                 OnGround[id] = true;
  5469.             }
  5470.             else if (OnGround[id] == false && jumptype[id] == TYPE_WJ )
  5471.             {
  5472.                 if( !(buttons&IN_JUMP && !(oldbuttons&IN_JUMP)) )
  5473.                 OnGround[id] = true;
  5474.             }          
  5475. */
  5476.             //TODO: hates this detection of CJ, need to redone it with better detection type
  5477.             if( OnGround[id] == false )
  5478.             {
  5479.                 //pev(id, pev_origin, vOrigin); //why we need it?
  5480.                 if( doubleducked[id] == false
  5481.                 && !(cjumped[id] == true
  5482.                 && buttons&IN_JUMP
  5483.                 && !(oldbuttons&IN_JUMP))
  5484.                 && jumptype[id] != TYPE_WJ) //mb better jumptype[id] == TYPE_NONE
  5485.                 {
  5486.                     set_task(0.4,"gocheck", id);
  5487.                 //  client_print(id, print_console,"popali v 1");//1111
  5488.                 }
  5489.                 else if( doubleducked[id] == true
  5490.                 && vOrigin[2] != vDuckedAt[id][2] )
  5491.                 {
  5492.                     set_task(0.5,"gocheck", id);
  5493.                     //client_print(id, print_console,"popali v 2");//1111
  5494.                 }
  5495.  
  5496.                 if (jumptype[id] == TYPE_WJ && !(cjumped[id]))
  5497.                 {
  5498.                     pev(id, pev_origin, vFallAt[id]);
  5499.                     //client_print(id, print_console,"da etoje WJ");//1111
  5500.                 }
  5501.                 OnGround[id] = true;
  5502.             }
  5503.         }
  5504.  
  5505.         if( buttons&IN_DUCK
  5506.         && flags&FL_ONGROUND
  5507.         && gInAir[id] == false
  5508.         && isBhop[id] == false
  5509.         && (fSpeed < maxPreSpeedWeapon && jumptype[id] != TYPE_WJ ) )
  5510.         {
  5511.             if( induck[id] == false )
  5512.             {
  5513.                 cducked[id] = true;
  5514.                 induck[id] = true;
  5515.                 set_task(0.1,"testcjstart", id);
  5516.                
  5517.                 pev(id, pev_origin, vOrigin);
  5518.                 vDuckedAt[id][0] = vOrigin[0];
  5519.                 vDuckedAt[id][1] = vOrigin[1];
  5520.                 vDuckedAt[id][2] = vOrigin[2];
  5521.                 beam_jump_off_time[id] = get_gametime();
  5522.                 fCjPreSpeed[id] = fSpeed;
  5523.                
  5524.                 static i;
  5525.                 for( i = INFO_ZERO; i < 127; i++ )
  5526.                 {
  5527.                     vBeamPos[id][i][0] = 0.0;
  5528.                     vBeamPos[id][i][1] = 0.0;
  5529.                     vBeamPos[id][i][2] = 0.0;
  5530.                     vBeamTime[id][i] = 0.0;
  5531.                 }
  5532.                 vBeamLastTime[id] = 0.0;
  5533.             }
  5534.         }
  5535.         else if( oldbuttons&IN_DUCK )
  5536.         {
  5537.             induck[id] = false;
  5538.             if( cducked[id] == true && !is_in_duck(id) )
  5539.             {
  5540.                 set_task(0.3,"ddend", id);
  5541.                 doubleducked[id] = true;
  5542.                 cducked[id] = false;
  5543.             }
  5544.         }
  5545.  
  5546.         if( !(flags&FL_ONGROUND) )
  5547.         {
  5548.             OnGround[id] = false;
  5549.             //client_print(id, print_console,"WJ Prestrafe %f",vVelocity[2]);
  5550.             pev(id, pev_velocity, vVelocity);
  5551.             if (vVelocity[2] == -4.0 ||
  5552.                 vVelocity[2] == -4.4 ||
  5553.                 vVelocity[2] == -4.8 ||
  5554.                 vVelocity[2] == -3.599999 ||
  5555.                 vVelocity[2] == -3.2) // -4.  -12.  -20.  -28.  -36.  -44.  -52.  -60.  -68.  -76.  -84.  -92.  -100.  -108.  -116.
  5556.             {
  5557.                 if(!(cjumped[id]))
  5558.                     jumptype[id] = TYPE_WJ;            
  5559.             }
  5560.             //if (weapSpeed[id] > 250)
  5561.             //{//11111
  5562.             //  client_print(id, print_chat,"vot i vzleteli %f",vVelocity[2]);
  5563.             //}
  5564.         }
  5565.     }
  5566.     return FMRES_IGNORED;
  5567. }
  5568.  
  5569. public fwdPlayerPostThink(id)
  5570. {
  5571.     if( is_user_alive(id) && get_pcvar_num(kz_ljs_enabled) )
  5572.     {
  5573.         static buttonsNew, flags, i;
  5574.         buttonsNew = pev(id, pev_button);
  5575.         flags = pev(id, pev_flags);
  5576.  
  5577.         static Float:ori[3];
  5578.        
  5579.         pev(id, pev_origin, ori);
  5580.         pev(id, pev_velocity, vVelocity);
  5581.  
  5582.         vVelocity[2] = 0.0;
  5583.         fSpeed = vector_length(vVelocity);
  5584.  
  5585.         if( (flags&FL_ONGROUND)
  5586.         && (gInAir[id] == true || OnGround[id] == false || isBhop[id])) //dont need @OnGround[id] == false@ here i think
  5587.         {
  5588.             fwdPlayerPreThink(id);
  5589.         }
  5590.  
  5591.         //maxBhopPreSpeedWeap = weapSpeed[id]*1.2;
  5592.  
  5593.         //Linear loss of speed can be calcilated like speed = (WeaponSpeed*1.2)*0.8
  5594.         if ( isBhop[id] && (gSpeed > maxBhopPreSpeedWeap) && (fSpeed < gSpeed - 30.0) && gInAir[id] ) ///w00t that gInAir here rulezz
  5595.         {
  5596.             fMaxAirSpeed[id] = fSpeed;
  5597.             fMaxGroundBhopSpeed[id] += (fSpeed - gSpeed);//(gSpeed - fMaxGroundSpeed[id]); //is it right?
  5598.             fMaxGroundSpeed[id] = fSpeed;
  5599.             //client_print(id, print_console, "gSpeed %f fSpeed %f",gSpeed, fSpeed);
  5600.             set_hudmessage(255,255, 255, -1.0, 0.70, 0, 0.0, 0.7, 0.1, 0.1, 3);
  5601.             for( i = INFO_ONE; i < 33; i++ )
  5602.             {
  5603.                 if( (i == id || is_user_spectating_player(i, id)) && gHasLjStats[i])
  5604.                 {
  5605.                     show_hudmessage(i, "Prestrafe: %f (%.3f)^nYour Maxspeed was too high %.3f^nMaxspeed have to be under %.3f", fMaxGroundSpeed[id], fMaxGroundBhopSpeed[id], gSpeed, maxBhopPreSpeedWeap);
  5606.                     //client_print(i, print_console, "Prestrafe: %f (%.3f)^nYour Maxspeed was too high %.3f^nMaxspeed have to be under %.3f", fMaxGroundSpeed[id], fMaxGroundBhopSpeed[id], gSpeed, maxBhopPreSpeedWeap);
  5607.                 }
  5608.             }
  5609.         }
  5610.        
  5611.         pev(id, pev_angles, angle);
  5612.         if( old_angle1[id] > angle[1] )
  5613.         {
  5614.             turning_left[id] = false;
  5615.             turning_right[id] = true;
  5616.         }
  5617.         else if( old_angle1[id] < angle[1] )
  5618.         {
  5619.             turning_left[id] = true;
  5620.             turning_right[id] = false;
  5621.         }
  5622.         else
  5623.         {
  5624.             turning_left[id] = false;
  5625.             turning_right[id] = false;
  5626.         }
  5627.    
  5628.     /*  if( strafing_aw[id] == false
  5629.         && (buttonsNew&IN_MOVELEFT)
  5630.         && (turning_left[id] == true || turning_right[id] == true )
  5631.         && !(buttonsNew&IN_MOVERIGHT || buttonsNew&IN_BACK) )
  5632.         {
  5633.             strafing_aw[id] = true;
  5634.             strafing_sd[id] = false;
  5635.             if(strafes[id] < NSTRAFES)
  5636.                 strafe_stat_time[id][strafes[id]] = get_gametime();
  5637.             strafes[id] += INFO_ONE;
  5638.         }
  5639.         else if( strafing_sd[id] == false
  5640.         && (buttonsNew&IN_MOVERIGHT)
  5641.         && (turning_left[id] == true || turning_right[id] == true )
  5642.         && !(buttonsNew&IN_MOVELEFT || buttonsNew&IN_FORWARD) )
  5643.         {
  5644.             strafing_aw[id] = false;
  5645.             strafing_sd[id] = true;
  5646.             if(strafes[id] < NSTRAFES)
  5647.                 strafe_stat_time[id][strafes[id]] = get_gametime();
  5648.             strafes[id] += INFO_ONE;
  5649.         }
  5650.         */
  5651.  
  5652.         if( !(strafecounter_oldbuttons[id]&IN_MOVELEFT) && buttonsNew&IN_MOVELEFT
  5653.         && !(buttonsNew&IN_MOVERIGHT) && !(buttonsNew&IN_BACK) && !(buttonsNew&IN_FORWARD)
  5654.         && (turning_left[id] || turning_right[id]) )
  5655.         {
  5656.             if(strafes[id] < NSTRAFES)
  5657.                 strafe_stat_time[id][strafes[id]] = get_gametime();
  5658.             strafes[id] += INFO_ONE;
  5659.         }
  5660.         else if( !(strafecounter_oldbuttons[id]&IN_MOVERIGHT) && buttonsNew&IN_MOVERIGHT
  5661.         && !(buttonsNew&IN_MOVELEFT) && !(buttonsNew&IN_BACK) && !(buttonsNew&IN_FORWARD)
  5662.         && (turning_left[id] || turning_right[id]) )
  5663.         {
  5664.             if(strafes[id] < NSTRAFES)
  5665.                 strafe_stat_time[id][strafes[id]] = get_gametime();
  5666.             strafes[id] += INFO_ONE;
  5667.         }
  5668.         else if( !(strafecounter_oldbuttons[id]&IN_BACK) && buttonsNew&IN_BACK
  5669.         && !(buttonsNew&IN_MOVELEFT) && !(buttonsNew&IN_MOVERIGHT) && !(buttonsNew&IN_FORWARD)
  5670.         && (turning_left[id] || turning_right[id]) )
  5671.         {
  5672.             if(strafes[id] < NSTRAFES)
  5673.                 strafe_stat_time[id][strafes[id]] = get_gametime();
  5674.             strafes[id] += INFO_ONE;
  5675.         }
  5676.         else if( !(strafecounter_oldbuttons[id]&IN_FORWARD) && buttonsNew&IN_FORWARD
  5677.         && !(buttonsNew&IN_MOVELEFT) && !(buttonsNew&IN_MOVERIGHT) && !(buttonsNew&IN_BACK)
  5678.         && (turning_left[id] || turning_right[id]) )
  5679.         {
  5680.             if(strafes[id] < NSTRAFES)
  5681.                 strafe_stat_time[id][strafes[id]] = get_gametime();
  5682.             strafes[id] += INFO_ONE;
  5683.         }
  5684.  
  5685.         //add ginAir check here
  5686.         if( buttonsNew&IN_MOVERIGHT
  5687.         || buttonsNew&IN_MOVELEFT
  5688.         || buttonsNew&IN_FORWARD
  5689.         || buttonsNew&IN_BACK )
  5690.         {
  5691.             if(strafes[id] < NSTRAFES)
  5692.             {
  5693.                 if( fSpeed > gSpeed)
  5694.                     strafe_stat_sync[id][strafes[id]][0] += INFO_ONE;
  5695.                 else
  5696.                     strafe_stat_sync[id][strafes[id]][1] += INFO_ONE;
  5697.  
  5698.                 //client_print(id, print_console,"OldSpeed[id] %f gSpeed %f", OldSpeed[id], gSpeed);
  5699.             }
  5700.             //else
  5701.             //{//TODO: ! if player made more than NSTRAFES}
  5702.         }
  5703.        
  5704.         //OldSpeed[id] = fSpeed;
  5705.        
  5706.         if( buttonsNew&IN_RIGHT
  5707.         || buttonsNew&IN_LEFT )
  5708.         {
  5709.             if( flags&FL_ONGROUND )
  5710.             {
  5711.                 possible_lj_script[id][1] = false;
  5712.                
  5713.                 if( fSpeed > 250 ) //change ro weap speed, if we need it
  5714.                 {
  5715.                     if( task_exists(id+534490) )
  5716.                         remove_task(id+534490);
  5717.                    
  5718.                     possible_lj_script[id][0] = true;
  5719.                 }
  5720.             }
  5721.             else if( gInAir[id] || isBhop[id] )
  5722.                 possible_lj_script[id][1] = true;
  5723.         }
  5724.         else if( flags&FL_ONGROUND )
  5725.         {
  5726.             possible_lj_script[id][1] = false;
  5727.            
  5728.             if( !task_exists(id+534490) && possible_lj_script[id][0] )
  5729.                 set_task(1.5, "isnt_prestrafe_cheating", id+534490);
  5730.         }
  5731.  
  5732.         if( buttons&IN_MOVERIGHT && (buttons&IN_MOVELEFT || buttons&IN_FORWARD || buttons&IN_BACK) )
  5733.             strafecounter_oldbuttons[id] = INFO_ZERO;
  5734.         else if( buttons&IN_MOVELEFT && (buttons&IN_FORWARD || buttons&IN_BACK || buttons&IN_MOVERIGHT) )
  5735.             strafecounter_oldbuttons[id] = INFO_ZERO;
  5736.         else if( buttons&IN_FORWARD && (buttons&IN_BACK || buttons&IN_MOVERIGHT || buttons&IN_MOVELEFT) )
  5737.             strafecounter_oldbuttons[id] = INFO_ZERO;
  5738.         else if( buttons&IN_BACK && (buttons&IN_MOVERIGHT || buttons&IN_MOVELEFT || buttons&IN_FORWARD) )
  5739.             strafecounter_oldbuttons[id] = INFO_ZERO;
  5740.         else if( turning_left[id] || turning_right[id] )
  5741.             strafecounter_oldbuttons[id] = buttons;
  5742.     }
  5743. }
  5744.  
  5745. public isnt_prestrafe_cheating(id)
  5746.     possible_lj_script[id-534490][0] = false;
  5747.  
  5748. public fwdTouch(ent, id)
  5749. {
  5750.     static ClassName[32];
  5751.     if( pev_valid(ent) )
  5752.     {
  5753.         pev(ent, pev_classname, ClassName, 31);
  5754.     }
  5755.     static ClassName2[32];
  5756.     if( pev_valid(id) )
  5757.     {
  5758.         pev(id, pev_classname, ClassName2, 31);
  5759.     }
  5760.     if( equal(ClassName2, "player") )
  5761.     {
  5762.         //IF we need protection from func_door and func_door_rotating uncomment lines
  5763.         //if( pev(id, pev_groundentity) == ent && (gInAir[id] || !OnGround[id] || testBhop[id]) ) //TODO remove BUG from here
  5764.         //{
  5765.         //  if( pev(id, pev_flags)&FL_ONGROUND && get_gametime() > (jumptime[id]+0.1))
  5766.         //  {
  5767.         //      fwdPlayerPreThink(id);
  5768.         //  }
  5769.         //}
  5770.  
  5771.     //  static Float:ori[3];
  5772. //      static Float:velo[3];
  5773.        
  5774. //      pev(id, pev_origin, ori);
  5775.     //  pev(id, pev_velocity, velo);
  5776.  
  5777.     //  if (weapSpeed[id] == 260)
  5778.     //      client_print(id, print_console,"Tou %f  %f  %f  %f  %f  %f", ori[0],ori[1],ori[2],velo[0],velo[1],velo[2]);
  5779.  
  5780.         //BUG?? plr can touch smth illegal on last frame...
  5781.         //There is No bug, because: PreThink - Engine - Touch - PostThink, but if u uncomment upper lines we will get that bug
  5782.         if( equal(ClassName, "func_train")
  5783.             || equal(ClassName, "func_conveyor")
  5784.             || equal(ClassName, "trigger_push") || equal(ClassName, "trigger_gravity"))
  5785.         {
  5786.             gocheck(id);
  5787.             set_task(0.4,"gocheck", id);
  5788.             gocheckbhop(id);
  5789.             set_task(0.4,"gocheckbhop", id);
  5790.         }
  5791.         //IF we need protection from func_door and func_door_rotating uncomment lines
  5792.         //else if(equal(ClassName, "func_door") || equal(ClassName, "func_door_rotating") )
  5793.         //{
  5794.         //  gocheck(id);
  5795.         //  set_task(0.4,"gocheck", id);           
  5796.         //}
  5797.     }  
  5798. }
  5799.  
  5800. stock get_spectated_player(spectator)
  5801. {
  5802.     if( !pev_valid(spectator) )
  5803.         return 0;
  5804.     if( !is_user_connected(spectator) )
  5805.         return 0;
  5806.     if( is_user_alive(spectator) )
  5807.         return 0;
  5808.     if( pev(spectator, pev_deadflag) != 2 )
  5809.         return 0;
  5810.    
  5811.     static player, specmode;
  5812.     specmode = pev(spectator, pev_iuser1);
  5813.     if( !(specmode == 1 || specmode == 2 || specmode == 4) )
  5814.         return 0;
  5815.    
  5816.     player = pev(spectator, pev_iuser2);
  5817.    
  5818.     if( !pev_valid(player) )
  5819.         return 0;
  5820.     if( !is_user_connected(player) )
  5821.         return 0;
  5822.     if( !is_user_alive(player) )
  5823.         return 0;
  5824.    
  5825.     return player;
  5826. }
  5827.  
  5828. stock is_user_spectating_player(spectator, player)
  5829. {
  5830.     if( !pev_valid(spectator) || !pev_valid(player) )
  5831.         return 0;
  5832.     if( !is_user_connected(spectator) || !is_user_connected(player) )
  5833.         return 0;
  5834.     if( is_user_alive(spectator) || !is_user_alive(player) )
  5835.         return 0;
  5836.     if( pev(spectator, pev_deadflag) != 2 )
  5837.         return 0;
  5838.    
  5839.     static specmode;
  5840.     specmode = pev(spectator, pev_iuser1);
  5841.     if( !(specmode == 1 || specmode == 2 || specmode == 4) )
  5842.         return 0;
  5843.    
  5844.     if( pev(spectator, pev_iuser2) == player )
  5845.         return 1;
  5846.    
  5847.     return 0;
  5848. }
  5849.  
  5850. stock is_in_duck(player)
  5851. {
  5852.     // supplied with invalid entities
  5853.     if( !pev_valid(player)  )
  5854.         return 0;
  5855.    
  5856.     // retrieve absolutes
  5857.     static Float:absmin[3], Float:absmax[3];
  5858.    
  5859.     pev(player, pev_absmin, absmin);
  5860.     pev(player, pev_absmax, absmax);
  5861.    
  5862.     absmin[2]+=64.0;
  5863.    
  5864.     if( absmin[2] < absmax[2] )
  5865.         return 0;
  5866.    
  5867.     return 1;
  5868. }
  5869. /*stock bool:fm_get_user_longjump(index)
  5870. {
  5871.     new value[2];
  5872.     engfunc(EngFunc_GetPhysicsKeyValue, index, "slj", value, 1);
  5873.     switch (value[0])
  5874.     {
  5875.         case '1': return true;
  5876.     }
  5877.  
  5878.     return false;
  5879. }*/
  5880. stock Float:fm_distance_to_floor2(index,const Float:start[3], ignoremonsters = 1)
  5881. {
  5882.     // nerekomendyy ispolzovat tk probivaet raznie i neskolko textyr za raz v opredelennih sly4aiah
  5883.     //(dont use it if u dont know how it works)
  5884.    
  5885.     new Float:dest[3], Float:end[3];
  5886.     dest[0] = start[0];
  5887.     dest[1] = start[1];
  5888.     dest[2] = -8191.0;
  5889.  
  5890.     engfunc(EngFunc_TraceLine, start, dest, ignoremonsters, index);
  5891.     global_get(glb_trace_endpos, end);
  5892.     if (end[2] == -8191.0)
  5893.         return 0.0;
  5894.    
  5895.     new Float:ret = start[2] - end[2];
  5896.     return ret > 0 ? ret : 0.0;
  5897. }
  5898.  
  5899. stock bool:HJdetect(index,const Float:vOrigin[3])
  5900. {
  5901.     //TODO better HJ detect...  not buged like this
  5902.     static Float:vStop[3], Float:vStart[3];
  5903.    
  5904.     static Float:vVel[3];
  5905.     static Float:speed;
  5906.     static Float:fraction;
  5907.    
  5908.     pev(index, pev_velocity, vVel);
  5909.     speed = vector_length(vVel);
  5910.    
  5911.     if( speed < 0.1 )
  5912.     {
  5913.         return false;
  5914.     }
  5915.    
  5916.     vStart[0] = vStop[0] = vOrigin[0] + vVel[0]/speed*16.03125;
  5917.     vStart[1] = vStop[1] = vOrigin[1] + vVel[1]/speed*16.03125;
  5918.     vStart[2] = vOrigin[2];// + vMins[2]; // get origin of player's feet
  5919.     vStop[2] = vStart[2] - 69.0; // Changed from 34 to 70 for CS? Or am i doing something wrong..?
  5920.  
  5921.     if( engfunc(EngFunc_PointContents, vStart) == CONTENTS_SOLID ) // make sure start origin isn't in void space, this happens on hills. not sure if it really applies edgefriction here
  5922.     {
  5923.         return false;
  5924.     }
  5925.  
  5926.     engfunc(EngFunc_TraceLine, vStart, vStop, 1, index); // trace a line from player feet to 70 units below that
  5927.     //beam(index, vStart, vStop);
  5928.     global_get(glb_trace_fraction, fraction);
  5929.     if( fraction == 1.0 )
  5930.         return true;
  5931.     return false;
  5932. }
  5933.  
  5934. stock DrawBeam(id, _ljs_beam, type)
  5935. {
  5936.     //predvaritelno nado podgotovit vJumpedAt2 vTraceEnd vBeamPos vOrigin gBeam vBeamTime dl9 type == 1 = lj = bj
  5937.     // CJ - type ==2
  5938.     static i;
  5939.  
  5940.     if( _ljs_beam == 1)
  5941.     {
  5942.         message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id);
  5943.         write_byte (0);
  5944.         write_coord(floatround(vJumpedAt2[0]));
  5945.         write_coord(floatround(vJumpedAt2[1]));
  5946.         write_coord(floatround(vJumpedAt2[2]));
  5947.         write_coord(floatround(vTraceEnd[0]));
  5948.         write_coord(floatround(vTraceEnd[1]));
  5949.         write_coord(floatround(vTraceEnd[2]));
  5950.         write_short(gBeam);
  5951.         write_byte(1);
  5952.         write_byte(5);
  5953.         write_byte(30);
  5954.         write_byte(20);
  5955.         write_byte(0);
  5956.         write_byte(random_num(32, 255));
  5957.         write_byte(random_num(32, 255));
  5958.         write_byte(random_num(32, 255));
  5959.         write_byte(200);
  5960.         write_byte(200);
  5961.         message_end();
  5962.     }
  5963.     else if( _ljs_beam == 2)
  5964.     {
  5965.         set_task(0.4, "gocheck", id);
  5966.         set_task(0.8, "gocheck", id);
  5967.         set_task(1.2, "gocheck", id);
  5968.         for( i = INFO_ZERO; i < 127; i++ )
  5969.         {
  5970.             if( i == 0 )
  5971.             {
  5972.                 message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id);
  5973.                 write_byte (0);
  5974.                 if (type == 1)
  5975.                 {
  5976.                     write_coord(floatround(vJumpedAt2[0]));
  5977.                     write_coord(floatround(vJumpedAt2[1]));
  5978.                 }
  5979.                 else if (type == 2)
  5980.                 {
  5981.                     write_coord(floatround(vDuckedAt[id][0]));
  5982.                     write_coord(floatround(vDuckedAt[id][1]));
  5983.                 }
  5984.                 write_coord(floatround(vTraceEnd[2]));
  5985.                 write_coord(floatround(vBeamPos[id][0][0]));
  5986.                 write_coord(floatround(vBeamPos[id][0][1]));
  5987.                 write_coord(floatround(vTraceEnd[2]));
  5988.                 write_short(gBeam);
  5989.                 write_byte(1);
  5990.                 write_byte(5);
  5991.                 write_byte(15);
  5992.                 write_byte(20);
  5993.                 write_byte(0);
  5994.                 if (type == 1)
  5995.                     write_byte(255);
  5996.                 else if (type == 2)
  5997.                     write_byte(0);
  5998.                 write_byte(255);
  5999.                 write_byte(0);
  6000.                 write_byte(200);
  6001.                 write_byte(200);
  6002.                 message_end();
  6003.                                    
  6004.                 message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id);
  6005.                 write_byte (0);
  6006.                 write_coord(floatround(vBeamPos[id][0][0]));
  6007.                 write_coord(floatround(vBeamPos[id][0][1]));
  6008.                 write_coord(floatround(vTraceEnd[2]));
  6009.                 write_coord(floatround(vBeamPos[id][1][0]));
  6010.                 write_coord(floatround(vBeamPos[id][1][1]));
  6011.                 write_coord(floatround(vTraceEnd[2]));
  6012.                 write_short(gBeam);
  6013.                 write_byte(1);
  6014.                 write_byte(5);
  6015.                 write_byte(15);
  6016.                 write_byte(20);
  6017.                 write_byte(0);
  6018.                 if (type == 1)
  6019.                     write_byte(255);
  6020.                 else if (type == 2)
  6021.                     write_byte(0);
  6022.                 write_byte(255);
  6023.                 write_byte(0);
  6024.                 write_byte(200);
  6025.                 write_byte(200);
  6026.                 message_end();
  6027.             }
  6028.             else if( i == 126 || (vBeamPos[id][i+1][0] == 0
  6029.             && vBeamPos[id][i+1][1] == 0
  6030.             && vBeamPos[id][i+1][2] == 0) )
  6031.             {
  6032.                 message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id);
  6033.                 write_byte (0);
  6034.                 write_coord(floatround(vBeamPos[id][i][0]));
  6035.                 write_coord(floatround(vBeamPos[id][i][1]));
  6036.                 write_coord(floatround(vTraceEnd[2]));
  6037.                 write_coord(floatround(vOrigin[0]));
  6038.                 write_coord(floatround(vOrigin[1]));
  6039.                 write_coord(floatround(vTraceEnd[2]));
  6040.                 write_short(gBeam);
  6041.                 write_byte(1);
  6042.                 write_byte(5);
  6043.                 write_byte(floatround(vBeamTime[id][i]));
  6044.                 write_byte(20);
  6045.                 write_byte(0);
  6046.                 if( vBeamPosStatus[id][i] == 1 )
  6047.                 {
  6048.                     write_byte(255);
  6049.                     write_byte(0);
  6050.                     write_byte(0);
  6051.                 }
  6052.                 else
  6053.                 {
  6054.                     write_byte(255);
  6055.                     write_byte(255);
  6056.                     write_byte(0);
  6057.                 }
  6058.                 write_byte(200);
  6059.                 write_byte(200);
  6060.                 message_end();
  6061.                
  6062.                 message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id);
  6063.                 write_byte (0);
  6064.                 write_coord(floatround(vOrigin[0]));
  6065.                 write_coord(floatround(vOrigin[1]));
  6066.                 write_coord(floatround(vTraceEnd[2]));
  6067.                 write_coord(floatround(vTraceEnd[0]));
  6068.                 write_coord(floatround(vTraceEnd[1]));
  6069.                 write_coord(floatround(vTraceEnd[2]));
  6070.                 write_short(gBeam);
  6071.                 write_byte(1);
  6072.                 write_byte(5);
  6073.                 write_byte(floatround(vBeamTime[id][i]));
  6074.                 write_byte(20);
  6075.                 write_byte(0);
  6076.                 if( vBeamPosStatus[id][i] == 1 )
  6077.                 {
  6078.                     write_byte(255);
  6079.                     write_byte(0);
  6080.                     write_byte(0);
  6081.                 }
  6082.                 else
  6083.                 {
  6084.                     write_byte(255);
  6085.                     write_byte(255);
  6086.                     write_byte(0);
  6087.                 }
  6088.                 write_byte(200);
  6089.                 write_byte(200);
  6090.                 message_end();
  6091.                 break;
  6092.             }
  6093.             else
  6094.             {
  6095.                 message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id);
  6096.                 write_byte (0);
  6097.                 write_coord(floatround(vBeamPos[id][i][0]));
  6098.                 write_coord(floatround(vBeamPos[id][i][1]));
  6099.                 write_coord(floatround(vTraceEnd[2]));
  6100.                 write_coord(floatround(vBeamPos[id][i+1][0]));
  6101.                 write_coord(floatround(vBeamPos[id][i+1][1]));
  6102.                 write_coord(floatround(vTraceEnd[2]));
  6103.                 write_short(gBeam);
  6104.                 write_byte(1);
  6105.                 write_byte(5);
  6106.                 write_byte(floatround(vBeamTime[id][i]));
  6107.                 write_byte(20);
  6108.                 write_byte(0);
  6109.                 if( vBeamPosStatus[id][i] == 1)
  6110.                 {
  6111.                     write_byte(255);
  6112.                     write_byte(0);
  6113.                     write_byte(0);
  6114.                 }
  6115.                 else if( vBeamPosStatus[id][i] == -1 && type == 2)
  6116.                 {
  6117.                     write_byte(0);
  6118.                     write_byte(255);
  6119.                     write_byte(0);
  6120.                 }
  6121.                 else
  6122.                 {  
  6123.                     write_byte(255);
  6124.                     write_byte(255);
  6125.                     write_byte(0);
  6126.                 }
  6127.                 write_byte(200);
  6128.                 write_byte(200);
  6129.                 message_end();
  6130.             }
  6131.         }
  6132.     }
  6133.     return i;  
  6134. }
  6135.  
  6136. stock DrawSpecBeam(i)
  6137. {
  6138.     message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, i);
  6139.     write_byte (0);
  6140.     write_coord(floatround(vJumpedAt2[0]));
  6141.     write_coord(floatround(vJumpedAt2[1]));
  6142.     write_coord(floatround(vJumpedAt2[2]));
  6143.     write_coord(floatround(vTraceEnd[0]));
  6144.     write_coord(floatround(vTraceEnd[1]));
  6145.     write_coord(floatround(vTraceEnd[2]));
  6146.     write_short(gBeam);
  6147.     write_byte(1);
  6148.     write_byte(5);
  6149.     write_byte(30);
  6150.     write_byte(20);
  6151.     write_byte(0);
  6152.     write_byte(random_num(32, 255));
  6153.     write_byte(random_num(32, 255));
  6154.     write_byte(random_num(32, 255));
  6155.     write_byte(200);
  6156.     write_byte(200);
  6157.     message_end();
  6158. }
  6159.  
  6160. stock PrintChatMess(id, color, _DistType, _JumpType)
  6161. {
  6162.     static name[33], i;
  6163.     get_user_name(id, name, 31);
  6164.  
  6165.         //TODO za4em takie yslovi9 ???? //why we need such if //pohorowemy (i == id || is_user_spectating_player(i, id)) nenado
  6166.         // pohorowemy voobshe bgo a ne yslovi9
  6167.  
  6168.     if( _JumpType == TYPE_LJ )
  6169.     {
  6170.         for( i = INFO_ONE; i < 33; i++ )
  6171.         {  
  6172.             if( i == id || is_user_spectating_player(i, id) || (pev_valid(i) && is_user_connected(i) && gHasColorChat[i]) )
  6173.             {
  6174.                 if( color < 6 && color > 0 )
  6175.                 {
  6176.                     switch(color)
  6177.                     {
  6178.                         case 1: ColorChat(i, BLUE, "[XJ] %s jumped %.3f units!", name, fDistance);
  6179.                         case 2: ColorChat(i, GREEN, "[XJ] %s jumped %.3f units!", name, fDistance);
  6180.                         case 3: ColorChat(i, RED, "[XJ] %s jumped %.3f units!", name, fDistance);
  6181.                         case 4: ColorChat(i, GREY, "[XJ] %s jumped %.3f units!", name, fDistance);
  6182.                         case 5: ColorChat(i, TEAM_COLOR, "[XJ] %s jumped %.3f units!", name, fDistance);
  6183.                     }
  6184.                 }
  6185.                 else
  6186.                     client_print(i, print_chat, "[XJ] %s jumped %.3f units!", name, fDistance);
  6187.  
  6188.                 if( get_pcvar_num(kz_lj_sounds) == 1 )
  6189.                 {
  6190.                     if (_DistType == DIST_PRO)
  6191.                     {
  6192.                         if( (i == id || is_user_spectating_player(i, id)))
  6193.                             client_cmd(i, "speak misc/perfect");
  6194.                     }
  6195.                     else if (_DistType == DIST_LEET)
  6196.                     {
  6197.                         if( i == id || is_user_spectating_player(i, id) )
  6198.                             client_cmd(i, "speak misc/mod_wickedsick");
  6199.                     }
  6200.                     else if (_DistType == DIST_GOOD)
  6201.                     {
  6202.                         if( i == id || is_user_spectating_player(i, id) )
  6203.                             client_cmd(i, "speak misc/impressive");
  6204.                     }
  6205.                     else if (_DistType == DIST_GOD)
  6206.                     {
  6207.                             client_cmd(i, "speak misc/mod_godlike");
  6208.                     }
  6209.                 }
  6210.             }
  6211.         }
  6212.     }
  6213.     else if ( _JumpType == TYPE_CJ )
  6214.     {
  6215.         for( i = INFO_ONE; i < 33; i++ )
  6216.         {  
  6217.             if( i == id || is_user_spectating_player(i, id) || (pev_valid(i) && is_user_connected(i) && gHasColorChat[i]) )
  6218.             {
  6219.                 if( color < 6 && color > 0 )
  6220.                 {
  6221.                     switch(color)
  6222.                     {
  6223.                         case 1: ColorChat(i, BLUE, "[XJ] %s jumped %.3f units with cj!", name, fDistance);
  6224.                         case 2: ColorChat(i, GREEN, "[XJ] %s jumped %.3f units with cj!", name, fDistance);
  6225.                         case 3: ColorChat(i, RED, "[XJ] %s jumped %.3f units with cj!", name, fDistance);
  6226.                         case 4: ColorChat(i, GREY, "[XJ] %s jumped %.3f units with cj!", name, fDistance);
  6227.                         case 5: ColorChat(i, TEAM_COLOR, "[XJ] %s jumped %.3f units with cj!", name, fDistance);
  6228.                     }
  6229.                 }
  6230.                 else
  6231.                     client_print(i, print_chat, "[XJ] %s jumped %.3f units with cj!", name, fDistance);
  6232.  
  6233.                 if( get_pcvar_num(kz_lj_sounds) == 1 )
  6234.                 {
  6235.                     if (_DistType == DIST_PRO)
  6236.                     {
  6237.                         if( (i == id || is_user_spectating_player(i, id)))
  6238.                             client_cmd(i, "speak misc/perfect");
  6239.                     }
  6240.                     else if (_DistType == DIST_LEET)
  6241.                     {
  6242.                         if( i == id || is_user_spectating_player(i, id) )
  6243.                             client_cmd(i, "speak misc/mod_wickedsick");
  6244.                     }
  6245.                     else if (_DistType == DIST_GOOD)
  6246.                     {
  6247.                         if( i == id || is_user_spectating_player(i, id) )
  6248.                             client_cmd(i, "speak misc/impressive");
  6249.                     }
  6250.                     else if (_DistType == DIST_GOD)
  6251.                     {
  6252.                             client_cmd(i, "speak misc/mod_godlike");
  6253.                     }
  6254.                 }
  6255.             }
  6256.         }
  6257.     }
  6258.     else if ( _JumpType == TYPE_WJ )
  6259.     {
  6260.         for( i = INFO_ONE; i < 33; i++ )
  6261.         {  
  6262.             if( i == id || is_user_spectating_player(i, id) || (pev_valid(i) && is_user_connected(i) && gHasColorChat[i]) )
  6263.             {
  6264.                 if( color < 6 && color > 0 )
  6265.                 {
  6266.                     switch(color)
  6267.                     {
  6268.                         case 1: ColorChat(i, BLUE, "[XJ] %s jumped %.3f units with wj!", name, fDistance);
  6269.                         case 2: ColorChat(i, GREEN, "[XJ] %s jumped %.3f units with wj!", name, fDistance);
  6270.                         case 3: ColorChat(i, RED, "[XJ] %s jumped %.3f units with wj!", name, fDistance);
  6271.                         case 4: ColorChat(i, GREY, "[XJ] %s jumped %.3f units with wj!", name, fDistance);
  6272.                         case 5: ColorChat(i, TEAM_COLOR, "[XJ] %s jumped %.3f units with wj!", name, fDistance);
  6273.                     }
  6274.                 }
  6275.                 else
  6276.                     client_print(i, print_chat, "[XJ] %s jumped %.3f units with wj!", name, fDistance);
  6277.  
  6278.                 if( get_pcvar_num(kz_lj_sounds) == 1 )
  6279.                 {
  6280.                     if (_DistType == DIST_PRO)
  6281.                     {
  6282.                         if( (i == id || is_user_spectating_player(i, id)))
  6283.                             client_cmd(i, "speak misc/perfect");
  6284.                     }
  6285.                     else if (_DistType == DIST_LEET)
  6286.                     {
  6287.                         if( i == id || is_user_spectating_player(i, id) )
  6288.                             client_cmd(i, "speak misc/mod_wickedsick");
  6289.                     }
  6290.                     else if (_DistType == DIST_GOOD)
  6291.                     {
  6292.                         if( i == id || is_user_spectating_player(i, id) )
  6293.                             client_cmd(i, "speak misc/impressive");
  6294.                     }
  6295.                     else if (_DistType == DIST_GOD)
  6296.                     {
  6297.                             client_cmd(i, "speak misc/mod_godlike");
  6298.                     }
  6299.                 }
  6300.             }
  6301.         }
  6302.     }
  6303.     else if ( _JumpType == TYPE_BJ )
  6304.     {
  6305.         for( i = INFO_ONE; i < 33; i++ )
  6306.         {  
  6307.             if( i == id || is_user_spectating_player(i, id) || (pev_valid(i) && is_user_connected(i) && gHasColorChat[i]) )
  6308.             {
  6309.                 if( color < 6 && color > 0 )
  6310.                 {
  6311.                     switch(color)
  6312.                     {
  6313.                         case 1: ColorChat(i, BLUE, "[XJ] %s jumped %.3f units with bhop!", name, fDistance);
  6314.                         case 2: ColorChat(i, GREEN, "[XJ] %s jumped %.3f units with bhop!", name, fDistance);
  6315.                         case 3: ColorChat(i, RED, "[XJ] %s jumped %.3f units with bhop!", name, fDistance);
  6316.                         case 4: ColorChat(i, GREY, "[XJ] %s jumped %.3f units with bhop!", name, fDistance);
  6317.                         case 5: ColorChat(i, TEAM_COLOR, "[XJ] %s jumped %.3f units with bhop!", name, fDistance);
  6318.                     }
  6319.                 }
  6320.                 else
  6321.                     client_print(i, print_chat, "[XJ] %s jumped %.3f units with bhop!", name, fDistance);
  6322.  
  6323.                 if( get_pcvar_num(kz_lj_sounds) == 1 )
  6324.                 {
  6325.                     if (_DistType == DIST_PRO)
  6326.                     {
  6327.                         if( (i == id || is_user_spectating_player(i, id)))
  6328.                             client_cmd(i, "speak misc/perfect");
  6329.                     }
  6330.                     else if (_DistType == DIST_LEET)
  6331.                     {
  6332.                         if( i == id || is_user_spectating_player(i, id) )
  6333.                             client_cmd(i, "speak misc/mod_wickedsick");
  6334.                     }
  6335.                     else if (_DistType == DIST_GOOD)
  6336.                     {
  6337.                         if( i == id || is_user_spectating_player(i, id) )
  6338.                             client_cmd(i, "speak misc/impressive");
  6339.                     }
  6340.                     else if (_DistType == DIST_GOD)
  6341.                     {
  6342.                             client_cmd(i, "speak misc/mod_godlike");
  6343.                     }
  6344.                 }
  6345.             }
  6346.         }
  6347.     }
  6348.     else if ( _JumpType == TYPE_SBJ )
  6349.     {
  6350.         for( i = INFO_ONE; i < 33; i++ )
  6351.         {  
  6352.             if( i == id || is_user_spectating_player(i, id) || (pev_valid(i) && is_user_connected(i) && gHasColorChat[i]) )
  6353.             {
  6354.                 if( color < 6 && color > 0 )
  6355.                 {
  6356.                     switch(color)
  6357.                     {
  6358.                         case 1: ColorChat(i, BLUE, "[XJ] %s jumped %.3f units with stand-up bhop!", name, fDistance);
  6359.                         case 2: ColorChat(i, GREEN, "[XJ] %s jumped %.3f units with stand-up bhop!", name, fDistance);
  6360.                         case 3: ColorChat(i, RED, "[XJ] %s jumped %.3f units with stand-up bhop!", name, fDistance);
  6361.                         case 4: ColorChat(i, GREY, "[XJ] %s jumped %.3f units with stand-up bhop!", name, fDistance);
  6362.                         case 5: ColorChat(i, TEAM_COLOR, "[XJ] %s jumped %.3f units with stand-up bhop!", name, fDistance);
  6363.                     }
  6364.                 }
  6365.                 else
  6366.                     client_print(i, print_chat, "[XJ] %s jumped %.3f units with stand-up bhop!", name, fDistance);
  6367.  
  6368.                 if( get_pcvar_num(kz_lj_sounds) == 1 )
  6369.                 {
  6370.                     if (_DistType == DIST_PRO)
  6371.                     {
  6372.                         if( (i == id || is_user_spectating_player(i, id)))
  6373.                             client_cmd(i, "speak misc/perfect");
  6374.                     }
  6375.                     else if (_DistType == DIST_LEET)
  6376.                     {
  6377.                         if( i == id || is_user_spectating_player(i, id) )
  6378.                             client_cmd(i, "speak misc/mod_wickedsick");
  6379.                     }
  6380.                     else if (_DistType == DIST_GOOD)
  6381.                     {
  6382.                         if( i == id || is_user_spectating_player(i, id) )
  6383.                             client_cmd(i, "speak misc/impressive");
  6384.                     }
  6385.                     else if (_DistType == DIST_GOD)
  6386.                     {
  6387.                             client_cmd(i, "speak misc/mod_godlike");
  6388.                     }
  6389.                 }
  6390.             }
  6391.         }
  6392.     }
  6393. }
  6394.  
  6395. stock func69(id, type)
  6396. {
  6397.     if( type == TYPE_BJ)
  6398.     {
  6399.         isBhop[id] = false;
  6400.     }
  6401.     else
  6402.     {
  6403.         set_task(0.5,"gocheck", id); //why we need it ?
  6404.         gInAir[id] = false;
  6405.     }
  6406.  
  6407.     //static Float:BlockDist;
  6408.     //BlockDist = 0.0;
  6409.  
  6410.     if (fallDown[id] == true)
  6411.     {
  6412.         vOrigin[0]= vLastFrameOrigin[id][0];
  6413.         vOrigin[1]= vLastFrameOrigin[id][1];
  6414.         vOrigin[2]= vLastFrameOrigin[id][2];
  6415.     }
  6416.     else
  6417.     {
  6418.         pev(id, pev_origin, vOrigin);
  6419.     }
  6420.  
  6421.     //client_print(id, print_console, "vOrigin %f %f %f Speed %f %f %f",vOrigin[0],vOrigin[1],vOrigin[2],vFrameSpeed[id][1][0],vFrameSpeed[id][1][1],vFrameSpeed[id][1][2]);
  6422.  
  6423.     fDistance1 = get_distance_f(vJumpedAt[id], vOrigin)+32.0;
  6424.     //client_print(id, print_console, "fDistance1 %f vor %f %f %f", fDistance1, vOrigin[0],vOrigin[1],vOrigin[2]);
  6425.     //client_print(id, print_console, "fDistance1 %f", fDistance1);
  6426.  
  6427.     rLandPos[2] = vFrameSpeed[id][0][2] * vFrameSpeed[id][0][2] + (2 * get_pcvar_float(sv_gravity) * (vFramePos[id][0][2] - vOrigin[2]));
  6428.     //client_print(id, print_console, "111 %f %f %f",vFrameSpeed[id][0][2],vFramePos[id][0][2],vOrigin[2]);
  6429.     rDistance[0] = (floatsqroot(rLandPos[2]) * -1) - vFrameSpeed[id][1][2];
  6430.  
  6431.     //client_print(id, print_console, "RaZ diff %f  notSqrtZvel %f",(vFramePos[id][0][2] - vOrigin[2]),rLandPos[2]);
  6432.     rDistance[1] = get_pcvar_float(sv_gravity)*-1;
  6433.     //client_print(id, print_console, "rLandPos[2] %f ^n", rLandPos[2]);
  6434.                
  6435.     frame2time = floatdiv(rDistance[0], rDistance[1]);
  6436.     client_print(id, print_console, "frame2time %f %f",frame2time, fDistance1);
  6437.     if( vFrameSpeed[id][1][0] < 0 )
  6438.         vFrameSpeed[id][1][0] = vFrameSpeed[id][1][0]*-1;
  6439.     rDistance[0] = frame2time*vFrameSpeed[id][1][0];
  6440.            
  6441.     if( vFrameSpeed[id][1][1] < 0 )
  6442.         vFrameSpeed[id][1][1] = vFrameSpeed[id][1][1]*-1;
  6443.     rDistance[1] = frame2time*vFrameSpeed[id][1][1];
  6444.  
  6445.     if( vFrameSpeed[id][1][2] < 0 )
  6446.         vFrameSpeed[id][1][2] = vFrameSpeed[id][1][2]*-1;
  6447.     rDistance[2] = frame2time*vFrameSpeed[id][1][2];
  6448.  
  6449.     //client_print(id, print_console, "frame2time %f rD0 %f rD1 %f %f",frame2time,rDistance[0],rDistance[1],rDistance[2]);
  6450.  
  6451.     //client_print(id, print_console, "vFramePos[id][1][0] %f %f vFramePos[id][1][1] %f %f", vFramePos[id][1][0],vOrigin[0], vFramePos[id][1][1],vOrigin[1]);
  6452.     if( vFramePos[id][1][0] < vOrigin[0] )
  6453.         rLandPos[0] = vFramePos[id][1][0] + rDistance[0];
  6454.     else
  6455.         rLandPos[0] = vFramePos[id][1][0] - rDistance[0];
  6456.     if( vFramePos[id][1][1] < vOrigin[1] )
  6457.         rLandPos[1] = vFramePos[id][1][1] + rDistance[1];
  6458.     else
  6459.         rLandPos[1] = vFramePos[id][1][1] - rDistance[1];
  6460.  
  6461.     if( is_in_duck(id) )
  6462.         vOrigin[2]+=18.0;
  6463.  
  6464.     rLandPos[2] = vOrigin[2];
  6465.  
  6466.     //client_print(id, print_console, "rLandPos %f %f %f", rLandPos[0],rLandPos[1],rLandPos[2]);
  6467.  
  6468.     frame2time += (lasttime[id]-jumptime[id]);
  6469.  
  6470.     //client_print(id, print_console, "vJumpedAt[id][2] %f rLandPos[2] %f vFramePos[id][0][2] %f vOrigin[2]modif %f",vJumpedAt[id][2],rLandPos[2],vFramePos[id][0][2], vOrigin[2]);
  6471.  
  6472.     //client_print(id, print_console, "vFrameSpeed[id][0][2] %f", vFrameSpeed[id][0][2]);
  6473.  
  6474.     if( vOrigin[2] == vJumpedAt[id][2] )
  6475.     {
  6476.         if ( type == TYPE_BJ )
  6477.         {
  6478.             if(!(frame2time > 0.48 && frame2time < 0.7) && pev(id, pev_fuser2) > 0.0) //why we use pev_fuser2) > 0.0 here ???
  6479.             {
  6480.                 vOrigin[2] = vOrigin[2]*-1;
  6481.             }
  6482.         }
  6483.         else
  6484.         {
  6485.             if( is_in_duck(id) && !(frame2time > 0.71 && frame2time < 0.77) )
  6486.             {
  6487.                 vOrigin[2] = vOrigin[2]*-1;
  6488.             }
  6489.             else if( !(is_in_duck(id)) && !(frame2time > 0.65 && frame2time < 0.70) )
  6490.             {
  6491.                 vOrigin[2] = vOrigin[2]*-1;
  6492.             }
  6493.         }
  6494.     }
  6495.     fDistance2 = get_distance_f(vJumpedAt[id], rLandPos)+32.00;
  6496.  
  6497.     //client_print(id, print_console, "fDistance2 %f vFrameSpeed[id][0][2] %f vFrameSpeed[id][1][2] %f", fDistance2, vFrameSpeed[id][0][2],vFrameSpeed[id][1][2]);
  6498.                
  6499.         //if( (fDistance1+0.25 > fDistance2) && type == TYPE_BJ ) //TODO good calculation
  6500.     if( fDistance1 > fDistance2 )
  6501.     {
  6502.         fDistance = fDistance2;
  6503.         vOrigin[0] = rLandPos[0];
  6504.         vOrigin[1] = rLandPos[1];
  6505.     }
  6506.     else
  6507.         fDistance = fDistance1;
  6508.  
  6509.     vJumpedAt2[2] = vJumpedAt[id][2]-34.0;
  6510.     vTraceEnd[2] = vOrigin[2]-34.0;
  6511.                
  6512.     vJumpedAt2[0] = vJumpedAt[id][0];
  6513.     vTraceEnd[0] = vOrigin[0];
  6514.  
  6515.     vJumpedAt2[1] = vJumpedAt[id][1]-vJumpedAt[id][1];
  6516.     vTraceEnd[1] = vOrigin[1]-vOrigin[1];
  6517.  
  6518.     xDistance = get_distance_f(vJumpedAt2, vTraceEnd);
  6519.  
  6520.     vJumpedAt2[0] = vJumpedAt[id][0]-vJumpedAt[id][0];
  6521.     vTraceEnd[0] = vOrigin[0]-vOrigin[0];
  6522.  
  6523.     vJumpedAt2[1] = vJumpedAt[id][1];
  6524.     vTraceEnd[1] = vOrigin[1];
  6525.  
  6526.     yDistance = get_distance_f(vJumpedAt2, vTraceEnd);
  6527.  
  6528.     if( vJumpedAt[id][0] > vOrigin[0] )
  6529.     {
  6530.         vJumpedAt2[0] = vJumpedAt[id][0]+(xDistance*16.03125/fDistance);
  6531.         vTraceEnd[0] = vOrigin[0]-(xDistance*16.03125/fDistance);
  6532.     }
  6533.     else if( vJumpedAt[id][0] < vOrigin[0] )
  6534.     {
  6535.         vJumpedAt2[0] = vJumpedAt[id][0]-(xDistance*16.03125/fDistance);
  6536.         vTraceEnd[0] = vOrigin[0]+(xDistance*16.03125/fDistance);
  6537.     }
  6538.     else
  6539.     {
  6540.         vJumpedAt2[0] = vJumpedAt[id][0];
  6541.         vTraceEnd[0] = vOrigin[0];
  6542.     }
  6543.  
  6544.     if( vJumpedAt[id][1] > vOrigin[1] )
  6545.     {
  6546.         vJumpedAt2[1] = vJumpedAt[id][1]+(yDistance*16.03125/fDistance);
  6547.         vTraceEnd[1] = vOrigin[1]-(yDistance*16.03125/fDistance);
  6548.     }
  6549.     else if( vJumpedAt[id][1] < vOrigin[1] )
  6550.     {
  6551.         vJumpedAt2[1] = vJumpedAt[id][1]-(yDistance*16.03125/fDistance);
  6552.         vTraceEnd[1] = vOrigin[1]+(yDistance*16.03125/fDistance);
  6553.     }
  6554.     else
  6555.     {
  6556.         vJumpedAt2[1] = vJumpedAt[id][1];
  6557.         vTraceEnd[1] = vOrigin[1];
  6558.     }
  6559. }  
  6560.  
  6561.  
  6562. stock func77(id, type) 
  6563. {  
  6564.     static ent2;
  6565.     new Float:orig[3];
  6566.     static classname3[33];
  6567.     pev(id, pev_origin, orig);
  6568.     if (is_in_duck(id))
  6569.     {
  6570.         while((ent2 = engfunc(EngFunc_FindEntityInSphere, 33, orig, 19.0)) != 0)
  6571.         {
  6572.             pev(ent2, pev_classname, classname3, 32);
  6573.             if( equal(classname3, "func_train")
  6574.                 || equal(classname3, "func_conveyor")
  6575.                 || equal(classname3, "trigger_push")
  6576.                 || equal(classname3, "trigger_gravity")
  6577.                 || equal(classname3, "func_door")
  6578.                 || equal(classname3, "func_door_rotating") )
  6579.             {
  6580.                 return 1;
  6581.             }
  6582.         }
  6583.     }
  6584.     else
  6585.     {
  6586.         while((ent2 = engfunc(EngFunc_FindEntityInSphere, 33, orig, 37.0)) != 0)
  6587.         {
  6588.             pev(ent2, pev_classname, classname3, 32);
  6589.             if( equal(classname3, "func_train")
  6590.                 || equal(classname3, "func_conveyor")
  6591.                 || equal(classname3, "trigger_push")
  6592.                 || equal(classname3, "trigger_gravity")
  6593.                 || equal(classname3, "func_door")
  6594.                 || equal(classname3, "func_door_rotating") )
  6595.             {
  6596.                 return 1;
  6597.             }
  6598.         }
  6599.     }
  6600.     return 0;
  6601. }
Add Comment
Please, Sign In to add comment