Advertisement
mpasd

prokreedz

Dec 17th, 2018
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 74.18 KB | None | 0 0
  1. #include amxmodx
  2. #include cstrike
  3. #include colorchat
  4. #include fun
  5. #include fakemeta
  6. #include hamsandwich
  7.  
  8. #define USE_SQL
  9.  
  10. #if defined USE_SQL
  11. #include sqlx
  12. #include geoip
  13. #endif
  14.  
  15. #define KZ_LEVEL ADMIN_KICK
  16. #define MSG MSG_ONE_UNRELIABLE
  17. #define MAX_ENTITYS 900+1532
  18. #define IsOnLadder(%1) (pev(%1, pev_movetype) == MOVETYPE_FLY)
  19. #define VERSION 2.31
  20.  
  21. #define SCOREATTRIB_NONE 0
  22. #define SCOREATTRIB_DEAD ( 1 0 )
  23. #define SCOREATTRIB_BOMB ( 1 1 )
  24. #define SCOREATTRIB_VIP ( 1 2 )
  25.  
  26.  
  27. new g_iPlayers[32], g_iNum, g_iPlayer
  28. new const g_szAliveFlags[] = a
  29. #define RefreshPlayersList() get_players(g_iPlayers, g_iNum, g_szAliveFlags)
  30.  
  31. new const FL_ONGROUND2 = ( FL_ONGROUND FL_PARTIALGROUND FL_INWATER FL_CONVEYOR FL_FLOAT )
  32. new const KZ_STARTFILE[] = start.ini
  33. new const KZ_STARTFILE_TEMP[] = temp_start.ini
  34.  
  35. #if defined USE_SQL
  36. new Handleg_SqlTuple
  37. new HandleSqlConnection
  38. new g_Error[512]
  39. new kz_sql_host
  40. new kz_sql_user
  41. new kz_sql_pass
  42. new kz_sql_db
  43. new kz_sql_name
  44. new kz_sql_files
  45. #else
  46. new FloatPro_Times[24]
  47. new Pro_AuthIDS[24][32]
  48. new Pro_Names[24][32]
  49. new Pro_Date[24][32]
  50. new FloatNoob_Tiempos[24]
  51. new Noob_AuthIDS[24][32]
  52. new Noob_Names[24][32]
  53. new Noob_Date[24][32]
  54. new Noob_CheckPoints[24]
  55. new Noob_GoChecks[24]
  56. new Noob_Weapon[24][32]
  57. #endif
  58.  
  59. new FloatCheckpoints[33][2][3]
  60. new Floattimer_time[33]
  61. new Floatg_pausetime[33]
  62. new Floatantihookcheat[33]
  63. new FloatSpecLoc[33][3]
  64. new FloatNoclipPos[33][3]
  65. new FloatPauseOrigin[33][3]
  66. new FloatSavedStart[33][3]
  67. new hookorigin[33][3]
  68. new FloatDefaultStartPos[3]
  69.  
  70. new FloatSavedTime[33]
  71. new SavedChecks[33]
  72. new SavedGoChecks[33]
  73. new SavedScout[33]
  74. new SavedOrigins[33][3]
  75.  
  76. new boolg_bCpAlternate[33]
  77. new booltimer_started[33]
  78. new boolIsPaused[33]
  79. new boolWasPaused[33]
  80. new boolfirstspawn[33]
  81. new boolcanusehook[33]
  82. new boolishooked[33]
  83. new booluser_has_scout[33]
  84. new boolNightVisionUse[33]
  85. new boolHealsOnMap
  86. new boolgViewInvisible[33]
  87. new boolgMarkedInvisible[33] = { true, ...};
  88. new boolgWaterInvisible[33]
  89. new boolgWaterEntity[MAX_ENTITYS]
  90. new boolgWaterFound
  91. new boolDefaultStart
  92. new boolAutoStart[33]
  93.  
  94. new Trieg_tStarts
  95. new Trieg_tStops;
  96.  
  97. new checknumbers[33]
  98. new gochecknumbers[33]
  99. new chatorhud[33]
  100. new ShowTime[33]
  101. new MapName[64]
  102. new Kzdir[128]
  103. new SavePosDir[128]
  104. new prefix[33]
  105. #if !defined USE_SQL
  106. new Topdir[128]
  107. #endif
  108.  
  109. new kz_checkpoints
  110. new kz_cheatdetect
  111. new kz_spawn_mainmenu
  112. new kz_show_timer
  113. new kz_chatorhud
  114. new kz_hud_color
  115. new kz_chat_prefix
  116. new hud_message
  117. new kz_other_weapons
  118. new kz_maxspeedmsg
  119. new kz_drop_weapons
  120. new kz_remove_drops
  121. new kz_pick_weapons
  122. new kz_reload_weapons
  123. new kz_use_radio
  124. new kz_hook_prize
  125. new kz_hook_sound
  126. new kz_hook_speed
  127. new kz_pause
  128. new kz_noclip_pause
  129. new kz_nvg
  130. new kz_nvg_colors
  131. new kz_vip
  132. new kz_respawn_ct
  133. new kz_save_pos
  134. new kz_save_pos_gochecks
  135. new kz_semiclip
  136. new kz_semiclip_transparency
  137. new kz_spec_saves
  138. new kz_save_autostart
  139. new kz_top15_authid
  140. new Sbeam = 0
  141.  
  142. new const other_weapons[8] =
  143. {
  144. CSW_SCOUT, CSW_P90, CSW_FAMAS, CSW_SG552,
  145. CSW_M4A1, CSW_M249, CSW_AK47, CSW_AWP
  146. }
  147.  
  148. new const other_weapons_name[8][] =
  149. {
  150. weapon_scout, weapon_p90, weapon_famas, weapon_sg552,
  151. weapon_m4a1, weapon_m249, weapon_ak47, weapon_awp
  152. }
  153.  
  154. new const g_weaponsnames[][] =
  155. {
  156. , NULL
  157. p228, shield, scout, hegrenade, xm1014, c4,
  158. mac10, aug, smokegrenade, elite, fiveseven,
  159. ump45, sg550, galil, famas, usp, glock18,
  160. awp, mp5navy, m249, m3, m4a1, tmp, g3sg1,
  161. flashbang, deagle, sg552, ak47, knife, p90,
  162. glock, elites, fn57, mp5, vest, vesthelm,
  163. flash, hegren, sgren, defuser, nvgs, primammo,
  164. secammo, km45, 9x19mm, nighthawk, 228compact,
  165. 12gauge, autoshotgun, mp, c90, cv47, defender,
  166. clarion, krieg552, bullpup, magnum, d3au1,
  167. krieg550
  168. }
  169.  
  170. new const g_block_commands[][]=
  171. {
  172. buy, buyammo1, buyammo2, buyequip,
  173. cl_autobuy, cl_rebuy, cl_setautobuy, cl_setrebuy
  174.  
  175. }
  176.  
  177. #if defined USE_SQL
  178. enum
  179. {
  180. TOP_NULL,
  181. PRO_TOP,
  182. NUB_TOP,
  183. LAST_PRO10,
  184. PRO_RECORDS,
  185. PLAYERS_RANKING,
  186. MAPS_STATISTIC
  187. }
  188. #endif
  189.  
  190. =================================================================================================
  191.  
  192. public plugin_init()
  193. {
  194. register_plugin(ProKreedz, VERSION, nucLeaR & p4ddY)
  195.  
  196. kz_checkpoints = register_cvar(kz_checkpoints,1)
  197. kz_cheatdetect = register_cvar(kz_cheatdetect,1)
  198. kz_spawn_mainmenu = register_cvar(kz_spawn_mainmenu, 1)
  199. kz_show_timer = register_cvar(kz_show_timer, 1)
  200. kz_chatorhud = register_cvar(kz_chatorhud, 2)
  201. kz_chat_prefix = register_cvar(kz_chat_prefix, [KZ])
  202. kz_hud_color = register_cvar(kz_hud_color, 12 122 221)
  203. kz_other_weapons = register_cvar(kz_other_weapons,1)
  204. kz_drop_weapons = register_cvar(kz_drop_weapons, 0)
  205. kz_remove_drops = register_cvar(kz_remove_drops, 1)
  206. kz_pick_weapons = register_cvar(kz_pick_weapons, 0)
  207. kz_reload_weapons = register_cvar(kz_reload_weapons, 0)
  208. kz_maxspeedmsg = register_cvar(kz_maxspeedmsg,1)
  209. kz_hook_prize = register_cvar(kz_hook_prize,1)
  210. kz_hook_sound = register_cvar(kz_hook_sound,1)
  211. kz_hook_speed = register_cvar(kz_hook_speed, 300.0)
  212. kz_use_radio = register_cvar(kz_use_radio, 0)
  213. kz_pause = register_cvar(kz_pause, 1)
  214. kz_noclip_pause = register_cvar(kz_noclip_pause, 1)
  215. kz_nvg = register_cvar(kz_nvg,1)
  216. kz_nvg_colors = register_cvar(kz_nvg_colors,5 0 255)
  217. kz_vip = register_cvar(kz_vip,1)
  218. kz_respawn_ct = register_cvar(kz_respawn_ct, 1)
  219. kz_semiclip = register_cvar(kz_semiclip, 1)
  220. kz_semiclip_transparency = register_cvar (kz_semiclip_transparency, 85)
  221. kz_spec_saves = register_cvar(kz_spec_saves, 1)
  222. kz_save_autostart = register_cvar(kz_save_autostart, 1)
  223. kz_top15_authid = register_cvar(kz_top15_authid, 1)
  224. kz_save_pos = register_cvar(kz_save_pos, 1)
  225. kz_save_pos_gochecks = register_cvar(kz_save_pos_gochecks, 1)
  226.  
  227. #if defined USE_SQL
  228. kz_sql_host = register_cvar(kz_sql_host, ) Host of DB
  229. kz_sql_user = register_cvar(kz_sql_user, ) Username of DB
  230. kz_sql_pass = register_cvar(kz_sql_pass, , FCVAR_PROTECTED) Password for DB user
  231. kz_sql_db = register_cvar(kz_sql_db, ) DB Name for the top 15
  232. kz_sql_name = register_cvar(kz_sql_server, ) Name of server
  233. kz_sql_files = register_cvar(kz_sql_files, ) Path of the PHP files
  234. #endif
  235.  
  236. register_clcmd(cp,CheckPoint)
  237. register_clcmd(drop, BlockDrop)
  238. register_clcmd(gc, GoCheck)
  239. register_clcmd(+hook,hook_on,KZ_LEVEL)
  240. register_clcmd(-hook,hook_off,KZ_LEVEL)
  241. register_concmd(kz_hook,give_hook, KZ_LEVEL, name#useridsteamid@ALL onoff)
  242. register_concmd(nightvision,ToggleNVG)
  243. register_clcmd(radio1, BlockRadio)
  244. register_clcmd(radio2, BlockRadio)
  245. register_clcmd(radio3, BlockRadio)
  246. register_clcmd(tp,GoCheck)
  247.  
  248. kz_register_saycmd(cp,CheckPoint,0)
  249. kz_register_saycmd(chatorhud, ChatHud, 0)
  250. kz_register_saycmd(ct,ct,0)
  251. kz_register_saycmd(gc, GoCheck,0)
  252. kz_register_saycmd(gocheck, GoCheck,0)
  253. kz_register_saycmd(god, GodMode,0)
  254. kz_register_saycmd(godmode, GodMode, 0)
  255. kz_register_saycmd(invis, InvisMenu, 0)
  256. kz_register_saycmd(kz, kz_menu, 0)
  257. kz_register_saycmd(menu,kz_menu, 0)
  258. kz_register_saycmd(nc, noclip, 0)
  259. kz_register_saycmd(noclip, noclip, 0)
  260. kz_register_saycmd(noob10, NoobTop_show, 0)
  261. kz_register_saycmd(noob15, NoobTop_show, 0)
  262. kz_register_saycmd(nub10, NoobTop_show, 0)
  263. kz_register_saycmd(nub15, NoobTop_show, 0)
  264. kz_register_saycmd(pause, Pause, 0)
  265. kz_register_saycmd(pinvis, cmdInvisible, 0)
  266. kz_register_saycmd(pro10, ProTop_show, 0)
  267. kz_register_saycmd(pro15, ProTop_show, 0)
  268. kz_register_saycmd(reset, reset_checkpoints, 0)
  269. kz_register_saycmd(respawn, goStart, 0)
  270. kz_register_saycmd(savepos, SavePos, 0)
  271. kz_register_saycmd(scout, cmdScout, 0)
  272. kz_register_saycmd(setstart, setStart, KZ_LEVEL)
  273. kz_register_saycmd(showtimer, ShowTimer_Menu, 0)
  274. kz_register_saycmd(spec, ct, 0)
  275. kz_register_saycmd(start, goStart, 0)
  276. kz_register_saycmd(stuck, Stuck, 0)
  277. kz_register_saycmd(teleport, GoCheck, 0)
  278. kz_register_saycmd(timer, ShowTimer_Menu, 0)
  279. kz_register_saycmd(top15, top15menu,0)
  280. kz_register_saycmd(top10, top15menu,0)
  281. kz_register_saycmd(tp, GoCheck,0)
  282. kz_register_saycmd(usp, cmdUsp, 0)
  283. kz_register_saycmd(weapons, weapons, 0)
  284. kz_register_saycmd(guns, weapons, 0)
  285. kz_register_saycmd(winvis, cmdWaterInvisible, 0)
  286.  
  287. #if defined USE_SQL
  288. kz_register_saycmd(prorecords, ProRecs_show, 0)
  289. kz_register_saycmd(prorecs, ProRecs_show, 0)
  290. #endif
  291.  
  292. register_event(CurWeapon, curweapon, be, 1=1)
  293. register_event( StatusValue, EventStatusValue, b, 10, 20 );
  294.  
  295. register_forward(FM_AddToFullPack, FM_client_AddToFullPack_Post, 1)
  296.  
  297. RegisterHam( Ham_Player_PreThink, player, Ham_CBasePlayer_PreThink_Post, 1)
  298. RegisterHam( Ham_Use, func_button, fwdUse, 0)
  299. RegisterHam( Ham_Killed, player, Ham_CBasePlayer_Killed_Post, 1)
  300. RegisterHam( Ham_Touch, weaponbox, FwdSpawnWeaponbox )
  301. RegisterHam( Ham_Spawn, player, FwdHamPlayerSpawn, 1 )
  302. RegisterHam( Ham_Touch, weaponbox, GroundWeapon_Touch)
  303.  
  304. register_message( get_user_msgid( ScoreAttrib ), MessageScoreAttrib )
  305. register_dictionary(prokreedz.txt)
  306. get_pcvar_string(kz_chat_prefix, prefix, 31)
  307. get_mapname(MapName, 63)
  308. set_msg_block(get_user_msgid(ClCorpse), BLOCK_SET)
  309. set_task(0.5,timer_task,2000,,0,ab)
  310. #if defined USE_SQL
  311. set_task(0.2, plugin_sql)
  312. #endif
  313.  
  314. new kreedz_cfg[128], ConfigDir[64]
  315. get_configsdir( ConfigDir, 64)
  316. formatex(Kzdir,128, %skz, ConfigDir)
  317. if( !dir_exists(Kzdir) )
  318. mkdir(Kzdir)
  319.  
  320. #if !defined USE_SQL
  321. formatex(Topdir,128, %stop15, Kzdir)
  322. if( !dir_exists(Topdir) )
  323. mkdir(Topdir)
  324. #endif
  325.  
  326. formatex(SavePosDir, 128, %ssavepos, Kzdir)
  327. if( !dir_exists(SavePosDir) )
  328. mkdir(SavePosDir)
  329.  
  330. formatex(kreedz_cfg,128,%skreedz.cfg, Kzdir)
  331.  
  332. if( file_exists( kreedz_cfg ) )
  333. {
  334. server_exec()
  335. server_cmd(exec %s,kreedz_cfg)
  336. }
  337.  
  338. for(new i = 0; i sizeof(g_block_commands) ; i++)
  339. register_clcmd(g_block_commands[i], BlockBuy)
  340.  
  341. g_tStarts = TrieCreate( )
  342. g_tStops = TrieCreate( )
  343.  
  344. new const szStarts[ ][ ] =
  345. {
  346. counter_start, clockstartbutton, firsttimerelay, but_start, counter_start_button,
  347. multi_start, timer_startbutton, start_timer_emi, gogogo
  348. }
  349.  
  350. new const szStops[ ][ ] =
  351. {
  352. counter_off, clockstopbutton, clockstop, but_stop, counter_stop_button,
  353. multi_stop, stop_counter, m_counter_end_emi
  354. }
  355.  
  356. for( new i = 0; i sizeof szStarts; i++ )
  357. TrieSetCell( g_tStarts, szStarts[ i ], 1 )
  358.  
  359. for( new i = 0; i sizeof szStops; i++ )
  360. TrieSetCell( g_tStops, szStops[ i ], 1 )
  361. }
  362.  
  363. #if defined USE_SQL
  364. public plugin_sql()
  365. {
  366. new host[64], user[64], pass[64], db[64]
  367.  
  368. get_pcvar_string(kz_sql_host, host, 63)
  369. get_pcvar_string(kz_sql_user, user, 63)
  370. get_pcvar_string(kz_sql_pass, pass, 63)
  371. get_pcvar_string(kz_sql_db, db, 63)
  372.  
  373. g_SqlTuple = SQL_MakeDbTuple(host, user, pass, db)
  374.  
  375. new ErrorCode
  376. SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
  377.  
  378. if(!SqlConnection)
  379. {
  380. server_print([KZ] TOP15 SQL Could not connect to SQL database.!)
  381. log_amx([KZ] TOP15 SQL Could not connect to SQL database.)
  382. return pause(a)
  383. }
  384.  
  385. new createinto[1001]
  386. formatex(createinto, 1000, CREATE TABLE IF NOT EXISTS `kz_pro15` (`mapname` varchar(64) NOT NULL, `authid` varchar(64) NOT NULL, `country` varchar(6) NOT NULL, `name` varchar(64) NOT NULL, `time` decimal(65,2) NOT NULL, `date` datetime NOT NULL, `weapon` varchar(64) NOT NULL, `server` varchar(64) NOT NULL))
  387. SQL_ThreadQuery(g_SqlTuple,QueryHandle, createinto)
  388. formatex(createinto, 1000, CREATE TABLE IF NOT EXISTS `kz_nub15` (`mapname` varchar(64) NOT NULL, `authid` varchar(64) NOT NULL, `country` varchar(6) NOT NULL, `name` varchar(64) NOT NULL, `time`decimal(65,2) NOT NULL, `date` datetime NOT NULL, `weapon` varchar(64) NOT NULL, `server` varchar(64) NOT NULL, `checkpoints` real NOT NULL, `gocheck` real NOT NULL))
  389. SQL_ThreadQuery(g_SqlTuple,QueryHandle, createinto)
  390.  
  391. return PLUGIN_CONTINUE
  392. }
  393.  
  394. public QueryHandle(iFailState, HandlehQuery, szError[], iErrnum, cData[], iSize, FloatfQueueTime)
  395. {
  396. if( iFailState != TQUERY_SUCCESS )
  397. {
  398. log_amx([KZ] TOP15 SQL SQL Error #%d - %s, iErrnum, szError)
  399. ColorChat(0, GREEN, [KZ]^x01 Warning the SQL Tops can not be saved.)
  400. }
  401.  
  402. server_print([KZ] Server Sending Info to SQL Server)
  403.  
  404. return PLUGIN_CONTINUE
  405. }
  406. #endif
  407.  
  408. public plugin_precache()
  409. {
  410. hud_message = CreateHudSyncObj()
  411. RegisterHam( Ham_Spawn, func_door, FwdHamDoorSpawn, 1 )
  412. precache_sound(weaponsxbow_hit2.wav)
  413. Sbeam = precache_model(spriteslaserbeam.spr)
  414. }
  415.  
  416. public plugin_cfg()
  417. {
  418. #if !defined USE_SQL
  419. for (new i = 0 ; i 15; ++i)
  420. {
  421. Pro_Times[i] = 999999999.00000;
  422. Noob_Tiempos[i] = 999999999.00000;
  423. }
  424.  
  425. read_pro15()
  426. read_Noob15()
  427. #endif
  428.  
  429. new startcheck[100], data[256], map[64], x[13], y[13], z[13];
  430. formatex(startcheck, 99, %s%s, Kzdir, KZ_STARTFILE)
  431. new f = fopen(startcheck, rt )
  432. while( !feof( f ) )
  433. {
  434. fgets( f, data, sizeof data - 1 )
  435. parse( data, map, 63, x, 12, y, 12, z, 12)
  436.  
  437. if( equali( map, MapName ) )
  438. {
  439. DefaultStartPos[0] = str_to_float(x)
  440. DefaultStartPos[1] = str_to_float(y)
  441. DefaultStartPos[2] = str_to_float(z)
  442.  
  443. DefaultStart = true
  444. break;
  445. }
  446. }
  447. fclose(f)
  448.  
  449. new ent = -1;
  450. while( ( ent = engfunc(EngFunc_FindEntityByString, ent, classname, func_water) ) != 0 )
  451. {
  452. if( !gWaterFound )
  453. {
  454. gWaterFound = true;
  455. }
  456.  
  457. gWaterEntity[ent] = true;
  458. }
  459.  
  460. ent = -1;
  461. while( ( ent = engfunc(EngFunc_FindEntityByString, ent, classname, func_illusionary) ) != 0 )
  462. {
  463. if( pev( ent, pev_skin ) == CONTENTS_WATER )
  464. {
  465. if( !gWaterFound )
  466. {
  467. gWaterFound = true;
  468. }
  469.  
  470. gWaterEntity[ent] = true;
  471. }
  472. }
  473.  
  474. ent = -1;
  475. while( ( ent = engfunc(EngFunc_FindEntityByString, ent, classname, func_conveyor) ) != 0 )
  476. {
  477. if( pev( ent, pev_spawnflags ) == 3 )
  478. {
  479. if( !gWaterFound )
  480. {
  481. gWaterFound = true;
  482. }
  483.  
  484. gWaterEntity[ent] = true;
  485. }
  486. }
  487. }
  488.  
  489. public client_command(id)
  490. {
  491.  
  492. new sArg[13];
  493. if( read_argv(0, sArg, 12) 11 )
  494. {
  495. return PLUGIN_CONTINUE;
  496. }
  497.  
  498. for( new i = 0; i sizeof(g_weaponsnames); i++ )
  499. {
  500. if( equali(g_weaponsnames[i], sArg, 0) )
  501. {
  502. return PLUGIN_HANDLED;
  503. }
  504. }
  505. return PLUGIN_CONTINUE;
  506. }
  507.  
  508. =================================================================================================
  509. Global Functions
  510. =================================================================================================
  511.  
  512. public Pause(id)
  513. {
  514.  
  515. if (get_pcvar_num(kz_pause) == 0)
  516. {
  517. kz_chat(id, %L, id, KZ_PAUSE_DISABLED)
  518.  
  519. return PLUGIN_HANDLED
  520. }
  521.  
  522. if(! is_user_alive(id) )
  523. {
  524. kz_chat(id, %L, id, KZ_NOT_ALIVE)
  525.  
  526. return PLUGIN_HANDLED
  527. }
  528.  
  529.  
  530. if(!IsPaused[id])
  531. {
  532. if(! timer_started[id])
  533. {
  534. kz_chat(id, %L, id, KZ_TIMER_NOT_STARTED)
  535. return PLUGIN_HANDLED
  536. }
  537.  
  538. g_pausetime[id] = get_gametime() - timer_time[id]
  539. timer_time[id] = 0.0
  540. IsPaused[id] = true
  541. kz_chat(id, %L, id, KZ_PAUSE_ON)
  542. set_pev(id, pev_flags, pev(id, pev_flags) FL_FROZEN)
  543. pev(id, pev_origin, PauseOrigin[id])
  544.  
  545. }
  546. else
  547. {
  548. if(timer_started[id])
  549. {
  550. kz_chat(id, %L, id, KZ_PAUSE_OFF)
  551. if(get_user_noclip(id))
  552. noclip(id)
  553. timer_time[id] = get_gametime() - g_pausetime[id]
  554. }
  555. IsPaused[id] = false
  556. set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
  557. }
  558.  
  559.  
  560. return PLUGIN_HANDLED
  561. }
  562.  
  563. public timer_task()
  564. {
  565. if ( get_pcvar_num(kz_show_timer) 0 )
  566. {
  567. new Alive[32], Dead[32], alivePlayers, deadPlayers;
  568. get_players(Alive, alivePlayers, ach)
  569. get_players(Dead, deadPlayers, bch)
  570. for(new i=0;ialivePlayers;i++)
  571. {
  572. if( timer_started[Alive[i]])
  573. {
  574. new Floatkreedztime = get_gametime() - (IsPaused[Alive[i]] get_gametime() - g_pausetime[Alive[i]] timer_time[Alive[i]])
  575.  
  576. if( ShowTime[Alive[i]] == 1 )
  577. {
  578. new colors[12], r[4], g[4], b[4];
  579. new imin = floatround(kreedztime 60.0,floatround_floor)
  580. new isec = floatround(kreedztime - imin 60.0,floatround_floor)
  581. get_pcvar_string(kz_hud_color, colors, 11)
  582. parse(colors, r, 3, g, 3, b, 4)
  583.  
  584. set_hudmessage(str_to_num(r), str_to_num(g), str_to_num(b), 0.40, 0.10, 0, 0.0, 1.0, 0.0, 0.0, 1)
  585. show_hudmessage(Alive[i], Time %02d%02d CPs %d TPs %d %s ,imin, isec,checknumbers[Alive[i]], gochecknumbers[Alive[i]], IsPaused[Alive[i]] Paused )
  586. }
  587. else
  588. if( ShowTime[Alive[i]] == 2 )
  589. {
  590. kz_showtime_roundtime(Alive[i], floatround(kreedztime))
  591. }
  592. }
  593.  
  594. }
  595. for(new i=0;ideadPlayers;i++)
  596. {
  597. new specmode = pev(Dead[i], pev_iuser1)
  598. if(specmode == 2 specmode == 4)
  599. {
  600. new target = pev(Dead[i], pev_iuser2)
  601. if(target != Dead[i])
  602. if(is_user_alive(target) && timer_started[target])
  603. {
  604. new name[32], colors[12], r[4], g[4], b[4];
  605. get_user_name (target, name, 31)
  606.  
  607. new Floatkreedztime = get_gametime() - (IsPaused[target] get_gametime() - g_pausetime[target] timer_time[target])
  608. new imin = floatround(kreedztime 60.0,floatround_floor)
  609. new isec = floatround(kreedztime - imin 60.0,floatround_floor)
  610.  
  611. get_pcvar_string(kz_hud_color, colors, 11)
  612. parse(colors, r, 3, g, 3, b, 4)
  613.  
  614. set_hudmessage(str_to_num(r), str_to_num(g), str_to_num(b), -1.0, 0.46, 0, 0.0, 1.0, 0.0, 0.0, 1)
  615. show_hudmessage(Dead[i], Time %02d%02d CPs %d TPs %d %s ,imin, isec, checknumbers[target], gochecknumbers[target], IsPaused[target] Paused )
  616. }
  617. }
  618. }
  619. }
  620. }
  621.  
  622. ============================ Block Commands ================================
  623.  
  624.  
  625. public BlockRadio(id)
  626. {
  627. if (get_pcvar_num(kz_use_radio) == 1)
  628. return PLUGIN_CONTINUE
  629. return PLUGIN_HANDLED
  630. }
  631.  
  632. public BlockDrop(id)
  633. {
  634. if (get_pcvar_num(kz_drop_weapons) == 1)
  635. return PLUGIN_CONTINUE
  636. return PLUGIN_HANDLED
  637. }
  638.  
  639. public BlockBuy(id)
  640. {
  641. return PLUGIN_HANDLED
  642. }
  643.  
  644. public CmdRespawn(id)
  645. {
  646. if ( get_user_team(id) == 3 )
  647. return PLUGIN_HANDLED
  648. else
  649. ExecuteHamB(Ham_CS_RoundRespawn, id)
  650.  
  651. return PLUGIN_HANDLED
  652. }
  653.  
  654. public ChatHud(id)
  655. {
  656. if(get_pcvar_num(kz_chatorhud) == 0)
  657. {
  658. ColorChat(id, GREEN, %s^x01 %L, id, KZ_CHECKPOINT_OFF, prefix)
  659. return PLUGIN_HANDLED
  660. }
  661. if(chatorhud[id] == -1)
  662. ++chatorhud[id];
  663.  
  664. ++chatorhud[id];
  665.  
  666. if(chatorhud[id] == 3)
  667. chatorhud[id] = 0;
  668. else
  669. kz_chat(id, %L, id, KZ_CHATORHUD, chatorhud[id] == 1 Chat HUD)
  670.  
  671. return PLUGIN_HANDLED
  672. }
  673.  
  674. public ct(id)
  675. {
  676. if( IsPaused[ id ] )
  677. {
  678. ColorChat( id, RED, ^4[KZ]^1 Not possible while in pause. )
  679. return PLUGIN_HANDLED
  680. }
  681. new CsTeamsteam = cs_get_user_team(id)
  682. if (team == CS_TEAM_CT)
  683. {
  684. if( !( pev( id, pev_flags ) & FL_ONGROUND2 ) && timer_started[id] )
  685. return PLUGIN_HANDLED
  686.  
  687. if (get_pcvar_num(kz_spec_saves) == 1)
  688. {
  689. pev(id, pev_origin, SpecLoc[id])
  690.  
  691. if ( timer_started[id] )
  692. {
  693. if ( IsPaused[id] )
  694. {
  695. Pause(id)
  696. WasPaused[id]=true
  697. }
  698.  
  699. g_pausetime[id] = get_gametime() - timer_time[id]
  700. timer_time[id] = 0.0
  701. kz_chat(id, %L, id, KZ_PAUSE_ON)
  702. }
  703. }
  704.  
  705. if(gViewInvisible[id])
  706. gViewInvisible[id] = false
  707.  
  708. cs_set_user_team(id,CS_TEAM_SPECTATOR)
  709. set_pev(id, pev_solid, SOLID_NOT)
  710. set_pev(id, pev_movetype, MOVETYPE_FLY)
  711. set_pev(id, pev_effects, EF_NODRAW)
  712. set_pev(id, pev_deadflag, DEAD_DEAD)
  713. }
  714. else
  715. {
  716. cs_set_user_team(id,CS_TEAM_CT)
  717. set_pev(id, pev_effects, 0)
  718. set_pev(id, pev_movetype, MOVETYPE_WALK)
  719. set_pev(id, pev_deadflag, DEAD_NO)
  720. set_pev(id, pev_takedamage, DAMAGE_AIM)
  721. CmdRespawn(id)
  722. give_item(id,weapon_knife)
  723. give_item(id,weapon_usp)
  724. cs_set_user_bpammo(id, CSW_USP, 36)
  725.  
  726. if (get_pcvar_num(kz_spec_saves) == 1)
  727. {
  728. set_pev(id, pev_origin, SpecLoc[id])
  729. if ( timer_started [id] )
  730. timer_time[id] = get_gametime() - g_pausetime[id] + timer_time[id]
  731. if( WasPaused[id] )
  732. {
  733. Pause(id)
  734. WasPaused[id]=false
  735. }
  736. }
  737. }
  738. return PLUGIN_HANDLED
  739. }
  740.  
  741.  
  742. =================== Weapons ==============
  743. public curweapon(id)
  744. {
  745.  
  746. if(get_pcvar_num(kz_maxspeedmsg) == 1 && is_user_alive(id))
  747. {
  748. new clip, ammo, speed,
  749. switch(get_user_weapon(id,clip,ammo))
  750. {
  751. case CSW_SCOUT speed = 260
  752. case CSW_C4, CSW_P228, CSW_MAC10, CSW_MP5NAVY, CSW_USP, CSW_TMP, CSW_FLASHBANG, CSW_DEAGLE, CSW_GLOCK18, CSW_SMOKEGRENADE, CSW_ELITE, CSW_FIVESEVEN, CSW_UMP45, CSW_HEGRENADE, CSW_KNIFE speed = 250
  753. case CSW_P90 speed = 245
  754. case CSW_XM1014, CSW_AUG, CSW_GALIL, CSW_FAMAS speed = 240
  755. case CSW_SG552 speed = 235
  756. case CSW_M3, CSW_M4A1 speed= 230
  757. case CSW_AK47 speed = 221
  758. case CSW_M249 speed = 220
  759. case CSW_G3SG1, CSW_SG550, CSW_AWP speed = 210
  760. }
  761. kz_hud_message(id,%L,id, KZ_WEAPONS_SPEED,speed)
  762. }
  763.  
  764. static last_weapon[33];
  765. static weapon_active, weapon_num
  766. weapon_active = read_data(1)
  767. weapon_num = read_data(2)
  768.  
  769. if( ( weapon_num != last_weapon[id] ) && weapon_active && get_pcvar_num(kz_maxspeedmsg) == 1)
  770. {
  771. last_weapon[id] = weapon_num;
  772.  
  773. static Floatmaxspeed;
  774. pev(id, pev_maxspeed, maxspeed );
  775.  
  776. if( maxspeed 0.0 )
  777. maxspeed = 250.0;
  778.  
  779. kz_hud_message(id,%L,id, KZ_WEAPONS_SPEED,floatround( maxspeed, floatround_floor ));
  780. }
  781. return PLUGIN_HANDLED
  782. }
  783.  
  784. public weapons(id)
  785. {
  786. if(!is_user_alive(id))
  787. {
  788. kz_chat(id, %L, id, KZ_NOT_ALIVE)
  789. return PLUGIN_HANDLED
  790. }
  791.  
  792. if(get_pcvar_num(kz_other_weapons) == 0)
  793. {
  794. kz_chat(id, %L, id, KZ_OTHER_WEAPONS_ZERO)
  795. return PLUGIN_HANDLED
  796. }
  797.  
  798. if (timer_started[id])
  799. {
  800. kz_chat(id, %L, id, KZ_WEAPONS_IN_RUN)
  801. return PLUGIN_HANDLED
  802. }
  803.  
  804. for(new i = 0; i 8; i++)
  805. if( !user_has_weapon(id, other_weapons[i]) )
  806. {
  807. new item;
  808. item = give_item(id, other_weapons_name[i] );
  809. cs_set_weapon_ammo(item, 0);
  810. }
  811.  
  812. if( !user_has_weapon(id, CSW_USP) )
  813. cmdUsp(id)
  814.  
  815. return PLUGIN_HANDLED
  816. }
  817.  
  818.  
  819. ========================= Scout =======================
  820. public cmdScout(id)
  821. {
  822. if (timer_started[id])
  823. user_has_scout[id] = true
  824.  
  825. strip_user_weapons(id)
  826. give_item(id,weapon_usp)
  827. give_item(id,weapon_knife)
  828. if( !user_has_weapon(id, CSW_SCOUT))
  829. give_item(id,weapon_scout)
  830.  
  831. return PLUGIN_HANDLED
  832. }
  833.  
  834. public cmdUsp(id)
  835. {
  836. give_item(id,weapon_usp)
  837. give_item(id,weapon_knife)
  838.  
  839. return PLUGIN_HANDLED
  840. }
  841.  
  842. ========================== Start location =================
  843.  
  844. public goStart(id)
  845. {
  846. if( !is_user_alive( id ) )
  847. {
  848. kz_chat(id, %L, id, KZ_NOT_ALIVE)
  849. return PLUGIN_HANDLED
  850. }
  851.  
  852. if (IsPaused[id])
  853. {
  854. kz_chat(id, %L, id, KZ_TELEPORT_PAUSE)
  855. return PLUGIN_HANDLED
  856. }
  857.  
  858. if(get_pcvar_num(kz_save_autostart) == 1 && AutoStart [id] )
  859. {
  860. set_pev(id, pev_velocity, Float{0.0, 0.0, 0.0})
  861. set_pev( id, pev_flags, pev(id, pev_flags) FL_DUCKING )
  862. set_pev(id, pev_origin, SavedStart [id] )
  863.  
  864. kz_chat(id, %L, id, KZ_START)
  865. }
  866. else if ( DefaultStart )
  867. {
  868. set_pev(id, pev_velocity, Float{0.0, 0.0, 0.0})
  869. set_pev(id, pev_origin, DefaultStartPos)
  870.  
  871. kz_chat(id, %L, id, KZ_START)
  872. }
  873. else
  874. {
  875. kz_chat(id, %L, id, KZ_NO_START)
  876.  
  877. CmdRespawn(id)
  878. }
  879.  
  880. return PLUGIN_HANDLED
  881. }
  882.  
  883. public setStart(id)
  884. {
  885. if (! (get_user_flags( id ) & KZ_LEVEL ))
  886. {
  887. kz_chat(id, %L, id, KZ_NO_ACCESS)
  888. return PLUGIN_HANDLED
  889. }
  890.  
  891. new Floatorigin[3]
  892. pev(id, pev_origin, origin)
  893. kz_set_start(MapName, origin)
  894. AutoStart[id] = false;
  895. ColorChat(id, GREEN, %s^x01 %L., prefix, id, KZ_SET_START)
  896.  
  897. return PLUGIN_HANDLED
  898. }
  899.  
  900. ========= Respawn CT if dies ========
  901.  
  902. public Ham_CBasePlayer_Killed_Post(id)
  903. {
  904. if(get_pcvar_num(kz_respawn_ct) == 1)
  905. {
  906. if( cs_get_user_team(id) == CS_TEAM_CT )
  907. {
  908. set_pev(id, pev_deadflag, DEAD_RESPAWNABLE)
  909. cs_set_user_deaths(id, 0)
  910. set_user_frags(id, 0)
  911. }
  912. }
  913. }
  914.  
  915.  
  916. ============================= NightVision ================================================
  917.  
  918. public ToggleNVG(id)
  919. {
  920.  
  921. if( get_pcvar_num(kz_nvg) == 0 !is_user_alive(id))
  922. return PLUGIN_CONTINUE;
  923.  
  924. if ( NightVisionUse[id] )
  925. StopNVG(id)
  926. else
  927. StartNVG(id)
  928.  
  929. return PLUGIN_HANDLED
  930. }
  931.  
  932. public StartNVG(id)
  933. {
  934. emit_sound(id,CHAN_ITEM,itemsnvg_on.wav,1.0,ATTN_NORM,0,PITCH_NORM)
  935. set_task(0.1,RunNVG,id+111111,_,_,b)
  936. NightVisionUse[id] = true;
  937.  
  938. return PLUGIN_HANDLED
  939. }
  940.  
  941. public StopNVG(id)
  942. {
  943. emit_sound(id,CHAN_ITEM,itemsnvg_off.wav,1.0,ATTN_NORM,0,PITCH_NORM)
  944. remove_task(id+111111)
  945. NightVisionUse[id] = false;
  946.  
  947. return PLUGIN_HANDLED
  948. }
  949.  
  950.  
  951. public RunNVG(taskid)
  952. {
  953. new id = taskid - 111111
  954.  
  955. if (!is_user_alive(id)) return
  956.  
  957. new origin[3]
  958. get_user_origin(id,origin,3)
  959.  
  960. new color[17];
  961. get_pcvar_string(kz_nvg_colors,color,16);
  962.  
  963. new iRed[5], iGreen[7], iBlue[5]
  964. parse(color,iRed,4,iGreen ,6,iBlue,4)
  965.  
  966. message_begin(MSG, SVC_TEMPENTITY, _, id)
  967. write_byte(TE_DLIGHT)
  968. write_coord(origin[0])
  969. write_coord(origin[1])
  970. write_coord(origin[2])
  971. write_byte(80)
  972. write_byte(str_to_num(iRed))
  973. write_byte(str_to_num(iGreen))
  974. write_byte(str_to_num(iBlue))
  975. write_byte(2)
  976. write_byte(0)
  977. message_end()
  978. }
  979.  
  980. ============================ Hook ==============================================================
  981.  
  982. public give_hook(id)
  983. {
  984. if (!( get_user_flags( id ) & KZ_LEVEL ))
  985. return PLUGIN_HANDLED
  986.  
  987. new szarg1[32], szarg2[8], boolmode
  988. read_argv(1,szarg1,32)
  989. read_argv(2,szarg2,32)
  990. if(equal(szarg2,on))
  991. mode = true
  992.  
  993. if(equal(szarg1,@ALL))
  994. {
  995. new Alive[32], alivePlayers
  996. get_players(Alive, alivePlayers, ach)
  997. for(new i;ialivePlayers;i++)
  998. {
  999. canusehook[i] = mode
  1000. if(mode)
  1001. ColorChat(i, GREEN, %s^x01, %L., prefix, i, KZ_HOOK)
  1002. }
  1003. }
  1004. else
  1005. {
  1006. new pid = find_player(bl,szarg1);
  1007. if(pid 0)
  1008. {
  1009. canusehook[pid] = mode
  1010. if(mode)
  1011. {
  1012. ColorChat(pid, GREEN, %s^x01 %L., prefix, pid, KZ_HOOK)
  1013. }
  1014. }
  1015. }
  1016.  
  1017. return PLUGIN_HANDLED
  1018. }
  1019.  
  1020. public hook_on(id)
  1021. {
  1022. if( !canusehook[id] && !( get_user_flags( id ) & KZ_LEVEL ) !is_user_alive(id) )
  1023. return PLUGIN_HANDLED
  1024.  
  1025. if (IsPaused[id])
  1026. {
  1027. kz_chat(id, %L, id, KZ_HOOK_PAUSE)
  1028. return PLUGIN_HANDLED
  1029. }
  1030.  
  1031. detect_cheat(id,Hook)
  1032. get_user_origin(id,hookorigin[id],3)
  1033. ishooked[id] = true
  1034. antihookcheat[id] = get_gametime()
  1035.  
  1036. if (get_pcvar_num(kz_hook_sound) == 1)
  1037. emit_sound(id,CHAN_STATIC,weaponsxbow_hit2.wav,1.0,ATTN_NORM,0,PITCH_NORM)
  1038.  
  1039. set_task(0.1,hook_task,id,,0,ab)
  1040. hook_task(id)
  1041.  
  1042. return PLUGIN_HANDLED
  1043. }
  1044.  
  1045. public hook_off(id)
  1046. {
  1047. remove_hook(id)
  1048.  
  1049. return PLUGIN_HANDLED
  1050. }
  1051.  
  1052. public hook_task(id)
  1053. {
  1054. if(!is_user_connected(id) !is_user_alive(id))
  1055. remove_hook(id)
  1056.  
  1057. remove_beam(id)
  1058. draw_hook(id)
  1059.  
  1060. new origin[3], Floatvelocity[3]
  1061. get_user_origin(id,origin)
  1062. new distance = get_distance(hookorigin[id],origin)
  1063. velocity[0] = (hookorigin[id][0] - origin[0]) (2.0 get_pcvar_num(kz_hook_speed) distance)
  1064. velocity[1] = (hookorigin[id][1] - origin[1]) (2.0 get_pcvar_num(kz_hook_speed) distance)
  1065. velocity[2] = (hookorigin[id][2] - origin[2]) (2.0 get_pcvar_num(kz_hook_speed) distance)
  1066.  
  1067. set_pev(id,pev_velocity,velocity)
  1068. }
  1069.  
  1070. public draw_hook(id)
  1071. {
  1072. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  1073. write_byte(1) TE_BEAMENTPOINT
  1074. write_short(id) entid
  1075. write_coord(hookorigin[id][0]) origin
  1076. write_coord(hookorigin[id][1]) origin
  1077. write_coord(hookorigin[id][2]) origin
  1078. write_short(Sbeam) sprite index
  1079. write_byte(0) start frame
  1080. write_byte(0) framerate
  1081. write_byte(random_num(1,100)) life
  1082. write_byte(random_num(1,20)) width
  1083. write_byte(random_num(1,0)) noise
  1084. write_byte(random_num(1,255)) r
  1085. write_byte(random_num(1,255)) g
  1086. write_byte(random_num(1,255)) b
  1087. write_byte(random_num(1,500)) brightness
  1088. write_byte(random_num(1,200)) speed
  1089. message_end()
  1090. }
  1091.  
  1092. public remove_hook(id)
  1093. {
  1094. if(task_exists(id))
  1095. remove_task(id)
  1096. remove_beam(id)
  1097. ishooked[id] = false
  1098. }
  1099.  
  1100. public remove_beam(id)
  1101. {
  1102. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  1103. write_byte(99) TE_KILLBEAM
  1104. write_short(id)
  1105. message_end()
  1106. }
  1107.  
  1108.  
  1109. ============================ VIP In ScoreBoard =================================================
  1110.  
  1111. public MessageScoreAttrib( iMsgID, iDest, iReceiver )
  1112. {
  1113. if( get_pcvar_num(kz_vip) )
  1114. {
  1115. new iPlayer = get_msg_arg_int( 1 )
  1116. if( is_user_alive( iPlayer ) && ( get_user_flags( iPlayer ) & KZ_LEVEL ) )
  1117. {
  1118. set_msg_arg_int( 2, ARG_BYTE, SCOREATTRIB_VIP );
  1119. }
  1120. }
  1121. }
  1122.  
  1123. public EventStatusValue( const id )
  1124. {
  1125.  
  1126. new szMessage[ 34 ], Target, aux
  1127. get_user_aiming(id, Target, aux)
  1128. if (is_user_alive(Target))
  1129. {
  1130. formatex( szMessage, 33, 1 %s %%p2, get_user_flags( Target ) & KZ_LEVEL VIP Player )
  1131. message_begin( MSG, get_user_msgid( StatusText ) , _, id )
  1132. write_byte( 0 )
  1133. write_string( szMessage )
  1134. message_end( )
  1135. }
  1136. }
  1137.  
  1138. public detect_cheat(id,reason[])
  1139. {
  1140. if(timer_started[id] && get_pcvar_num(kz_cheatdetect) == 1)
  1141. {
  1142. timer_started[id] = false
  1143. if(IsPaused[id])
  1144. {
  1145. set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
  1146. IsPaused[id] = false
  1147. }
  1148. if (get_pcvar_num(kz_show_timer) 0 && ShowTime[id] == 2)
  1149. kz_showtime_roundtime(id, 0)
  1150. ColorChat(id, GREEN, %s^x01 %L, prefix, id, KZ_CHEAT_DETECT, reason)
  1151. }
  1152. }
  1153.  
  1154. =================================================================================================
  1155. Cmds
  1156. =================================================================================================
  1157.  
  1158. public CheckPoint(id)
  1159. {
  1160.  
  1161. if( !is_user_alive( id ) )
  1162. {
  1163. kz_chat(id, %L, id, KZ_NOT_ALIVE)
  1164. return PLUGIN_HANDLED
  1165. }
  1166.  
  1167. if(get_pcvar_num(kz_checkpoints) == 0)
  1168. {
  1169. kz_chat(id, %L, id, KZ_CHECKPOINT_OFF)
  1170. return PLUGIN_HANDLED
  1171. }
  1172.  
  1173. if( !( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id))
  1174. {
  1175. kz_chat(id, %L, id, KZ_CHECKPOINT_AIR)
  1176. return PLUGIN_HANDLED
  1177. }
  1178.  
  1179. if( IsPaused[id] )
  1180. {
  1181. kz_chat(id, %L, id, KZ_CHECKPOINT_PAUSE)
  1182. return PLUGIN_HANDLED
  1183. }
  1184.  
  1185. pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id] 1 0])
  1186. g_bCpAlternate[id] = !g_bCpAlternate[id]
  1187. checknumbers[id]++
  1188.  
  1189. kz_chat(id, %L, id, KZ_CHECKPOINT, checknumbers[id])
  1190.  
  1191. return PLUGIN_HANDLED
  1192. }
  1193.  
  1194. public GoCheck(id)
  1195. {
  1196. if( !is_user_alive( id ) )
  1197. {
  1198. kz_chat(id, %L, id, KZ_NOT_ALIVE)
  1199. return PLUGIN_HANDLED
  1200. }
  1201.  
  1202. if( checknumbers[id] == 0 )
  1203. {
  1204. kz_chat(id, %L, id, KZ_NOT_ENOUGH_CHECKPOINTS)
  1205. return PLUGIN_HANDLED
  1206. }
  1207.  
  1208. if( IsPaused[id] )
  1209. {
  1210. kz_chat(id, %L, id, KZ_TELEPORT_PAUSE)
  1211. return PLUGIN_HANDLED
  1212. }
  1213.  
  1214. set_pev( id, pev_velocity, Float{0.0, 0.0, 0.0} );
  1215. set_pev( id, pev_view_ofs, Float{ 0.0, 0.0, 12.0 } );
  1216. set_pev( id, pev_flags, pev(id, pev_flags) FL_DUCKING );
  1217. set_pev( id, pev_fuser2, 0.0 );
  1218. engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } );
  1219. set_pev(id, pev_origin, Checkpoints[ id ][ !g_bCpAlternate[id] ] )
  1220. gochecknumbers[id]++
  1221.  
  1222. kz_chat(id, %L, id, KZ_GOCHECK, gochecknumbers[id])
  1223.  
  1224. return PLUGIN_HANDLED
  1225. }
  1226.  
  1227. public Stuck(id)
  1228. {
  1229. if( !is_user_alive( id ) )
  1230. {
  1231. kz_chat(id, %L, id, KZ_NOT_ALIVE)
  1232. return PLUGIN_HANDLED
  1233. }
  1234.  
  1235. if( checknumbers[id] 2 )
  1236. {
  1237. kz_chat(id, %L, id, KZ_NOT_ENOUGH_CHECKPOINTS)
  1238. return PLUGIN_HANDLED
  1239. }
  1240.  
  1241. set_pev( id, pev_velocity, Float{0.0, 0.0, 0.0} )
  1242. set_pev( id, pev_view_ofs, Float{ 0.0, 0.0, 12.0 })
  1243. set_pev( id, pev_flags, pev(id, pev_flags) FL_DUCKING )
  1244. set_pev( id, pev_fuser2, 0.0 )
  1245. engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } )
  1246. set_pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id]] )
  1247. g_bCpAlternate[id] = !g_bCpAlternate[id];
  1248. gochecknumbers[id]++
  1249.  
  1250. kz_chat(id, %L, id, KZ_GOCHECK, gochecknumbers[id])
  1251.  
  1252. return PLUGIN_HANDLED;
  1253. }
  1254.  
  1255. =================================================================================================
  1256.  
  1257. public reset_checkpoints(id)
  1258. {
  1259. checknumbers[id] = 0
  1260. gochecknumbers[id] = 0
  1261. timer_started[id] = false
  1262. timer_time[id] = 0.0
  1263. user_has_scout[id] = false
  1264. if(IsPaused[id])
  1265. {
  1266. set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
  1267. IsPaused[id] = false
  1268. }
  1269. if (get_pcvar_num(kz_show_timer) 0 && ShowTime[id] == 2)
  1270. kz_showtime_roundtime(id, 0)
  1271.  
  1272. return PLUGIN_HANDLED
  1273. }
  1274.  
  1275. ===== Invis =======
  1276.  
  1277. public cmdInvisible(id)
  1278. {
  1279.  
  1280. gViewInvisible[id] = !gViewInvisible[id]
  1281. if(gViewInvisible[id])
  1282. kz_chat(id, %L, id, KZ_INVISIBLE_PLAYERS_ON)
  1283. else
  1284. kz_chat(id, %L, id, KZ_INVISIBLE_PLAYERS_OFF)
  1285.  
  1286. return PLUGIN_HANDLED
  1287. }
  1288.  
  1289. public cmdWaterInvisible(id)
  1290. {
  1291. if( !gWaterFound )
  1292. {
  1293. kz_chat(id, %L, id, KZ_INVISIBLE_NOWATER)
  1294. return PLUGIN_HANDLED
  1295. }
  1296.  
  1297. gWaterInvisible[id] = !gWaterInvisible[id]
  1298. if(gWaterInvisible[id])
  1299. kz_chat(id, %L, id, KZ_INVISIBLE_WATER_ON)
  1300. else
  1301. kz_chat(id, %L, id, KZ_INVISIBLE_WATER_OFF)
  1302.  
  1303. return PLUGIN_HANDLED
  1304. }
  1305.  
  1306. ======================Semiclip Invis==========================
  1307.  
  1308. public FM_client_AddToFullPack_Post(es, e, ent, host, hostflags, player, pSet)
  1309. {
  1310. if( player )
  1311. {
  1312. if (get_pcvar_num(kz_semiclip) == 1)
  1313. {
  1314. if ( host != ent && get_orig_retval() && is_user_alive(host) )
  1315. {
  1316. set_es(es, ES_Solid, SOLID_NOT)
  1317. set_es(es, ES_RenderMode, kRenderTransAlpha)
  1318. set_es(es, ES_RenderAmt, get_pcvar_num(kz_semiclip_transparency))
  1319. }
  1320. }
  1321. if(gMarkedInvisible[ent] && gViewInvisible[host])
  1322. {
  1323. set_es(es, ES_RenderMode, kRenderTransTexture)
  1324. set_es(es, ES_RenderAmt, 0)
  1325. set_es(es, ES_Origin, { 999999999.0, 999999999.0, 999999999.0 } )
  1326. }
  1327. }
  1328. else if( gWaterInvisible[host] && gWaterEntity[ent] )
  1329. {
  1330. set_es(es, ES_Effects, get_es( es, ES_Effects ) EF_NODRAW )
  1331. }
  1332.  
  1333. return FMRES_IGNORED
  1334. }
  1335.  
  1336. public Ham_CBasePlayer_PreThink_Post(id)
  1337. {
  1338. if( !is_user_alive(id) )
  1339. {
  1340. return
  1341. }
  1342.  
  1343. RefreshPlayersList()
  1344.  
  1345. if (get_pcvar_num(kz_semiclip) == 1)
  1346. {
  1347. for(new i = 0; ig_iNum; i++)
  1348. {
  1349. g_iPlayer = g_iPlayers[i]
  1350. if( id != g_iPlayer )
  1351. {
  1352. set_pev(g_iPlayer, pev_solid, SOLID_NOT)
  1353. }
  1354. }
  1355. }
  1356. }
  1357.  
  1358. public client_PostThink(id)
  1359. {
  1360. if( !is_user_alive(id) )
  1361. return
  1362.  
  1363. RefreshPlayersList()
  1364.  
  1365. if (get_pcvar_num(kz_semiclip) == 1)
  1366. for(new i = 0; ig_iNum; i++)
  1367. {
  1368. g_iPlayer = g_iPlayers[i]
  1369. if( g_iPlayer != id )
  1370. set_pev(g_iPlayer, pev_solid, SOLID_SLIDEBOX)
  1371. }
  1372. }
  1373.  
  1374. public noclip(id)
  1375. {
  1376. if(!is_user_alive(id))
  1377. {
  1378. kz_chat(id, %L, id, KZ_NOT_ALIVE)
  1379. return PLUGIN_HANDLED
  1380. }
  1381. new noclip = !get_user_noclip(id)
  1382. set_user_noclip(id, noclip)
  1383. if(IsPaused[id] && (get_pcvar_num(kz_noclip_pause) == 1))
  1384. {
  1385. if(noclip)
  1386. {
  1387. pev(id, pev_origin, NoclipPos[id])
  1388. set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
  1389. }
  1390. else
  1391. {
  1392. set_pev(id, pev_origin, NoclipPos[id])
  1393. set_pev(id, pev_flags, pev(id, pev_flags) FL_FROZEN)
  1394. }
  1395. }
  1396. else if(noclip)
  1397. detect_cheat(id,Noclip)
  1398. kz_chat(id, %L, id, KZ_NOCLIP , noclip ON OFF)
  1399.  
  1400. return PLUGIN_HANDLED
  1401. }
  1402.  
  1403. public GodMode(id)
  1404. {
  1405. if(!is_user_alive(id))
  1406. {
  1407. kz_chat(id, %L, id, KZ_NOT_ALIVE)
  1408. return PLUGIN_HANDLED
  1409. }
  1410.  
  1411. new godmode = !get_user_godmode(id)
  1412. set_user_godmode(id, godmode)
  1413. if(godmode)
  1414. detect_cheat(id,God Mode)
  1415. kz_chat(id, %L, id, KZ_GODMODE , godmode ON OFF)
  1416.  
  1417. return PLUGIN_HANDLED
  1418. }
  1419.  
  1420. =================================================================================================
  1421.  
  1422. stock kz_set_start(const map[], Floatorigin[3])
  1423. {
  1424. new realfile[128], tempfile[128], formatorigin[50]
  1425. formatex(realfile, 127, %s%s, Kzdir, KZ_STARTFILE)
  1426. formatex(tempfile, 127, %s%s, Kzdir, KZ_STARTFILE_TEMP)
  1427. formatex(formatorigin, 49, %f %f %f, origin[0], origin[1], origin[2])
  1428.  
  1429. DefaultStartPos = origin
  1430. DefaultStart = true
  1431.  
  1432. new file = fopen(tempfile, wt)
  1433. new vault = fopen(realfile, rt)
  1434.  
  1435. new data[128], key[64]
  1436. new boolreplaced = false
  1437.  
  1438. while( !feof(vault) )
  1439. {
  1440. fgets(vault, data, 127)
  1441. parse(data, key, 63)
  1442.  
  1443. if( equal(key, map) && !replaced )
  1444. {
  1445. fprintf(file, %s %s^n, map, formatorigin)
  1446.  
  1447. replaced = true
  1448. }
  1449. else
  1450. {
  1451. fputs(file, data)
  1452. }
  1453. }
  1454.  
  1455. if( !replaced )
  1456. {
  1457. fprintf(file, %s %s^n, map, formatorigin)
  1458. }
  1459.  
  1460. fclose(file)
  1461. fclose(vault)
  1462.  
  1463. delete_file(realfile)
  1464. while( !rename_file(tempfile, realfile, 1) ) {}
  1465. }
  1466.  
  1467. stock kz_showtime_roundtime(id, time)
  1468. {
  1469. if( is_user_connected(id) )
  1470. {
  1471. message_begin(MSG, get_user_msgid( RoundTime ), _, id);
  1472. write_short(time + 1);
  1473. message_end();
  1474. }
  1475. }
  1476.  
  1477. stock kz_chat(id, const message[], {Float,Sql,Result,_}...)
  1478. {
  1479. new cvar = get_pcvar_num(kz_chatorhud)
  1480. if(cvar == 0)
  1481. return PLUGIN_HANDLED
  1482.  
  1483. new msg[180], final[192]
  1484. if (cvar == 1 && chatorhud[id] == -1 chatorhud[id] == 1)
  1485. {
  1486. vformat(msg, 179, message, 3)
  1487. formatex(final, 191, %s^x01 %s, prefix, msg)
  1488. kz_remplace_colors(final, 191)
  1489. ColorChat(id, GREEN, %s, final)
  1490. }
  1491. else if( cvar == 2 && chatorhud[id] == -1 chatorhud[id] == 2)
  1492. {
  1493. vformat(msg, 179, message, 3)
  1494. replace_all(msg, 191, ^x01, )
  1495. replace_all(msg, 191, ^x03, )
  1496. replace_all(msg, 191, ^x04, )
  1497. replace_all(msg, 191, ., )
  1498. kz_hud_message(id, %s, msg)
  1499. }
  1500.  
  1501. return 1
  1502. }
  1503.  
  1504. stock kz_print_config(id, const msg[])
  1505. {
  1506. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid(SayText), _, id);
  1507. write_byte(id);
  1508. write_string(msg);
  1509. message_end();
  1510. }
  1511.  
  1512. stock kz_remplace_colors(message[], len)
  1513. {
  1514. replace_all(message, len, !g, ^x04)
  1515. replace_all(message, len, !t, ^x03)
  1516. replace_all(message, len, !y, ^x01)
  1517. }
  1518.  
  1519. stock kz_hud_message(id, const message[], {Float,Sql,Result,_}...)
  1520. {
  1521. static msg[192], colors[12], r[4], g[4], b[4];
  1522. vformat(msg, 191, message, 3);
  1523.  
  1524. get_pcvar_string(kz_hud_color, colors, 11)
  1525. parse(colors, r, 3, g, 3, b, 4)
  1526.  
  1527. set_hudmessage(str_to_num(r), str_to_num(g), str_to_num(b), -1.0, 0.90, 0, 0.0, 2.0, 0.0, 1.0, -1);
  1528. ShowSyncHudMsg(id, hud_message, msg);
  1529. }
  1530.  
  1531. stock kz_register_saycmd(const saycommand[], const function[], flags)
  1532. {
  1533. new temp[64]
  1534. formatex(temp, 63, say %s, saycommand)
  1535. register_clcmd(temp, function, flags)
  1536. formatex(temp, 63, say .%s, saycommand)
  1537. register_clcmd(temp, function, flags)
  1538. formatex(temp, 63, say_team %s, saycommand)
  1539. register_clcmd(temp, function, flags)
  1540. formatex(temp, 63, say_team .%s, saycommand)
  1541. register_clcmd(temp, function, flags)
  1542. }
  1543.  
  1544. stock get_configsdir(name[],len)
  1545. {
  1546. return get_localinfo(amxx_configsdir,name,len);
  1547. }
  1548.  
  1549. #if defined USE_SQL
  1550. stock GetNewRank(id, type)
  1551. {
  1552. new createinto[1001]
  1553.  
  1554. new cData[2]
  1555. cData[0] = id
  1556. cData[1] = type
  1557.  
  1558. formatex(createinto, 1000, SELECT authid FROM `%s` WHERE mapname='%s' ORDER BY time LIMIT 15, type == PRO_TOP kz_pro15 kz_nub15, MapName)
  1559. SQL_ThreadQuery(g_SqlTuple, GetNewRank_QueryHandler, createinto, cData, 2)
  1560. }
  1561.  
  1562. stock kz_update_plrname(id)
  1563. {
  1564. new createinto[1001], authid[32], name[32]
  1565. get_user_authid(id, authid, 31)
  1566. get_user_name(id, name, 31)
  1567.  
  1568. replace_all(name, 31, , )
  1569. replace_all(name, 31, `, )
  1570. replace_all(name, 31, ', )
  1571.  
  1572. if(equal(authid, VALVE_ID_LAN) equal(authid, STEAM_ID_LAN) strlen(authid) 18)
  1573. return 0;
  1574. else
  1575. {
  1576. formatex(createinto, 1000, UPDATE `kz_pro15` SET name='%s' WHERE authid='%s', name, authid)
  1577. SQL_ThreadQuery(g_SqlTuple, QueryHandle, createinto)
  1578. formatex(createinto, 1000, UPDATE `kz_nub15` SET name='%s' WHERE authid='%s', name, authid)
  1579. SQL_ThreadQuery(g_SqlTuple, QueryHandle, createinto)
  1580. }
  1581. return 1
  1582. }
  1583. #endif
  1584.  
  1585. public FwdSpawnWeaponbox( iEntity )
  1586. {
  1587. if(get_pcvar_num(kz_remove_drops) == 1)
  1588. {
  1589. set_pev( iEntity, pev_flags, FL_KILLME )
  1590. dllfunc( DLLFunc_Think, iEntity )
  1591. }
  1592.  
  1593. return HAM_IGNORED
  1594. }
  1595.  
  1596. public FwdHamDoorSpawn( iEntity )
  1597. {
  1598. static const szNull[ ] = commonnull.wav;
  1599.  
  1600. new FloatflDamage;
  1601. pev( iEntity, pev_dmg, flDamage );
  1602.  
  1603. if( flDamage -999.0 ) {
  1604. set_pev( iEntity, pev_noise1, szNull );
  1605. set_pev( iEntity, pev_noise2, szNull );
  1606. set_pev( iEntity, pev_noise3, szNull );
  1607.  
  1608. if( !HealsOnMap )
  1609. HealsOnMap = true
  1610. }
  1611. }
  1612.  
  1613. public FwdHamPlayerSpawn( id )
  1614. {
  1615.  
  1616. if( !is_user_alive( id ) )
  1617. return;
  1618.  
  1619. if(firstspawn[id])
  1620. {
  1621. ColorChat(id, GREEN, %s^x01 Welcome to ^x03nucLeaR's Server ^x01, prefix)
  1622. ColorChat(id, GREEN, %s^x01 Visit ^x03www.google.com ^x01, prefix)
  1623.  
  1624. if(get_pcvar_num(kz_checkpoints) == 0)
  1625. ColorChat(id, GREEN, %s^x01 %L, id, KZ_CHECKPOINT_OFF, prefix)
  1626.  
  1627.  
  1628. if(Verif(id,1) && get_pcvar_num(kz_save_pos) == 1)
  1629. savepos_menu(id)
  1630. else if(get_pcvar_num(kz_spawn_mainmenu) == 1)
  1631. kz_menu (id)
  1632. }
  1633. firstspawn[id] = false
  1634.  
  1635.  
  1636. if( !user_has_weapon(id,CSW_KNIFE) )
  1637. give_item( id,weapon_knife )
  1638.  
  1639. if( HealsOnMap )
  1640. set_user_health(id, 50175)
  1641.  
  1642. if( IsPaused[id] )
  1643. {
  1644. set_pev(id, pev_flags, pev(id, pev_flags) FL_FROZEN)
  1645. set_pev(id, pev_origin, PauseOrigin[id])
  1646. }
  1647.  
  1648. if(get_pcvar_num(kz_use_radio) == 0)
  1649. {
  1650. #define XO_PLAYER 5
  1651. #define m_iRadiosLeft 192
  1652. set_pdata_int(id, m_iRadiosLeft, 0, XO_PLAYER)
  1653. }
  1654. }
  1655.  
  1656. public GroundWeapon_Touch(iWeapon, id)
  1657. {
  1658. if( is_user_alive(id) && timer_started[id] && get_pcvar_num(kz_pick_weapons) == 0 )
  1659. return HAM_SUPERCEDE
  1660.  
  1661. return HAM_IGNORED
  1662. }
  1663.  
  1664.  
  1665.  
  1666. ==================================Save positions=================================================
  1667.  
  1668. public SavePos(id)
  1669. {
  1670.  
  1671. new authid[33];
  1672. get_user_authid(id, authid, 32)
  1673. if(get_pcvar_num(kz_save_pos) == 0)
  1674. {
  1675. kz_chat(id, %L, id, KZ_SAVEPOS_DISABLED)
  1676. return PLUGIN_HANDLED
  1677. }
  1678.  
  1679. if(equal(authid, VALVE_ID_LAN) equal(authid, STEAM_ID_LAN) strlen(authid) 18)
  1680. {
  1681. ColorChat (id, GREEN, %s^x01 %L, prefix, id, KZ_NO_STEAM)
  1682.  
  1683. return PLUGIN_HANDLED
  1684. }
  1685.  
  1686. if( !( pev( id, pev_flags ) & FL_ONGROUND2 ) )
  1687. {
  1688. kz_chat(id, %L, id, KZ_NOT_ON_GROUND)
  1689.  
  1690. return PLUGIN_HANDLED
  1691. }
  1692.  
  1693. if(!timer_started[id])
  1694. {
  1695. kz_chat(id, %L, id, KZ_TIMER_NOT_STARTED)
  1696. return PLUGIN_HANDLED
  1697. }
  1698.  
  1699. if(Verif(id,1))
  1700. {
  1701. ColorChat(id, GREEN, %s^x01 %L, prefix, id, KZ_SAVEPOS_ALREADY)
  1702. savepos_menu(id)
  1703. return PLUGIN_HANDLED
  1704. }
  1705.  
  1706. if(get_user_noclip(id))
  1707. {
  1708. ColorChat(id, GREEN, %s^x01 %L, prefix, id, KZ_SAVEPOS_NOCLIP)
  1709. return PLUGIN_HANDLED
  1710. }
  1711.  
  1712. new Floatorigin[3], scout
  1713. pev(id, pev_origin, origin)
  1714. new FloatTime,check,gocheck
  1715. if(IsPaused[id])
  1716. {
  1717. Time = g_pausetime[id]
  1718. Pause(id)
  1719. }
  1720. else
  1721. Time=get_gametime() - timer_time[id]
  1722. check=checknumbers[id]
  1723. gocheck=gochecknumbers[id]
  1724. ColorChat(id, GREEN, %s^x01 %L, prefix, id, KZ_SAVEPOS)
  1725. if (user_has_scout[id])
  1726. scout=1
  1727. else
  1728. scout=0
  1729. kz_savepos(id, Time, check, gocheck, origin, scout)
  1730. reset_checkpoints(id)
  1731.  
  1732. return PLUGIN_HANDLED
  1733. }
  1734.  
  1735. public GoPos(id)
  1736. {
  1737. remove_hook(id)
  1738. set_user_godmode(id, 0)
  1739. set_user_noclip(id, 0)
  1740. if(Verif(id,0))
  1741. {
  1742. set_pev(id, pev_velocity, Float{0.0, 0.0, 0.0})
  1743. set_pev(id, pev_flags, pev(id, pev_flags) FL_DUCKING )
  1744. set_pev(id, pev_origin, SavedOrigins[id] )
  1745. }
  1746.  
  1747. checknumbers[id]=SavedChecks[id]
  1748. if( SavedGoChecks[ id ] 0 )
  1749. gochecknumbers[id]=SavedGoChecks[id]+((get_pcvar_num(kz_save_pos_gochecks)0) 1 0)
  1750. else
  1751. gochecknumbers[id] = 0
  1752.  
  1753. CheckPoint(id)
  1754. CheckPoint(id)
  1755. strip_user_weapons(id)
  1756. give_item(id,weapon_usp)
  1757. give_item(id,weapon_knife)
  1758. if(SavedScout[id])
  1759. {
  1760. give_item(id, weapon_scout)
  1761. user_has_scout[id] = true
  1762. }
  1763. timer_time[id]=get_gametime()-SavedTime[id]
  1764. timer_started[id]=true
  1765. Pause(id)
  1766.  
  1767. }
  1768.  
  1769. public Verif(id, action)
  1770. {
  1771. new realfile[128], tempfile[128], authid[32], map[64]
  1772. new boolexist = false
  1773. get_mapname(map, 63)
  1774. get_user_authid(id, authid, 31)
  1775. formatex(realfile, 127, %s%s.ini, SavePosDir, map)
  1776. formatex(tempfile, 127, %stemp.ini, SavePosDir)
  1777.  
  1778. if( !file_exists(realfile) )
  1779. return 0
  1780.  
  1781. new file = fopen(tempfile, wt)
  1782. new vault = fopen(realfile, rt)
  1783. new data[150], sid[32], time[25], checks[5], gochecks[5], x[25], y[25], z[25], scout[5]
  1784. while( !feof(vault) )
  1785. {
  1786. fgets(vault, data, 149)
  1787. parse(data, sid, 31, time, 24, checks, 4, gochecks, 4, x, 24, y, 24, z, 24, scout, 4)
  1788.  
  1789. if( equal(sid, authid) && !exist) ma aflu in fisier
  1790. {
  1791. if(action == 1)
  1792. fputs(file, data)
  1793. exist= true
  1794. SavedChecks[id] = str_to_num(checks)
  1795. SavedGoChecks[id] = str_to_num(gochecks)
  1796. SavedTime[id] = str_to_float(time)
  1797. SavedOrigins[id][0]=str_to_num(x)
  1798. SavedOrigins[id][1]=str_to_num(y)
  1799. SavedOrigins[id][2]=str_to_num(z)
  1800. SavedScout[id] = str_to_num(scout)
  1801. }
  1802. else
  1803. {
  1804. fputs(file, data)
  1805. }
  1806. }
  1807.  
  1808. fclose(file)
  1809. fclose(vault)
  1810.  
  1811. delete_file(realfile)
  1812. if(file_size(tempfile) == 0)
  1813. delete_file(tempfile)
  1814. else
  1815. while( !rename_file(tempfile, realfile, 1) ) {}
  1816.  
  1817.  
  1818. if(!exist)
  1819. return 0
  1820.  
  1821. return 1
  1822. }
  1823. public kz_savepos (id, Floattime, checkpoints, gochecks, Floatorigin[3], scout)
  1824. {
  1825. new realfile[128], formatorigin[128], map[64], authid[32]
  1826. get_mapname(map, 63)
  1827. get_user_authid(id, authid, 31)
  1828. formatex(realfile, 127, %s%s.ini, SavePosDir, map)
  1829. formatex(formatorigin, 127, %s %f %d %d %d %d %d %d, authid, time, checkpoints, gochecks, origin[0], origin[1], origin[2], scout)
  1830.  
  1831. new vault = fopen(realfile, rt+)
  1832. write_file(realfile, formatorigin) La sfarsit adaug datele mele
  1833.  
  1834. fclose(vault)
  1835.  
  1836. }
  1837.  
  1838. =================================================================================================
  1839. Events Forwards
  1840. =================================================================================================
  1841.  
  1842. =================================================================================================
  1843.  
  1844. public client_disconnect(id)
  1845. {
  1846. checknumbers[id] = 0
  1847. gochecknumbers[id] = 0
  1848. antihookcheat[id] = 0.0
  1849. chatorhud[id] = -1
  1850. timer_started[id] = false
  1851. ShowTime[id] = get_pcvar_num(kz_show_timer)
  1852. firstspawn[id] = true
  1853. NightVisionUse[id] = false
  1854. IsPaused[id] = false
  1855. WasPaused[id] = false
  1856. user_has_scout[id] = false
  1857. remove_hook(id)
  1858. }
  1859.  
  1860. public client_putinserver(id)
  1861. {
  1862. checknumbers[id] = 0
  1863. gochecknumbers[id] = 0
  1864. antihookcheat[id] = 0.0
  1865. chatorhud[id] = -1
  1866. timer_started[id] = false
  1867. ShowTime[id] = get_pcvar_num(kz_show_timer)
  1868. firstspawn[id] = true
  1869. NightVisionUse[id] = false
  1870. IsPaused[id] = false
  1871. WasPaused[id] = false
  1872. user_has_scout[id] = false
  1873. remove_hook(id)
  1874. }
  1875.  
  1876. =================================================================================================
  1877. Menu
  1878. =================================================================================================
  1879.  
  1880.  
  1881. public kz_menu(id)
  1882. {
  1883. new title[64];
  1884. formatex(title, 63, yProKreedz %s Menuw, VERSION)
  1885. new menu = menu_create(title, MenuHandler)
  1886.  
  1887. new msgcheck[64], msggocheck[64], msgpause[64]
  1888. formatex(msgcheck, 63, Checkpoint - y#%i, checknumbers[id])
  1889. formatex(msggocheck, 63, Gocheck - y#%i, gochecknumbers[id])
  1890. formatex(msgpause, 63, Pause - %s^n, IsPaused[id] yON rOFF )
  1891.  
  1892. menu_additem( menu, msgcheck, 1 )
  1893. menu_additem( menu, msggocheck, 2 )
  1894. menu_additem( menu, Top 15^n, 3)
  1895. menu_additem( menu, Start, 4)
  1896. menu_additem( menu, Timer Menu, 5 )
  1897. menu_additem( menu, msgpause, 6 )
  1898. menu_additem( menu, Invisible Menu, 7 )
  1899. menu_additem( menu, SpectatorCT, 8 )
  1900. menu_additem( menu, Reset Time^n, 9)
  1901. menu_additem( menu, Exit, MENU_EXIT )
  1902.  
  1903. menu_setprop(menu, MPROP_PERPAGE, 0)
  1904. menu_display(id, menu, 0)
  1905. return PLUGIN_HANDLED
  1906. }
  1907.  
  1908. public MenuHandler(id , menu, item)
  1909. {
  1910. if( item == MENU_EXIT ) {
  1911. menu_destroy(menu)
  1912. return PLUGIN_HANDLED
  1913. }
  1914.  
  1915.  
  1916. switch(item) {
  1917. case 0{
  1918. CheckPoint(id)
  1919. kz_menu(id)
  1920. }
  1921. case 1{
  1922. GoCheck(id)
  1923. kz_menu(id)
  1924. }
  1925. case 2{
  1926. top15menu(id)
  1927. }
  1928. case 3{
  1929. goStart(id)
  1930. kz_menu(id)
  1931. }
  1932. case 4{
  1933. ShowTimer_Menu(id)
  1934. }
  1935. case 5{
  1936. Pause(id)
  1937. kz_menu(id)
  1938. }
  1939. case 6{
  1940. InvisMenu(id)
  1941. }
  1942. case 7{
  1943. ct(id)
  1944. }
  1945. case 8{
  1946. reset_checkpoints(id)
  1947. kz_menu(id)
  1948. }
  1949. }
  1950.  
  1951. return PLUGIN_HANDLED
  1952. }
  1953.  
  1954. public InvisMenu(id)
  1955. {
  1956. new menu = menu_create(yInvis Menuw, InvisMenuHandler)
  1957. new msginvis[64], msgwaterinvis[64]
  1958.  
  1959. formatex(msginvis, 63, Players - %s, gViewInvisible[id] yON rOFF )
  1960. formatex(msgwaterinvis, 63, Water - %s^n^n, gWaterInvisible[id] yON rOFF )
  1961.  
  1962. menu_additem( menu, msginvis, 1 )
  1963. menu_additem( menu, msgwaterinvis, 2 )
  1964. menu_additem( menu, Main Menu, 3 )
  1965.  
  1966. menu_display(id, menu, 0)
  1967. return PLUGIN_HANDLED
  1968. }
  1969.  
  1970. public InvisMenuHandler (id, menu, item)
  1971. {
  1972. if( item == MENU_EXIT )
  1973. {
  1974. menu_destroy(menu)
  1975. return PLUGIN_HANDLED
  1976. }
  1977.  
  1978. switch(item)
  1979. {
  1980. case 0
  1981. {
  1982. cmdInvisible(id)
  1983. InvisMenu(id)
  1984. }
  1985. case 1
  1986. {
  1987. cmdWaterInvisible(id)
  1988. InvisMenu(id)
  1989. }
  1990. case 2
  1991. {
  1992. kz_menu(id)
  1993. }
  1994. }
  1995. return PLUGIN_HANDLED
  1996. }
  1997.  
  1998. public ShowTimer_Menu(id)
  1999. {
  2000. if (get_pcvar_num(kz_show_timer) == 0 )
  2001. {
  2002. kz_chat(id, %L, id, KZ_TIMER_DISABLED)
  2003. return PLUGIN_HANDLED
  2004. }
  2005. else
  2006. {
  2007. new menu = menu_create(yTimer Menuw, TimerHandler)
  2008.  
  2009. new roundtimer[64], hudtimer[64], notimer[64];
  2010.  
  2011. formatex(roundtimer, 63, Round Timer %s, ShowTime[id] == 2 y x )
  2012. formatex(hudtimer, 63, HUD Timer %s, ShowTime[id] == 1 y x )
  2013. formatex(notimer, 63, No Timer %s^n, ShowTime[id] == 0 y x )
  2014.  
  2015. menu_additem( menu, roundtimer, 1 )
  2016. menu_additem( menu, hudtimer, 2 )
  2017. menu_additem( menu, notimer, 3 )
  2018. menu_additem( menu, Main Menu, 4 )
  2019.  
  2020. menu_display(id, menu, 0)
  2021. return PLUGIN_HANDLED
  2022. }
  2023.  
  2024. return PLUGIN_HANDLED
  2025. }
  2026.  
  2027. public TimerHandler (id, menu, item)
  2028. {
  2029. if( item == MENU_EXIT )
  2030. {
  2031. menu_destroy(menu)
  2032. return PLUGIN_HANDLED
  2033. }
  2034.  
  2035. switch(item)
  2036. {
  2037.  
  2038. case 0
  2039. {
  2040. ShowTime[id]= 2
  2041. ShowTimer_Menu(id)
  2042. }
  2043. case 1
  2044. {
  2045. ShowTime[id]= 1
  2046. ShowTimer_Menu(id)
  2047. if (timer_started[id])
  2048. kz_showtime_roundtime(id, 0)
  2049. }
  2050. case 2
  2051. {
  2052. ShowTime[id]= 0
  2053. ShowTimer_Menu(id)
  2054. if (timer_started[id])
  2055. kz_showtime_roundtime(id, 0)
  2056. }
  2057. case 3
  2058. {
  2059. kz_menu(id)
  2060. }
  2061. }
  2062. return PLUGIN_HANDLED
  2063. }
  2064.  
  2065. public savepos_menu(id)
  2066. {
  2067. new menu = menu_create(SavePos Menu, SavePosHandler)
  2068.  
  2069. menu_additem( menu, Reload previous run, 1 )
  2070. menu_additem( menu, Start a new run, 2 )
  2071.  
  2072. menu_display(id, menu, 0)
  2073. return PLUGIN_HANDLED
  2074. }
  2075.  
  2076. public SavePosHandler(id, menu, item)
  2077. {
  2078.  
  2079. switch(item)
  2080. {
  2081. case 0
  2082. {
  2083. GoPos(id)
  2084. }
  2085. case 1
  2086. {
  2087. Verif(id,0)
  2088. }
  2089. }
  2090. return PLUGIN_HANDLED
  2091. }
  2092.  
  2093. public top15menu(id)
  2094. {
  2095. new menu = menu_create(rProKreedz yTop15 w, top15handler)
  2096. menu_additem(menu, wPro 15, 1, 0)
  2097. menu_additem(menu, wNoob 15^n^n, 2, 0)
  2098. #if defined USE_SQL
  2099. menu_additem(menu, Pro Records,3)
  2100. menu_additem(menu, Players Rankings^n,4)
  2101. menu_additem(menu, Last 10 Pro Entries, 5)
  2102. menu_additem(menu, Maps Statistic,6)
  2103. menu_additem(menu, Main Menu, 7)
  2104. #else
  2105. menu_additem(menu, wMain Menu, 3, 0)
  2106. #endif
  2107.  
  2108. menu_display(id, menu, 0);
  2109.  
  2110. return PLUGIN_HANDLED;
  2111. }
  2112.  
  2113. public top15handler(id, menu, item)
  2114. {
  2115. if(item == MENU_EXIT)
  2116. {
  2117. menu_destroy(menu)
  2118. return PLUGIN_HANDLED
  2119. }
  2120. #if defined USE_SQL
  2121. switch(item)
  2122. {
  2123. case 0
  2124. {
  2125. ProTop_show(id)
  2126. }
  2127. case 1
  2128. {
  2129. NoobTop_show(id)
  2130. }
  2131. case 2
  2132. {
  2133. kz_showhtml_motd(id, PRO_RECORDS, )
  2134. }
  2135. case 3
  2136. {
  2137. kz_showhtml_motd(id, PLAYERS_RANKING, )
  2138. }
  2139. case 4
  2140. {
  2141. kz_showhtml_motd(id, LAST_PRO10, )
  2142. }
  2143. case 5
  2144. {
  2145. kz_showhtml_motd(id, MAPS_STATISTIC, )
  2146. }
  2147. case 6
  2148. {
  2149. kz_menu(id)
  2150. }
  2151. }
  2152. #else
  2153. switch(item)
  2154. {
  2155. case 0
  2156. {
  2157. ProTop_show(id)
  2158. }
  2159. case 1
  2160. {
  2161. NoobTop_show(id)
  2162. }
  2163. case 2
  2164. {
  2165. kz_menu(id)
  2166. }
  2167. }
  2168. #endif
  2169.  
  2170. return PLUGIN_HANDLED;
  2171. }
  2172.  
  2173. =================================================================================================
  2174.  
  2175.  
  2176. Timersystem
  2177. =================================================================================================
  2178. public fwdUse(ent, id)
  2179. {
  2180. if( !ent id 32 )
  2181. {
  2182. return HAM_IGNORED;
  2183. }
  2184.  
  2185. if( !is_user_alive(id) )
  2186. {
  2187. return HAM_IGNORED;
  2188. }
  2189.  
  2190.  
  2191. new name[32]
  2192. get_user_name(id, name, 31)
  2193.  
  2194. new szTarget[ 32 ];
  2195. pev(ent, pev_target, szTarget, 31);
  2196. canusehook[id] = true
  2197. if( TrieKeyExists( g_tStarts, szTarget ) )
  2198. {
  2199.  
  2200. if ( get_gametime() - antihookcheat[id] 3.0 )
  2201. {
  2202. kz_hud_message( id, %L, id, KZ_HOOK_PROTECTION );
  2203. return PLUGIN_HANDLED
  2204. }
  2205.  
  2206. if(Verif(id,1))
  2207. {
  2208. ColorChat(id, GREEN, %s^x01 %L, prefix, id, KZ_SAVEPOS_SAVED)
  2209. savepos_menu(id)
  2210. return HAM_IGNORED
  2211. }
  2212.  
  2213. if ( reset_checkpoints(id) && !timer_started[id] )
  2214. {
  2215. start_climb(id)
  2216. new wpn=get_user_weapon(id)
  2217. for(new i = 0; i 8; i++)
  2218. if( user_has_weapon(id, other_weapons[i]) )
  2219. {
  2220. strip_user_weapons(id)
  2221. give_item(id,weapon_knife)
  2222. give_item(id,weapon_usp)
  2223. set_pdata_int(id, 382, 24, 5)
  2224. if(wpn==CSW_SCOUT)
  2225. {
  2226. user_has_scout[id]=true
  2227. give_item(id,weapon_scout)
  2228. }
  2229. else
  2230. user_has_scout[id]=false
  2231. }
  2232.  
  2233. if( get_user_health(id) 100 )
  2234. set_user_health(id, 100)
  2235.  
  2236. pev(id, pev_origin, SavedStart[id])
  2237. if(get_pcvar_num(kz_save_autostart) == 1)
  2238. AutoStart[id] = true;
  2239.  
  2240. if( !DefaultStart )
  2241. {
  2242. kz_set_start(MapName, SavedStart[id])
  2243. ColorChat(id, GREEN, %s^x01 %L, prefix, id, KZ_SET_START)
  2244. }
  2245.  
  2246. remove_hook(id)
  2247. }
  2248.  
  2249. }
  2250.  
  2251. if( TrieKeyExists( g_tStops, szTarget ) )
  2252. {
  2253. if( timer_started[id] )
  2254. {
  2255. if(get_user_noclip(id))
  2256. return PLUGIN_HANDLED
  2257.  
  2258. finish_climb(id)
  2259.  
  2260. if(get_pcvar_num(kz_hook_prize) == 1 && !canusehook[id])
  2261. {
  2262. canusehook[id] = true
  2263. ColorChat(id, GREEN, %s^x01 %L., prefix, id, KZ_HOOK)
  2264. }
  2265. }
  2266. else
  2267. kz_hud_message(id, %L, id, KZ_TIMER_NOT_STARTED)
  2268.  
  2269. }
  2270. return HAM_IGNORED
  2271. }
  2272.  
  2273. public start_climb(id)
  2274. {
  2275. kz_chat(id, %L, id, KZ_START_CLIMB)
  2276.  
  2277. if (get_pcvar_num(kz_reload_weapons) == 1)
  2278. {
  2279. strip_user_weapons(id)
  2280. give_item(id,weapon_knife)
  2281. give_item(id,weapon_usp)
  2282. }
  2283.  
  2284. if (ShowTime[id] == 2)
  2285. kz_showtime_roundtime(id, 0)
  2286. set_pev(id, pev_gravity, 1.0);
  2287. set_pev(id, pev_movetype, MOVETYPE_WALK)
  2288. set_user_godmode(id, 0)
  2289. reset_checkpoints(id)
  2290. IsPaused[id] = false
  2291. timer_started[id] = true
  2292. timer_time[id] = get_gametime()
  2293. }
  2294.  
  2295. public finish_climb(id)
  2296. {
  2297. if (!is_user_alive (id))
  2298. {
  2299. return;
  2300. }
  2301.  
  2302. if ( (get_pcvar_num(kz_top15_authid) 1) (get_pcvar_num(kz_top15_authid) 0) )
  2303. {
  2304. ColorChat(id, GREEN, %s^x01 %L., prefix, id, KZ_TOP15_DISABLED)
  2305. return;
  2306. }
  2307.  
  2308. #if defined USE_SQL
  2309. new Float time, wpn
  2310. time = get_gametime() - timer_time[id]
  2311. show_finish_message(id, time)
  2312. timer_started[id] = false
  2313. if (get_pcvar_num(kz_show_timer) 0 && ShowTime[id] == 2)
  2314. kz_showtime_roundtime(id, 0)
  2315. new checkpoints=checknumbers[id]
  2316. new gocheck=gochecknumbers[id]
  2317. if(user_has_scout[id])
  2318. wpn=CSW_SCOUT
  2319. else
  2320. wpn=get_user_weapon( id )
  2321.  
  2322. new steam[32], name[32]
  2323. get_user_name(id, name, 31)
  2324. get_user_authid(id, steam, 31 )
  2325. client_cmd(0, spk buttonsbell1)
  2326. new createinto[1001]
  2327.  
  2328. new cData[192]
  2329. cData[0] = id
  2330. formatex(cData[2], charsmax(cData)-2, ^%f^ ^%d^ ^%d^ ^%d^, time, wpn, checkpoints ,gocheck)
  2331.  
  2332.  
  2333. if(equal(steam, VALVE_ID_LAN) equal(steam, STEAM_ID_LAN) strlen(steam) 18)
  2334. {
  2335. if (gochecknumbers[id] == 0 && !user_has_scout[id] )
  2336. {
  2337. cData[1] = PRO_TOP
  2338. formatex(createinto, sizeof createinto - 1, SELECT time FROM `kz_pro15` WHERE mapname='%s' AND name='%s', MapName, name)
  2339. SQL_ThreadQuery(g_SqlTuple, Set_QueryHandler, createinto, cData, strlen(cData[2])+1)
  2340. }
  2341. if (gochecknumbers[id] 0 user_has_scout[id] )
  2342. {
  2343. cData[1] = NUB_TOP
  2344. formatex(createinto, sizeof createinto - 1, SELECT time FROM `kz_nub15` WHERE mapname='%s' AND name='%s', MapName, name)
  2345. SQL_ThreadQuery(g_SqlTuple, Set_QueryHandler, createinto, cData, strlen(cData[2])+1)
  2346. }
  2347. } else
  2348. {
  2349.  
  2350. if (gochecknumbers[id] == 0 && !user_has_scout[id] )
  2351. {
  2352. cData[1] = PRO_TOP
  2353. formatex(createinto, sizeof createinto - 1, SELECT time FROM `kz_pro15` WHERE mapname='%s' AND authid='%s', MapName, steam)
  2354. SQL_ThreadQuery(g_SqlTuple, Set_QueryHandler, createinto, cData, strlen(cData[2])+1)
  2355. }
  2356. if (gochecknumbers[id] 0 user_has_scout[id] )
  2357. {
  2358. cData[1] = NUB_TOP
  2359. formatex(createinto, sizeof createinto - 1, SELECT time FROM `kz_nub15` WHERE mapname='%s' AND authid='%s', MapName, steam)
  2360. SQL_ThreadQuery(g_SqlTuple, Set_QueryHandler, createinto, cData, strlen(cData[2])+1)
  2361. }
  2362. }
  2363. #else
  2364. new Float time, authid[32]
  2365. time = get_gametime() - timer_time[id]
  2366. get_user_authid(id, authid, 31)
  2367. show_finish_message(id, time)
  2368. timer_started[id] = false
  2369. if (get_pcvar_num(kz_show_timer) 0 && ShowTime[id] == 2)
  2370. kz_showtime_roundtime(id, 0)
  2371.  
  2372. if (gochecknumbers[id] == 0 && !user_has_scout[id] )
  2373. ProTop_update(id, time)
  2374. if (gochecknumbers[id] 0 user_has_scout[id] )
  2375. NoobTop_update(id, time, checknumbers[id], gochecknumbers[id])
  2376. #endif
  2377. user_has_scout[id] = false
  2378.  
  2379. }
  2380.  
  2381. public show_finish_message(id, Floatkreedztime)
  2382. {
  2383. new name[32]
  2384. new imin,isec,ims, wpn
  2385. if(user_has_scout[id])
  2386. wpn=CSW_SCOUT
  2387. else
  2388. wpn=get_user_weapon( id )
  2389. get_user_name(id, name, 31)
  2390. imin = floatround(kreedztime 60.0, floatround_floor)
  2391. isec = floatround(kreedztime - imin 60.0,floatround_floor)
  2392. ims = floatround( ( kreedztime - ( imin 60.0 + isec ) ) 100.0, floatround_floor )
  2393.  
  2394. ColorChat(0, GREEN, %s^x01^x03 %s^x01 %L^x04 %02i%02i.%02i ^x03(^x01 CPs ^x04%d^x03 ^x01 TPs ^x04%d^x03 ^x01 %L ^x04%s^x03) ^x01 !, prefix, name, LANG_PLAYER, KZ_FINISH_MSG, imin, isec, ims, checknumbers[id], gochecknumbers[id], LANG_PLAYER, KZ_WEAPON, g_weaponsnames[wpn])
  2395. }
  2396.  
  2397. ==========================================================
  2398. #if defined USE_SQL
  2399. public Set_QueryHandler(iFailState, HandlehQuery, szError[], iErrnum, cData[], iSize, FloatfQueueTime)
  2400. {
  2401. new id = cData[0]
  2402. new style = cData[1]
  2403. if( iFailState != TQUERY_SUCCESS )
  2404. {
  2405. log_amx([KZ] TOP15 SQL SQL Error #%d - %s, iErrnum, szError)
  2406. ColorChat(0, GREEN, %s^x01 %F, prefix, LANG_PLAYER, KZ_TOP15_SQL_ERROR)
  2407. }
  2408.  
  2409. server_print([KZ] Server Geting Info of SQL Server)
  2410.  
  2411. new createinto[1001]
  2412. new x1[16], x2[4], x3[5], x4[5]
  2413. parse(cData[2], x1, 15, x2, 3, x3, 4, x4, 4)
  2414.  
  2415. new dia[64], steam[32], name[32], ip[15], country[3], checkpoints[32], gochecks[32]
  2416. new Floatnewtime = str_to_float(x1)
  2417. new iMin, iSec, iMs, server[64]
  2418. get_pcvar_string(kz_sql_name, server, 63)
  2419. get_time(%Y%m%d%H%M%S, dia, sizeof dia - 1)
  2420. get_user_authid(id, steam, 31)
  2421. get_user_name(id, name, sizeof name - 1)
  2422. get_user_ip (id, ip, sizeof ip - 1, 1)
  2423. geoip_code2_ex( ip, country)
  2424.  
  2425. replace_all(name, 31, , )
  2426. replace_all(name, 31, `, )
  2427. replace_all(name, 31, ', )
  2428.  
  2429.  
  2430. if( SQL_NumResults(hQuery) == 0 )
  2431. {
  2432. formatex(checkpoints, 31, , '%d', str_to_num(x3))
  2433. formatex(gochecks, 31, , '%d', str_to_num(x4))
  2434. formatex( createinto, sizeof createinto - 1, INSERT INTO `%s` VALUES('%s', '%s','%s','%s','%f','%s','%s','%s'%s%s), style == PRO_TOP kz_pro15 kz_nub15, MapName, steam, country, name, newtime, dia, g_weaponsnames[str_to_num(x2)], server, style == PRO_TOP checkpoints, style == PRO_TOP gochecks)
  2435. SQL_ThreadQuery(g_SqlTuple, QueryHandle, createinto)
  2436. GetNewRank(id, style)
  2437. }
  2438. else
  2439. {
  2440. new Floatoldtime, Floatthetime
  2441. SQL_ReadResult(hQuery, 0, oldtime)
  2442.  
  2443. if(newtime oldtime)
  2444. {
  2445. thetime = oldtime - newtime
  2446. iMin = floatround(thetime 60.0, floatround_floor)
  2447. iSec = floatround(thetime - iMin 60.0,floatround_floor)
  2448. iMs = floatround( ( thetime - ( iMin 60.0 + iSec ) ) 100.0, floatround_floor )
  2449. ColorChat(id, GREEN, [KZ]^x01 %L^x03 %02i%02i.%02i^x01 in ^x03%s, id, KZ_IMPROVE, iMin, iSec, iMs, style == PRO_TOP Pro 15 Noob 15)
  2450. formatex(checkpoints, 31, , checkpoints='%d', str_to_num(x3))
  2451. formatex(gochecks, 31, , gocheck='%d', str_to_num(x4))
  2452. if(equal(steam, VALVE_ID_LAN) equal(steam, STEAM_ID_LAN) strlen(steam) 18)
  2453. formatex(createinto, sizeof createinto - 1, UPDATE `%s` SET time='%f', weapon='%s', date='%s', server='%s'%s%s WHERE name='%s' AND mapname='%s', style == PRO_TOP kz_pro15 kz_nub15, newtime, g_weaponsnames[str_to_num(x2)], dia, server, style == PRO_TOP gochecks, style == PRO_TOP checkpoints, name, MapName)
  2454. else
  2455. formatex(createinto, sizeof createinto - 1, UPDATE `%s` SET time='%f', weapon='%s', date='%s', server='%s'%s%s WHERE authid='%s' AND mapname='%s', style == PRO_TOP kz_pro15 kz_nub15, newtime, g_weaponsnames[str_to_num(x2)], dia, server, style == PRO_TOP gochecks, style == PRO_TOP checkpoints, steam, MapName)
  2456.  
  2457. SQL_ThreadQuery(g_SqlTuple, QueryHandle, createinto )
  2458. GetNewRank(id, style)
  2459. }
  2460. else
  2461. {
  2462. thetime = newtime - oldtime
  2463. iMin = floatround(thetime 60.0, floatround_floor)
  2464. iSec = floatround(thetime - iMin 60.0,floatround_floor)
  2465. iMs = floatround( ( thetime - ( iMin 60.0 + iSec ) ) 100.0, floatround_floor )
  2466. ColorChat(id, GREEN, [KZ]^x01 %L^x03 %02i%02i.%02i ^x01in ^x03%s, id, KZ_SLOWER, iMin, iSec, iMs, style == PRO_TOP Pro 15 Noob 15)
  2467. }
  2468. }
  2469.  
  2470. return PLUGIN_CONTINUE
  2471.  
  2472. }
  2473.  
  2474. public GetNewRank_QueryHandler(iFailState, HandlehQuery, szError[], iErrnum, cData[], iSize, FloatfQueueTime)
  2475. {
  2476. new id = cData[0]
  2477. if( iFailState != TQUERY_SUCCESS )
  2478. {
  2479. return log_amx(TOP15 SQL SQL Error #%d - %s, iErrnum, szError)
  2480. }
  2481.  
  2482. new steam[32], authid[32], namez[32], name[32], i = 0
  2483. get_user_authid(id, steam, 31)
  2484. get_user_name(id, namez, 31)
  2485.  
  2486. while( SQL_MoreResults(hQuery) )
  2487. {
  2488. i++
  2489. if(equal(steam, VALVE_ID_LAN) equal(steam, STEAM_ID_LAN) strlen(steam) 18)
  2490. {
  2491. SQL_ReadResult(hQuery, 0, name, 31)
  2492. if( equal(name, namez) )
  2493. {
  2494. ColorChat(0, GREEN, %s^x03 %s^x01 %L ^x03%d^x01 in^x03 %s^x01,prefix, namez, LANG_PLAYER, KZ_PLACE, i, cData[1] == PRO_TOP Pro 15 Noob 15);
  2495. break;
  2496. }
  2497. }
  2498. else
  2499. {
  2500. SQL_ReadResult(hQuery, 0, authid, 31)
  2501. if( equal(authid, steam) )
  2502. {
  2503. ColorChat(0, GREEN, %s^x03 %s^x01 %L ^x03%d^x01 in^x03 %s^x01,prefix, namez, LANG_PLAYER, KZ_PLACE, i, cData[1] == PRO_TOP Pro 15 Noob 15);
  2504. break;
  2505. }
  2506. }
  2507. SQL_NextRow(hQuery)
  2508. }
  2509.  
  2510. return PLUGIN_CONTINUE
  2511. }
  2512.  
  2513. public ProTop_show(id)
  2514. {
  2515. kz_showhtml_motd(id, PRO_TOP, MapName)
  2516.  
  2517. return PLUGIN_HANDLED
  2518. }
  2519.  
  2520. public NoobTop_show(id)
  2521. {
  2522.  
  2523. kz_showhtml_motd(id, NUB_TOP, MapName)
  2524.  
  2525. return PLUGIN_HANDLED
  2526. }
  2527.  
  2528. public ProRecs_show(id)
  2529. {
  2530. new authid[32]
  2531. get_user_authid(id, authid, 31)
  2532.  
  2533. if(equal(authid, VALVE_ID_LAN) equal(authid, STEAM_ID_LAN) strlen(authid) 18)
  2534. {
  2535. ColorChat (id, GREEN, %s^x01 %L, prefix, id, KZ_NO_STEAM)
  2536. return PLUGIN_HANDLED
  2537. }
  2538.  
  2539. kz_showhtml_motd(id, PRO_RECORDS, MapName)
  2540.  
  2541. return PLUGIN_HANDLED
  2542. }
  2543.  
  2544. stock kz_showhtml_motd(id, type, const map[])
  2545. {
  2546. new buffer[1001], namebuffer[64], filepath[96]
  2547. get_pcvar_string(kz_sql_files, filepath, 95)
  2548. new authid[32]
  2549. get_user_authid(id, authid, 31)
  2550.  
  2551. switch( type )
  2552. {
  2553. case PRO_TOP
  2554. {
  2555. formatex(namebuffer, 63, Pro 15 of %s, equal(map, ) All Maps map)
  2556. formatex(buffer, 1000, htmlheadmeta http-equiv=^Refresh^ content=^0;url=http%spro15.phpmap=%s^headbodypLOADING...pbodyhtml, filepath, map)
  2557. }
  2558. case NUB_TOP
  2559. {
  2560. formatex(namebuffer, 63, Noob 15 of %s, equal(map, ) All Maps map)
  2561. formatex(buffer, 1000, htmlheadmeta http-equiv=^Refresh^ content=^0;url=http%snub15.phpmap=%s^headbodypLOADING...pbodyhtml, filepath, map)
  2562. }
  2563. case PRO_RECORDS
  2564. {
  2565. formatex(namebuffer, 63, ProRecords and Rank)
  2566. formatex(buffer, 1000, htmlheadmeta http-equiv=^Refresh^ content=^0;url=http%splayer.phpauthid=%s^headbodypLOADING...pbodyhtml, filepath, authid)
  2567. }
  2568. case PLAYERS_RANKING
  2569. {
  2570. formatex(namebuffer, 63, Players Ranking)
  2571. formatex(buffer, 1000, htmlheadmeta http-equiv=^Refresh^ content=^0;url=http%splayers.php^headbodypLOADING...pbodyhtml, filepath, authid)
  2572. }
  2573. case LAST_PRO10
  2574. {
  2575. formatex(namebuffer, 63, Last 10 Pro Entries)
  2576. formatex(buffer, 1000, htmlheadmeta http-equiv=^Refresh^ content=^0;url=http%slastpro.php^headbodypLOADING...pbodyhtml, filepath)
  2577. }
  2578. case MAPS_STATISTIC
  2579. {
  2580. formatex(namebuffer, 63, Maps Statistic)
  2581. formatex(buffer, 1000, htmlheadmeta http-equiv=^Refresh^ content=^0;url=http%smap.php^headbodypLOADING...pbodyhtml, filepath)
  2582. }
  2583. }
  2584.  
  2585. show_motd(id, buffer, namebuffer)
  2586. }
  2587. #else
  2588. public ProTop_update(id, Floattime)
  2589. {
  2590. new authid[32], name[32], thetime[32], Float slower, Float faster, Floatprotiempo
  2591. get_user_name(id, name, 31);
  2592. get_user_authid(id, authid, 31);
  2593. get_time( %d%m%Y , thetime, 31);
  2594. new boolIs_in_pro15
  2595. Is_in_pro15 = false
  2596.  
  2597. for(new i = 0; i 15; i++)
  2598. {
  2599. if( (equali(Pro_Names[i], name) && (get_pcvar_num(kz_top15_authid) == 0)) (equali(Pro_AuthIDS[i], authid) && (get_pcvar_num(kz_top15_authid) == 1)) )
  2600. {
  2601. Is_in_pro15 = true
  2602. slower = time - Pro_Times[i]
  2603. faster = Pro_Times[i] - time
  2604. protiempo = Pro_Times[i]
  2605. }
  2606. }
  2607.  
  2608. for (new i = 0; i 15; i++)
  2609. {
  2610. if( time Pro_Times[i])
  2611. {
  2612. new pos = i
  2613. if ( get_pcvar_num(kz_top15_authid) == 0 )
  2614. while( !equal(Pro_Names[pos], name) && pos 15 )
  2615. {
  2616. pos++;
  2617. }
  2618. else if ( get_pcvar_num(kz_top15_authid) == 1)
  2619. while( !equal(Pro_AuthIDS[pos], authid) && pos 15 )
  2620. {
  2621. pos++;
  2622. }
  2623.  
  2624. for (new j = pos; j i; j--)
  2625. {
  2626. formatex(Pro_AuthIDS[j], 31, Pro_AuthIDS[j-1]);
  2627. formatex(Pro_Names[j], 31, Pro_Names[j-1]);
  2628. formatex(Pro_Date[j], 31, Pro_Date[j-1])
  2629. Pro_Times[j] = Pro_Times[j-1];
  2630. }
  2631.  
  2632. formatex(Pro_AuthIDS[i], 31, authid);
  2633. formatex(Pro_Names[i], 31, name);
  2634. formatex(Pro_Date[i], 31, thetime)
  2635. Pro_Times[i] = time
  2636.  
  2637. save_pro15()
  2638.  
  2639. if( Is_in_pro15 )
  2640. {
  2641.  
  2642. if( time protiempo )
  2643. {
  2644. new min, Floatsec;
  2645. min = floatround(faster, floatround_floor)60;
  2646. sec = faster - (60min);
  2647. ColorChat(id, GREEN, %s^x01 %L ^x03%02d%s%.2f^x01, prefix, id, KZ_IMPROVE, min, sec 10 0 , sec);
  2648.  
  2649. if( (i + 1) == 1)
  2650. {
  2651. client_cmd(0, spk woop);
  2652. ColorChat(0, GREEN, %s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Pro 15^x01, prefix, name, LANG_PLAYER, KZ_PLACE);
  2653. }
  2654. else
  2655. {
  2656. client_cmd(0, spk buttonsbell1);
  2657. ColorChat(0, GREEN, %s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Pro 15^x01, prefix, name, LANG_PLAYER, KZ_PLACE, (i+1));
  2658. }
  2659. }
  2660. }
  2661. else
  2662. {
  2663. if( (i + 1) == 1)
  2664. {
  2665. client_cmd(0, spk woop);
  2666. ColorChat(0, GREEN, %s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Pro 15^x01, prefix, name, LANG_PLAYER, KZ_PLACE);
  2667. }
  2668. else
  2669. {
  2670. client_cmd(0, spk buttonsbell1);
  2671. ColorChat(0, GREEN, %s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Pro 15^x01, prefix, name, LANG_PLAYER, KZ_PLACE, (i+1));
  2672. }
  2673. }
  2674.  
  2675. return;
  2676. }
  2677.  
  2678. if( (equali(Pro_Names[i], name) && (get_pcvar_num(kz_top15_authid) == 0)) (equali(Pro_AuthIDS[i], authid) && (get_pcvar_num(kz_top15_authid) == 1)) )
  2679. {
  2680. if( time protiempo )
  2681. {
  2682. new min, Floatsec;
  2683. min = floatround(slower, floatround_floor)60;
  2684. sec = slower - (60min);
  2685. ColorChat(id, GREEN, %s^x01 %L ^x03%02d%s%.2f^x01, prefix, id, KZ_SLOWER, min, sec 10 0 , sec);
  2686. return;
  2687. }
  2688. }
  2689.  
  2690. }
  2691. }
  2692.  
  2693. public save_pro15()
  2694. {
  2695. new profile[128]
  2696. formatex(profile, 127, %spro_%s.cfg, Topdir, MapName)
  2697.  
  2698. if( file_exists(profile) )
  2699. {
  2700. delete_file(profile)
  2701. }
  2702.  
  2703. new Data[256];
  2704. new f = fopen(profile, at)
  2705.  
  2706. for(new i = 0; i 15; i++)
  2707. {
  2708. formatex(Data, 255, ^%.2f^ ^%s^ ^%s^ ^%s^^n, Pro_Times[i], Pro_AuthIDS[i], Pro_Names[i], Pro_Date[i])
  2709. fputs(f, Data)
  2710. }
  2711. fclose(f);
  2712. }
  2713.  
  2714. public read_pro15()
  2715. {
  2716. new profile[128], prodata[256]
  2717. formatex(profile, 127, %spro_%s.cfg, Topdir, MapName)
  2718.  
  2719. new f = fopen(profile, rt )
  2720. new i = 0
  2721. while( !feof(f) && i 16)
  2722. {
  2723. fgets(f, prodata, 255)
  2724. new totime[25]
  2725. parse(prodata, totime, 24, Pro_AuthIDS[i], 31, Pro_Names[i], 31, Pro_Date[i], 31)
  2726. Pro_Times[i] = str_to_float(totime)
  2727. i++;
  2728. }
  2729. fclose(f)
  2730. }
  2731.  
  2732. ==================================================================================================
  2733.  
  2734. public NoobTop_update(id, Floattime, checkpoints, gochecks)
  2735. {
  2736. new authid[32], name[32], thetime[32], wpn, Float slower, Float faster, Floatnoobtiempo
  2737. get_user_name(id, name, 31);
  2738. get_user_authid(id, authid, 31);
  2739. get_time( %d%m%Y , thetime, 31);
  2740. new boolIs_in_noob15
  2741. Is_in_noob15 = false
  2742. if(user_has_scout[id])
  2743. wpn=CSW_SCOUT
  2744. else
  2745. wpn=get_user_weapon(id)
  2746.  
  2747. for(new i = 0; i 15; i++)
  2748. {
  2749. if( (equali(Noob_Names[i], name) && (get_pcvar_num(kz_top15_authid) == 0)) (equali(Noob_AuthIDS[i], authid) && (get_pcvar_num(kz_top15_authid) == 1)) )
  2750. {
  2751. Is_in_noob15 = true
  2752. slower = time - Noob_Tiempos[i];
  2753. faster = Noob_Tiempos[i] - time;
  2754. noobtiempo = Noob_Tiempos[i]
  2755. }
  2756. }
  2757.  
  2758. for (new i = 0; i 15; i++)
  2759. {
  2760. if( time Noob_Tiempos[i])
  2761. {
  2762. new pos = i
  2763.  
  2764. if ( get_pcvar_num(kz_top15_authid) == 0 )
  2765. while( !equal(Noob_Names[pos], name) && pos 15 )
  2766. {
  2767. pos++;
  2768. }
  2769. else if ( get_pcvar_num(kz_top15_authid) == 1)
  2770. while( !equal(Noob_AuthIDS[pos], authid) && pos 15 )
  2771. {
  2772. pos++;
  2773. }
  2774.  
  2775. for (new j = pos; j i; j--)
  2776. {
  2777. formatex(Noob_AuthIDS[j], 31, Noob_AuthIDS[j-1])
  2778. formatex(Noob_Names[j], 31, Noob_Names[j-1])
  2779. formatex(Noob_Date[j], 31, Noob_Date[j-1])
  2780. formatex(Noob_Weapon[j], 31, Noob_Weapon[j-1])
  2781. Noob_Tiempos[j] = Noob_Tiempos[j-1]
  2782. Noob_CheckPoints[j] = Noob_CheckPoints[j-1]
  2783. Noob_GoChecks[j] = Noob_GoChecks[j-1]
  2784. }
  2785.  
  2786. formatex(Noob_AuthIDS[i], 31, authid);
  2787. formatex(Noob_Names[i], 31, name);
  2788. formatex(Noob_Date[i], 31, thetime)
  2789. formatex(Noob_Weapon[i], 31, g_weaponsnames[wpn])
  2790. Noob_Tiempos[i] = time
  2791. Noob_CheckPoints[i] = checkpoints
  2792. Noob_GoChecks[i] = gochecks
  2793.  
  2794. save_Noob15()
  2795.  
  2796. if( Is_in_noob15 )
  2797. {
  2798.  
  2799. if( time noobtiempo )
  2800. {
  2801. new min, Floatsec;
  2802. min = floatround(faster, floatround_floor)60;
  2803. sec = faster - (60min);
  2804. ColorChat(id, GREEN, %s^x01 %L ^x03%02d%s%.2f^x01, prefix, id, KZ_IMPROVE, min, sec 10 0 , sec);
  2805.  
  2806. if( (i + 1) == 1)
  2807. {
  2808. client_cmd(0, spk woop);
  2809. ColorChat(0, GREEN, %s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Noob 15^x01, prefix, name, LANG_PLAYER, KZ_PLACE);
  2810. }
  2811. else
  2812. {
  2813. client_cmd(0, spk buttonsbell1);
  2814. ColorChat(0, GREEN, %s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Noob 15^x01, prefix, name, LANG_PLAYER, KZ_PLACE, (i+1));
  2815. }
  2816. }
  2817. }
  2818. else
  2819. {
  2820. if( (i + 1) == 1)
  2821. {
  2822. client_cmd(0, spk woop);
  2823. ColorChat(0, GREEN, %s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Noob 15^x01, prefix, name, LANG_PLAYER, KZ_PLACE);
  2824. }
  2825. else
  2826. {
  2827. client_cmd(0, spk buttonsbell1);
  2828. ColorChat(0, GREEN, %s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Noob 15^x01, prefix, name, LANG_PLAYER, KZ_PLACE, (i+1));
  2829. }
  2830. }
  2831. return;
  2832. }
  2833.  
  2834. if( (equali(Noob_Names[i], name) && (get_pcvar_num(kz_top15_authid) == 0)) (equali(Noob_AuthIDS[i], authid) && (get_pcvar_num(kz_top15_authid) == 1)) )
  2835. {
  2836. if( time noobtiempo )
  2837. {
  2838.  
  2839. new min, Floatsec;
  2840. min = floatround(slower, floatround_floor)60;
  2841. sec = slower - (60min);
  2842. ColorChat(id, GREEN, %s^x01 %L ^x03%02d%s%.2f^x01, prefix, id, KZ_SLOWER, min, sec 10 0 , sec);
  2843. return;
  2844. }
  2845. }
  2846.  
  2847. }
  2848. }
  2849.  
  2850. public save_Noob15()
  2851. {
  2852. new profile[128]
  2853. formatex(profile, 127, %sNoob_%s.cfg, Topdir, MapName)
  2854.  
  2855. if( file_exists(profile) )
  2856. {
  2857. delete_file(profile)
  2858. }
  2859.  
  2860. new Data[256];
  2861. new f = fopen(profile, at)
  2862.  
  2863. for(new i = 0; i 15; i++)
  2864. {
  2865. formatex(Data, 255, ^%.2f^ ^%s^ ^%s^ ^%i^ ^%i^ ^%s^ ^%s^ ^n, Noob_Tiempos[i], Noob_AuthIDS[i], Noob_Names[i], Noob_CheckPoints[i], Noob_GoChecks[i],Noob_Date[i],Noob_Weapon[i])
  2866. fputs(f, Data)
  2867. }
  2868. fclose(f);
  2869. }
  2870.  
  2871. public read_Noob15()
  2872. {
  2873. new profile[128], prodata[256]
  2874. formatex(profile, 127, %sNoob_%s.cfg, Topdir, MapName)
  2875.  
  2876. new f = fopen(profile, rt )
  2877. new i = 0
  2878. while( !feof(f) && i 16)
  2879. {
  2880. fgets(f, prodata, 255)
  2881. new totime[25], checks[5], gochecks[5]
  2882. parse(prodata, totime, 24, Noob_AuthIDS[i], 31, Noob_Names[i], 31, checks, 4, gochecks, 4, Noob_Date[i], 31, Noob_Weapon[i], 31)
  2883. Noob_Tiempos[i] = str_to_float(totime)
  2884. Noob_CheckPoints[i] = str_to_num(checks)
  2885. Noob_GoChecks[i] = str_to_num(gochecks)
  2886. i++;
  2887. }
  2888. fclose(f)
  2889. }
  2890.  
  2891. public ProTop_show(id)
  2892. {
  2893. new buffer[2048], len, name[32]
  2894.  
  2895. len = formatex(buffer, 2047, bodycenterstyle type=^textcss^body {background url(^httpwww.alena-vysotskaya.ruimages600DSC100613092.jpg^) no-repeat center center fixed;background-size cover;}table {font-sizesmall;font-family Courier;border-collapse collapse;text-aligncenter;})
  2896. len += formatex(buffer[len], 2047-len, tr align=center bgcolor=#0052FFth width=5%% # th width=45%% align=center Player th width=30%% Time th width=20%% Date )
  2897. len += formatex(buffer[len], 2047-len, tr{background-colorrgb(1,1,1, 0.0);color#d4d6dd;;cellpading 10px;}tbody trfirst-child{line-height 25px;border-bottom 1px solid #38393c;border-top 1px solid #4b4c4f;}table trnth-child(2){border-bottom 1px solid #27272a;}table trnth-child(3){border-bottom 1px solid #1c1c1e;styletable width=70%% cellpadding=4 )
  2898. len += formatex(buffer[len], 2047-len, theadtr height=40px th width=80% colspan=4Pro Top - %sthead, MapName)
  2899.  
  2900. for (new i = 0; i 10; i++)
  2901. {
  2902. name = Pro_Names[i]
  2903.  
  2904. if( Pro_Times[i] 9999999.0 )
  2905. {
  2906. len += formatex(buffer[len], 2047-len, tr align=center%std %d td align=center %s td %s td %s, ((i%2)==0) bgcolor=#5DA5FF bgcolor=#3399FF, (i+1), , , )
  2907. len += formatex(buffer[len], 2047-len, )
  2908. }
  2909.  
  2910. else
  2911. {
  2912. new minutos, Floatsegundos
  2913. minutos = floatround(Pro_Times[i], floatround_floor)60
  2914. segundos = Pro_Times[i] - (60minutos)
  2915.  
  2916. len += formatex(buffer[len], 2047-len, tr align=center%std %d td align=center %s td b%02d%s%.2f td %s, ((i%2)==0) bgcolor=#5DA5FF bgcolor=#3399FF, (i+1), Pro_Names[i], minutos, segundos 10 0 , segundos, Pro_Date[i])
  2917. len += formatex(buffer[len], 2047-len, trtd %d td %s td %02d%s%.2f td %s, (i+1), Pro_Names[i], minutos, segundos 10 0 , segundos, Pro_Date[i])
  2918.  
  2919. }
  2920. }
  2921.  
  2922. len += formatex(buffer[len], 2047-len, tablebody)
  2923. len += formatex(buffer[len], 2047-len, CenterbBRPlugin created by nucLeaR)
  2924.  
  2925. show_motd(id, buffer, Pro10 Climbers)
  2926.  
  2927. return PLUGIN_HANDLED
  2928. }
  2929.  
  2930. public NoobTop_show(id)
  2931. {
  2932. new buffer[2048], name[32], len
  2933.  
  2934. len = formatex(buffer, 2047, body bgcolor=#3399FFtable width=100%% cellpadding=2 cellspacing=0 border=0)
  2935. len += formatex(buffer[len], 2047-len, tr align=center bgcolor=#0052FFth width=5%% # th width=35%% align=center Player th width=20%% Time th width=10%% CPs th width=10%% TPs th width=10%% Date)
  2936.  
  2937. for (new i = 0; i 10; i++)
  2938. {
  2939. if( Noob_Tiempos[i] 9999999.0 )
  2940. {
  2941. len += formatex(buffer[len], 2047-len, tr align=center%std %d td align=center %s td %s td %s td %s td %s, ((i%2)==0) bgcolor=#5DA5FF bgcolor=#3399FF, (i+1), , , , , )
  2942. }
  2943.  
  2944. else
  2945. {
  2946. name = Noob_Names[i]
  2947. new minutos, Floatsegundos
  2948. minutos = floatround(Noob_Tiempos[i], floatround_floor)60
  2949. segundos = Noob_Tiempos[i] - (60minutos)
  2950.  
  2951. len += formatex(buffer[len], 2047-len, tr align=center%std %d td align=center %s%s td b%02d%s%.2f td %d td %d td %s, ((i%2)==0) bgcolor=#5DA5FF bgcolor=#3399FF, (i+1), Noob_Names[i], equal(Noob_Weapon[i],scout) (scout) , minutos, segundos 10 0 , segundos, Noob_CheckPoints[i], Noob_GoChecks[i], Noob_Date[i], Noob_Weapon[i])
  2952. }
  2953. }
  2954.  
  2955. len += formatex(buffer[len], 2047-len, tablebody)
  2956. len += formatex(buffer[len], 2047-len, trCenterbBRPlugin created by nucLeaR)
  2957.  
  2958. show_motd(id, buffer, Noob10 Climbers)
  2959.  
  2960. return PLUGIN_HANDLED
  2961. }
  2962. #endif
  2963.  
  2964. You reached the end of file
  2965. The original plugin was made by p4ddY
  2966. This plugin was edited by nucLeaR
  2967. Version 2.31
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement