Advertisement
Guest User

Untitled

a guest
May 28th, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 104.45 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 TASK_ID_MINISECOND 1330
  16. #define KZ_LEVEL ADMIN_KICK
  17. #define MSG MSG_ONE_UNRELIABLE
  18. #define MAX_ENTITYS 900+15*32
  19. #define IsOnLadder(%1) (pev(%1, pev_movetype) == MOVETYPE_FLY)
  20. #define VERSION "2.31"
  21.  
  22. #define SCOREATTRIB_NONE 0
  23. #define SCOREATTRIB_DEAD ( 1 << 0 )
  24. #define SCOREATTRIB_BOMB ( 1 << 1 )
  25. #define SCOREATTRIB_VIP ( 1 << 2 )
  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. new const KZ_ENDFILE[] = "end.ini"
  35. new const KZ_ENDFILE_TEMP[] = "temp_end.ini"
  36.  
  37. #if defined USE_SQL
  38. new Handle:g_SqlTuple
  39. new Handle:SqlConnection
  40. new g_Error[512]
  41. new kz_sql_host
  42. new kz_sql_user
  43. new kz_sql_pass
  44. new kz_sql_db
  45. new kz_sql_name
  46. new kz_sql_files
  47. #else
  48. new Float:Pro_Times[24]
  49. new Pro_AuthIDS[24][32]
  50. new Pro_Names[24][32]
  51. new Pro_Date[24][32]
  52. new Float:Noob_Tiempos[24]
  53. new Noob_AuthIDS[24][32]
  54. new Noob_Names[24][32]
  55. new Noob_Date[24][32]
  56. new Noob_CheckPoints[24]
  57. new Noob_GoChecks[24]
  58. new Noob_Weapon[24][32]
  59. #endif
  60.  
  61. new Float:Checkpoints[33][2][3]
  62. new Float:timer_time[33]
  63. new Float:g_pausetime[33]
  64. new Float:antihookcheat[33]
  65. new Float:SpecLoc[33][3]
  66. new Float:NoclipPos[33][3]
  67. new Float:PauseOrigin[33][3]
  68. new Float:SavedStart[33][3]
  69. new hookorigin[33][3]
  70. new Float:DefaultStartPos[3]
  71. new Float:SavedEnd[33][3]
  72. new Float:DefaultEndPos[3]
  73.  
  74. new Float:MyStartPos[33][3]
  75. new bool:MyStart[33]
  76.  
  77. new Float:SavedTime[33]
  78. new SavedChecks[33]
  79. new SavedGoChecks[33]
  80. new SavedScout[33]
  81. new SavedOrigins[33][3]
  82.  
  83. new bool:g_bCpAlternate[33]
  84. new bool:timer_started[33]
  85. new bool:IsPaused[33]
  86. new bool:WasPaused[33]
  87. new bool:firstspawn[33]
  88. new bool:canusehook[33]
  89. new bool:ishooked[33]
  90. new bool:user_has_scout[33]
  91. new bool:NightVisionUse[33]
  92. new bool:HealsOnMap
  93. new bool:gViewInvisible[33]
  94. new bool:gMarkedInvisible[33] = { true, ...};
  95. new bool:gWaterInvisible[33]
  96. new bool:gWaterEntity[MAX_ENTITYS]
  97. new bool:gWaterFound
  98. new bool:DefaultStart
  99. new bool:AutoStart[33]
  100. new bool:DefaultEnd
  101. new bool:AutoEnd[33]
  102.  
  103. new Trie:g_tStarts
  104. new Trie:g_tStops;
  105.  
  106. new checknumbers[33]
  107. new gochecknumbers[33]
  108. new chatorhud[33]
  109. new ShowTime[33]
  110. new MapName[64]
  111. new Kzdir[128]
  112. new SavePosDir[128]
  113. new prefix[33]
  114. #if !defined USE_SQL
  115. new Topdir[128]
  116. #endif
  117.  
  118. new kz_checkpoints
  119. new kz_cheatdetect
  120. new kz_spawn_mainmenu
  121. new kz_show_timer
  122. new kz_chatorhud
  123. new kz_hud_color
  124. new kz_chat_prefix
  125. new hud_message
  126. new kz_other_weapons
  127. new kz_maxspeedmsg
  128. new kz_drop_weapons
  129. new kz_remove_drops
  130. new kz_pick_weapons
  131. new kz_reload_weapons
  132. new kz_use_radio
  133. new kz_hook_prize
  134. new kz_hook_sound
  135. new kz_hook_speed
  136. new kz_pause
  137. new kz_noclip_pause
  138. new kz_nvg
  139. new kz_nvg_colors
  140. new kz_vip
  141. new kz_respawn_ct
  142. new kz_save_pos
  143. new kz_save_pos_gochecks
  144. new kz_semiclip
  145. new kz_semiclip_transparency
  146. new kz_spec_saves
  147. new kz_save_autostart
  148. new kz_save_autoEnd
  149. new kz_top15_authid
  150. new Sbeam = 0
  151. new g_showkey[33];
  152. new g_hud_center;
  153. new g_idspecting[2][33]
  154. new givehook[33][32]
  155.  
  156. new const Float:lj_position[46][3] =
  157. {
  158. {-1055.003051, 578.635498, -835.968750},
  159. {-1337.197631, 577.174560, -835.968750},
  160. {-1651.245117, 581.575073, -835.968750},
  161. {-1921.205322, 587.690368, -835.968750},
  162. {-2213.586669, 588.194885, -835.968750},
  163. {-2502.909179, 597.480102, -835.968750},
  164. {-2784.991210, 590.543945, -835.968750},
  165. {-3078.690673, 617.415283, -835.968750},
  166. {-3368.292236, 618.033691, -835.968750},
  167. {-3655.670166, 618.645690, -835.968750},
  168. {346.657379, -65.992279, -835.968750},
  169. {343.470245, -370.965698, -835.968750},
  170. {368.199707, -644.888305, -835.968750},
  171. {362.770263, -948.266723, -835.968750},
  172. {350.296752, -1231.697998, -835.968750},
  173. {342.843292, -1519.162109, -835.968750},
  174. {337.480926, -1804.483276, -835.968750},
  175. {349.853942, -2086.625244, -835.968750},
  176. {340.216217, -2378.290283, -835.968750},
  177. {329.746215, -2667.063964, -835.968750},
  178. {992.000000, 1344.000000, -835.968750},
  179. {1293.783691, 1325.809326, -835.968750},
  180. {1558.312500, 1325.479858, -835.968750},
  181. {1859.839111, 1332.097900, -835.968750},
  182. {2151.729492, 1329.970092, -835.968750},
  183. {2441.665771, 1327.857421, -835.968750},
  184. {2720.086914, 1337.539184, -835.968750},
  185. {3008.200195, 1337.607666, -835.968750},
  186. {3298.108154, 1340.810424, -835.968750},
  187. {3586.843750, 1342.000732, -835.968750},
  188. {352.000000, -64.000000, -1315.968750},
  189. {360.576812, -359.372985, -1315.968750},
  190. {359.121459, -646.579345, -1315.968750},
  191. {361.546752, -937.313232, -1315.968750},
  192. {361.411743, -1219.124267, -1315.968750},
  193. {361.272125, -1509.990844, -1315.968750},
  194. {362.045288, -1797.906250, -1315.968750},
  195. {362.804931, -2080.791015, -1315.968750},
  196. {363.589141, -2372.813232, -1315.968750},
  197. {364.382202, -2668.154785, -1315.968750},
  198. {-1056.000000, 576.000000, -1315.968750},
  199. {-1361.455688, 577.189392, -1315.968750},
  200. {-1636.939819, 581.278381, -1315.968750},
  201. {-1939.184692, 557.332946, -1315.968750},
  202. {-2225.302734, 563.066894, -1315.968750},
  203. {-2507.784423, 568.727539, -1315.968750}
  204. };
  205.  
  206. new const Float:bhop_position[31][3] =
  207. {
  208. {-1112.000000, 856.000000, -2603.968750},
  209. {-1384.000000, 856.000000, -2603.968750},
  210. {-1656.000000, 856.000000, -2603.968750},
  211. {-1928.000000, 856.000000, -2603.968750},
  212. {-2200.000000, 856.000000, -2603.968750},
  213. {-2472.000000, 856.000000, -2603.968750},
  214. {-2744.000000, 856.000000, -2603.968750},
  215. {-3016.000000, 856.000000, -2603.968750},
  216. {-3288.000000, 856.000000, -2603.968750},
  217. {-3560.000000, 856.000000, -2603.968750},
  218. {276.000000, 216.000000, -2603.968750},
  219. {276.000000, -56.000000, -2603.968750},
  220. {276.000000, -328.000000, -2603.968750},
  221. {276.000000, -600.000000, -2603.968750},
  222. {276.000000, -872.000000, -2603.968750},
  223. {276.000000, -1144.000000, -2603.968750},
  224. {276.000000, -1416.000000, -2603.968750},
  225. {276.000000, -1688.000000, -2603.968750},
  226. {276.000000, -1960.000000, -2603.968750},
  227. {276.000000, -2232.000000, -2603.968750},
  228. {920.000000, 1604.000000, -2603.968750},
  229. {1192.000000, 1604.000000, -2603.968750},
  230. {1464.000000, 1604.000000, -2603.968750},
  231. {1736.000000, 1604.000000, -2603.968750},
  232. {2008.000000, 1604.000000, -2603.968750},
  233. {2280.000000, 1604.000000, -2603.968750},
  234. {2552.000000, 1604.000000, -2603.968750},
  235. {2824.000000, 1604.000000, -2603.968750},
  236. {3096.000000, 1604.000000, -2603.968750},
  237. {3368.000000, 1604.000000, -2603.968750},
  238. {3640.000000, 1604.000000, -2603.968750}
  239. };
  240.  
  241. new const Float:cj_position[36][3] =
  242. {
  243. {510.419097, -570.309509, -1987.968750},
  244. {895.791259, -568.062133, -1987.968750},
  245. {1278.016967, -562.385681, -1987.968750},
  246. {1666.351440, -555.636962, -1987.968750},
  247. {2065.401367, -546.061279, -1987.968750},
  248. {2040.247924, -937.604553, -1987.968750},
  249. {1665.417480, -928.629760, -1987.968750},
  250. {1275.896606, -928.826965, -1987.968750},
  251. {892.463623, -917.491577, -1987.968750},
  252. {502.266082, -920.462524, -1987.968750},
  253. {-508.481475, -913.018859, -1987.968750},
  254. {-886.500610, -895.082397, -1987.968750},
  255. {-1288.920410, -892.894775, -1987.968750},
  256. {-1657.170654, -899.145629, -1987.968750},
  257. {-2049.642333, -921.599304, -1987.968750},
  258. {-2060.020996, -567.047363, -1987.968750},
  259. {-1666.292602, -567.379882, -1987.968750},
  260. {-1277.856201, -580.906982, -1987.968750},
  261. {-897.188049, -579.648559, -1987.968750},
  262. {-499.895538, -590.854248, -1987.968750},
  263. {-146.453659, 539.329589, -1987.968750},
  264. {-153.383697, 920.178405, -1987.968750},
  265. {-144.053710, 1307.472045, -1987.968750},
  266. {-147.273071, 1687.733276, -1987.968750},
  267. {-164.247619, 2066.548095, -1987.968750},
  268. {148.882644, 2073.309326, -1987.968750},
  269. {154.298782, 1683.728881, -1987.968750},
  270. {159.601821, 1302.276245, -1987.968750},
  271. {164.697799, 935.719665, -1987.968750},
  272. {170.312454, 536.241882, -1987.968750},
  273. {779.433044, -2107.653808, -1987.968750},
  274. {382.840240, -2114.206054, -1987.968750},
  275. {3.906657, -2098.052978, -1987.968750},
  276. {-372.657531, -2098.760986, -1987.968750},
  277. {-772.508483, -2103.706787, -1987.968750},
  278. {-1153.285888, -2091.457519, -1987.968750}
  279. };
  280.  
  281. new const Float:hj_position[31][3] =
  282. {
  283. {-1106.355468, 878.013427, -3163.968750},
  284. {-1367.504028, 913.048767, -3163.968750},
  285. {-1647.023071, 908.966552, -3163.968750},
  286. {-1917.632080, 910.012084, -3163.968750},
  287. {-2182.140380, 911.779602, -3163.968750},
  288. {-2470.787353, 910.848754, -3163.968750},
  289. {-2722.177978, 914.569641, -3163.968750},
  290. {-3000.114501, 910.841430, -3163.981689},
  291. {-3281.111572, 912.804687, -3163.981689},
  292. {-3556.852294, 913.801147, -3163.968750},
  293. {240.000000, 216.000000, -3163.968750},
  294. {241.124816, -56.954338, -3163.968750},
  295. {239.805801, -340.236358, -3163.968750},
  296. {240.463912, -606.579223, -3163.968750},
  297. {238.570556, -880.856750, -3163.968750},
  298. {241.137466, -1151.218872, -3163.968750},
  299. {241.707733, -1414.711181, -3163.968750},
  300. {240.443603, -1703.864868, -3163.968750},
  301. {240.031265, -1949.415161, -3163.968750},
  302. {239.354141, -2221.444580, -3163.968750},
  303. {936.000000, 1616.000000, -3163.968750},
  304. {1228.001831, 1617.031494, -3163.968750},
  305. {1498.516601, 1616.019775, -3163.968750},
  306. {1767.118408, 1615.015380, -3163.968750},
  307. {2020.724975, 1614.067138, -3163.968750},
  308. {2308.373291, 1613.513305, -3163.968750},
  309. {2571.921875, 1614.751342, -3163.968750},
  310. {2856.849365, 1615.914428, -3163.968750},
  311. {3121.180664, 1613.757812, -3163.968750},
  312. {3393.780029, 1613.029541, -3163.968750},
  313. {3661.197998, 1615.132324, -3163.968750}
  314. };
  315.  
  316. new const Float:ladder_position[21][3] =
  317. {
  318. {-857.883483, -416.029144, 612.031250},
  319. {-856.920715, -272.506286, 612.031250},
  320. {-855.968750, -130.703628, 612.031250},
  321. {-853.100952, 13.096566, 612.031250},
  322. {-850.177490, 159.679611, 612.031250},
  323. {-867.020446, 299.906280, 612.031250},
  324. {-864.290527, 446.658813, 612.031250},
  325. {-861.931030, 589.741088, 612.031250},
  326. {-859.532470, 735.175231, 612.031250},
  327. {-857.180053, 877.828247, 612.031250},
  328. {-682.690917, 1048.701904, 612.031250},
  329. {-533.808044, 1040.901000, 612.031250},
  330. {-389.494995, 1036.525024, 612.031250},
  331. {-247.663177, 1032.294921, 612.031250},
  332. {-104.602775, 1027.355712, 612.031250},
  333. {37.518779, 1013.453491, 612.031250},
  334. {183.952041, 1008.388732, 612.031250},
  335. {324.939300, 1008.444580, 612.031250},
  336. {471.211456, 1008.567443, 612.031250},
  337. {617.199951, 1008.176391, 612.031250},
  338. {761.598754, 1008.002502, 612.031250}
  339. }
  340.  
  341. new const Float:place_position[5][3] =
  342. {
  343. {-32.000000, 1312.000000, -835.968750},
  344. {-96.000000, 1584.000000, -2603.968750},
  345. {0.000000, -40.000000, -1987.968750},
  346. {-80.000000, 1584.000000, -3163.968750},
  347. {-1168.000000, -656.000000, 740.031250}
  348. }
  349. //==============================================
  350.  
  351. new const other_weapons[8] =
  352. {
  353. CSW_SCOUT, CSW_P90, CSW_FAMAS, CSW_SG552,
  354. CSW_M4A1, CSW_M249, CSW_AK47, CSW_AWP
  355. }
  356.  
  357. new const other_weapons_name[8][] =
  358. {
  359. "weapon_scout", "weapon_p90", "weapon_famas", "weapon_sg552",
  360. "weapon_m4a1", "weapon_m249", "weapon_ak47", "weapon_awp"
  361. }
  362.  
  363. new const g_weaponsnames[][] =
  364. {
  365. "", // NULL
  366. "p228", "shield", "scout", "hegrenade", "xm1014", "c4",
  367. "mac10", "aug", "smokegrenade", "elite", "fiveseven",
  368. "ump45", "sg550", "galil", "famas", "usp", "glock18",
  369. "awp", "mp5navy", "m249", "m3", "m4a1", "tmp", "g3sg1",
  370. "flashbang", "deagle", "sg552", "ak47", "knife", "p90",
  371. "glock", "elites", "fn57", "mp5", "vest", "vesthelm",
  372. "flash", "hegren", "sgren", "defuser", "nvgs", "primammo",
  373. "secammo", "km45", "9x19mm", "nighthawk", "228compact",
  374. "12gauge", "autoshotgun", "mp", "c90", "cv47", "defender",
  375. "clarion", "krieg552", "bullpup", "magnum", "d3au1",
  376. "krieg550"
  377. }
  378.  
  379. new const g_block_commands[][]=
  380. {
  381. "buy", "buyammo1", "buyammo2", "buyequip",
  382. "cl_autobuy", "cl_rebuy", "cl_setautobuy", "cl_setrebuy"
  383.  
  384. }
  385.  
  386. #if defined USE_SQL
  387. enum
  388. {
  389. TOP_NULL,
  390. PRO_TOP,
  391. NUB_TOP,
  392. LAST_PRO10,
  393. PRO_RECORDS,
  394. PLAYERS_RANKING,
  395. MAPS_STATISTIC
  396. }
  397. #endif
  398.  
  399. // =================================================================================================
  400.  
  401. public plugin_init()
  402. {
  403. register_plugin("ProKreedz", VERSION, "f0rged")
  404.  
  405. new mapita[32];
  406. get_mapname(mapita, 31);
  407.  
  408. if(equali(mapita, "kz_longjumps2"))
  409. {
  410. register_clcmd("say", "hooksay");
  411. register_clcmd("say_team", "hooksay");
  412. }
  413.  
  414. g_hud_center = CreateHudSyncObj();
  415. kz_checkpoints = register_cvar("kz_checkpoints","1")
  416. kz_cheatdetect = register_cvar("kz_cheatdetect","1")
  417. kz_spawn_mainmenu = register_cvar("kz_spawn_mainmenu", "1")
  418. kz_show_timer = register_cvar("kz_show_timer", "1")
  419. kz_chatorhud = register_cvar("kz_chatorhud", "2")
  420. kz_chat_prefix = register_cvar("kz_chat_prefix", "[KZ-Arg]")
  421. kz_hud_color = register_cvar("kz_hud_color", "255 255 255")
  422. kz_other_weapons = register_cvar("kz_other_weapons","1")
  423. kz_drop_weapons = register_cvar("kz_drop_weapons", "0")
  424. kz_remove_drops = register_cvar("kz_remove_drops", "1")
  425. kz_pick_weapons = register_cvar("kz_pick_weapons", "0")
  426. kz_reload_weapons = register_cvar("kz_reload_weapons", "0")
  427. kz_maxspeedmsg = register_cvar("kz_maxspeedmsg","1")
  428. kz_hook_prize = register_cvar("kz_hook_prize","1")
  429. kz_hook_sound = register_cvar("kz_hook_sound","1")
  430. kz_hook_speed = register_cvar("kz_hook_speed", "500.0")
  431. kz_use_radio = register_cvar("kz_use_radio", "0")
  432. kz_pause = register_cvar("kz_pause", "1")
  433. kz_noclip_pause = register_cvar("kz_noclip_pause", "1")
  434. kz_nvg = register_cvar("kz_nvg","1")
  435. kz_nvg_colors = register_cvar("kz_nvg_colors","5 0 255")
  436. kz_vip = register_cvar("kz_vip","1")
  437. kz_respawn_ct = register_cvar("kz_respawn_ct", "1")
  438. kz_semiclip = register_cvar("kz_semiclip", "1")
  439. kz_semiclip_transparency = register_cvar ("kz_semiclip_transparency", "85")
  440. kz_spec_saves = register_cvar("kz_spec_saves", "1")
  441. kz_save_autostart = register_cvar("kz_save_autostart", "1")
  442. kz_save_autoEnd = register_cvar("kz_save_autoEnd", "1")
  443. kz_top15_authid = register_cvar("kz_top15_authid", "0")
  444. kz_save_pos = register_cvar("kz_save_pos", "1")
  445. kz_save_pos_gochecks = register_cvar("kz_save_pos_gochecks", "1")
  446.  
  447. #if defined USE_SQL
  448. kz_sql_host = register_cvar("kz_sql_host", "") // Host of DB
  449. kz_sql_user = register_cvar("kz_sql_user", "") // Username of DB
  450. kz_sql_pass = register_cvar("kz_sql_pass", "", FCVAR_PROTECTED) // Password for DB user
  451. kz_sql_db = register_cvar("kz_sql_db", "") // DB Name for the top 15
  452. kz_sql_name = register_cvar("kz_sql_server", "") // Name of server
  453. kz_sql_files = register_cvar("kz_sql_files", "") // Path of the PHP files
  454. #endif
  455.  
  456. register_clcmd("/cp","CheckPoint")
  457. register_clcmd("drop", "BlockDrop")
  458. register_clcmd("/gc", "GoCheck")
  459. register_clcmd("+hook","hook_on",KZ_LEVEL)
  460. register_clcmd("-hook","hook_off",KZ_LEVEL)
  461. register_concmd("kz_hook","give_hook", KZ_LEVEL, "<name|#userid|steamid|@ALL> <on/off>")
  462. register_concmd("nightvision","ToggleNVG")
  463. register_clcmd("radio1", "BlockRadio")
  464. register_clcmd("radio2", "BlockRadio")
  465. register_clcmd("radio3", "BlockRadio")
  466. register_clcmd("/tp","GoCheck")
  467. register_clcmd("chooseteam", "kz_menu")
  468.  
  469. kz_register_saycmd("cp","CheckPoint",0)
  470. kz_register_saycmd("chatorhud", "ChatHud", 0)
  471. kz_register_saycmd("ct","ct",0)
  472. kz_register_saycmd("end", "goEnd", 0)
  473. kz_register_saycmd("gc", "GoCheck",0)
  474. kz_register_saycmd("gocheck", "GoCheck",0)
  475. kz_register_saycmd("god", "GodMode",0)
  476. kz_register_saycmd("godmode", "GodMode", 0)
  477. kz_register_saycmd("invis", "InvisMenu", 0)
  478. kz_register_saycmd("kz", "kz_menu", 0)
  479. kz_register_saycmd("menu","kz_menu", 0)
  480. kz_register_saycmd("nc", "noclip", 0)
  481. kz_register_saycmd("noclip", "noclip", 0)
  482. kz_register_saycmd("noob10", "NoobTop_show", 0)
  483. kz_register_saycmd("noob15", "NoobTop_show", 0)
  484. kz_register_saycmd("nub10", "NoobTop_show", 0)
  485. kz_register_saycmd("nub15", "NoobTop_show", 0)
  486. kz_register_saycmd("pause", "Pause", 0)
  487. kz_register_saycmd("pinvis", "cmdInvisible", 0)
  488. kz_register_saycmd("pro10", "ProTop_show", 0)
  489. kz_register_saycmd("pro15", "ProTop_show", 0)
  490. kz_register_saycmd("reset", "reset_checkpoints", 0)
  491. kz_register_saycmd("respawn", "goStart", 0)
  492. kz_register_saycmd("savepos", "SavePos", 0)
  493. kz_register_saycmd("scout", "cmdScout", 0)
  494. kz_register_saycmd("setend", "setEnd", KZ_LEVEL)
  495. kz_register_saycmd("setstart", "setStart", KZ_LEVEL)
  496. kz_register_saycmd("showtimer", "ShowTimer_Menu", 0)
  497. kz_register_saycmd("spec", "ct", 0)
  498. kz_register_saycmd("start", "goStart", 0)
  499. kz_register_saycmd("stuck", "Stuck", 0)
  500. kz_register_saycmd("teleport", "GoCheck", 0)
  501. kz_register_saycmd("timer", "ShowTimer_Menu", 0)
  502. kz_register_saycmd("top15", "top15menu",0)
  503. kz_register_saycmd("top10", "top15menu",0)
  504. kz_register_saycmd("tp", "GoCheck",0)
  505. kz_register_saycmd("usp", "cmdUsp", 0)
  506. kz_register_saycmd("weapons", "weapons", 0)
  507. kz_register_saycmd("guns", "weapons", 0)
  508. kz_register_saycmd("winvis", "cmdWaterInvisible", 0)
  509. kz_register_saycmd("showkeys", "cmdShowKey", 0)
  510. kz_register_saycmd("givehook", "set_hook", KZ_LEVEL)
  511. kz_register_saycmd("mystart", "customStart", 0)
  512.  
  513. #if defined USE_SQL
  514. kz_register_saycmd("prorecords", "ProRecs_show", 0)
  515. kz_register_saycmd("prorecs", "ProRecs_show", 0)
  516. #endif
  517.  
  518. register_event("CurWeapon", "curweapon", "be", "1=1")
  519. register_event( "StatusValue", "EventStatusValue", "b", "1>0", "2>0" );
  520.  
  521. register_forward(FM_AddToFullPack, "FM_client_AddToFullPack_Post", 1)
  522.  
  523. RegisterHam( Ham_Player_PreThink, "player", "Ham_CBasePlayer_PreThink_Post", 1)
  524. RegisterHam( Ham_Use, "func_button", "fwdUse", 0)
  525. RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1)
  526. RegisterHam( Ham_Touch, "weaponbox", "FwdSpawnWeaponbox" )
  527. RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", 1 )
  528. RegisterHam( Ham_Touch, "weaponbox", "GroundWeapon_Touch")
  529.  
  530. register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib" )
  531. register_dictionary("prokreedz.txt")
  532. get_pcvar_string(kz_chat_prefix, prefix, 32)
  533. get_mapname(MapName, 63)
  534. set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
  535. set_task(0.1,"timer_task",2000,"",0,"ab")
  536. #if defined USE_SQL
  537. set_task(0.2, "plugin_sql")
  538. #endif
  539.  
  540. new kreedz_cfg[128], ConfigDir[64]
  541. get_configsdir( ConfigDir, 64)
  542. formatex(Kzdir,128, "%s/kz", ConfigDir)
  543. if( !dir_exists(Kzdir) )
  544. mkdir(Kzdir)
  545.  
  546. #if !defined USE_SQL
  547. formatex(Topdir,128, "%s/top15", Kzdir)
  548. if( !dir_exists(Topdir) )
  549. mkdir(Topdir)
  550. #endif
  551.  
  552. formatex(SavePosDir, 128, "%s/savepos", Kzdir)
  553. if( !dir_exists(SavePosDir) )
  554. mkdir(SavePosDir)
  555.  
  556. formatex(kreedz_cfg,128,"%s/kreedz.cfg", Kzdir)
  557.  
  558. if( file_exists( kreedz_cfg ) )
  559. {
  560. server_exec()
  561. server_cmd("exec %s",kreedz_cfg)
  562. }
  563.  
  564. for(new i = 0; i < sizeof(g_block_commands) ; i++)
  565. register_clcmd(g_block_commands[i], "BlockBuy")
  566.  
  567. g_tStarts = TrieCreate( )
  568. g_tStops = TrieCreate( )
  569.  
  570. new const szStarts[ ][ ] =
  571. {
  572. "counter_start", "clockstartbutton", "firsttimerelay", "but_start", "counter_start_button",
  573. "multi_start", "timer_startbutton", "start_timer_emi", "gogogo"
  574. }
  575.  
  576. new const szStops[ ][ ] =
  577. {
  578. "counter_off", "clockstopbutton", "clockstop", "but_stop", "counter_stop_button",
  579. "multi_stop", "stop_counter", "m_counter_end_emi"
  580. }
  581.  
  582. for( new i = 0; i < sizeof szStarts; i++ )
  583. TrieSetCell( g_tStarts, szStarts[ i ], 1 )
  584.  
  585. for( new i = 0; i < sizeof szStops; i++ )
  586. TrieSetCell( g_tStops, szStops[ i ], 1 )
  587. }
  588.  
  589. #if defined USE_SQL
  590. public plugin_sql()
  591. {
  592. new host[64], user[64], pass[64], db[64]
  593.  
  594. get_pcvar_string(kz_sql_host, host, 63)
  595. get_pcvar_string(kz_sql_user, user, 63)
  596. get_pcvar_string(kz_sql_pass, pass, 63)
  597. get_pcvar_string(kz_sql_db, db, 63)
  598.  
  599. g_SqlTuple = SQL_MakeDbTuple(host, user, pass, db)
  600.  
  601. new ErrorCode
  602. SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
  603.  
  604. if(!SqlConnection)
  605. {
  606. server_print("[KZ-Arg] TOP15 SQL: Could not connect to SQL database.!")
  607. log_amx("[KZ-Arg] TOP15 SQL: Could not connect to SQL database.")
  608. return pause("a")
  609. }
  610.  
  611. new createinto[1001]
  612. formatex(createinto, 1000, "CREATE TABLE IF NOT EXISTS `kz_pro15` (`mapname` varchar(64) NOT NULL, `authid` varchar(64) NOT NULL, `countty` 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)")
  613. SQL_ThreadQuery(g_SqlTuple,"QueryHandle", createinto)
  614. formatex(createinto, 1000, "CREATE TABLE IF NOT EXISTS `kz_nub15` (`mapname` varchar(64) NOT NULL, `authid` varchar(64) NOT NULL, `countty` 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)")
  615. SQL_ThreadQuery(g_SqlTuple,"QueryHandle", createinto)
  616.  
  617. return PLUGIN_CONTINUE
  618. }
  619.  
  620. public QueryHandle(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
  621. {
  622. if( iFailState != TQUERY_SUCCESS )
  623. {
  624. log_amx("[KZ-Arg] TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
  625. ColorChat(0, GREEN, "[KZ-Arg]^x01: Warning the SQL Tops can not be saved.")
  626. }
  627.  
  628. server_print("[KZ-Arg] Server Sending Info to SQL Server")
  629.  
  630. return PLUGIN_CONTINUE
  631. }
  632. #endif
  633.  
  634. public plugin_precache()
  635. {
  636. hud_message = CreateHudSyncObj()
  637. RegisterHam( Ham_Spawn, "func_door", "FwdHamDoorSpawn", 1 )
  638. precache_sound("weapons/xbow_hit2.wav")
  639. Sbeam = precache_model("sprites/laserbeam.spr")
  640. }
  641.  
  642. public plugin_cfg()
  643. {
  644. #if !defined USE_SQL
  645. for (new i = 0 ; i < 15; ++i)
  646. {
  647. Pro_Times[i] = 999999999.00000;
  648. Noob_Tiempos[i] = 999999999.00000;
  649. }
  650.  
  651. read_pro15()
  652. read_Noob15()
  653. #endif
  654.  
  655. new endcheck[100], dataa[256], mapp[64], xx[13], yx[13], zx[13];
  656. formatex(endcheck, 99, "%s/%s", Kzdir, KZ_ENDFILE)
  657. new fx = fopen(endcheck, "rt" )
  658. while( !feof( fx ) )
  659. {
  660. fgets( fx, dataa, sizeof dataa - 1 )
  661. parse( dataa, mapp, 63, xx, 12, yx, 12, zx, 12)
  662.  
  663. if( equali( mapp, MapName ) )
  664. {
  665. DefaultEndPos[0] = str_to_float(xx)
  666. DefaultEndPos[1] = str_to_float(yx)
  667. DefaultEndPos[2] = str_to_float(zx)
  668.  
  669. DefaultEnd = true
  670. break;
  671. }
  672. }
  673. fclose(fx)
  674.  
  675. new startcheck[100], data[256], map[64], x[13], y[13], z[13];
  676. formatex(startcheck, 99, "%s/%s", Kzdir, KZ_STARTFILE)
  677. new f = fopen(startcheck, "rt" )
  678. while( !feof( f ) )
  679. {
  680. fgets( f, data, sizeof data - 1 )
  681. parse( data, map, 63, x, 12, y, 12, z, 12)
  682.  
  683. if( equali( map, MapName ) )
  684. {
  685. DefaultStartPos[0] = str_to_float(x)
  686. DefaultStartPos[1] = str_to_float(y)
  687. DefaultStartPos[2] = str_to_float(z)
  688.  
  689. DefaultStart = true
  690. break;
  691. }
  692. }
  693. fclose(f)
  694.  
  695. new ent = -1;
  696. while( ( ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_water") ) != 0 )
  697. {
  698. if( !gWaterFound )
  699. {
  700. gWaterFound = true;
  701. }
  702.  
  703. gWaterEntity[ent] = true;
  704. }
  705.  
  706. ent = -1;
  707. while( ( ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_illusionary") ) != 0 )
  708. {
  709. if( pev( ent, pev_skin ) == CONTENTS_WATER )
  710. {
  711. if( !gWaterFound )
  712. {
  713. gWaterFound = true;
  714. }
  715.  
  716. gWaterEntity[ent] = true;
  717. }
  718. }
  719.  
  720. ent = -1;
  721. while( ( ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_conveyor") ) != 0 )
  722. {
  723. if( pev( ent, pev_spawnflags ) == 3 )
  724. {
  725. if( !gWaterFound )
  726. {
  727. gWaterFound = true;
  728. }
  729.  
  730. gWaterEntity[ent] = true;
  731. }
  732. }
  733. }
  734.  
  735. public client_command(id)
  736. {
  737.  
  738. new sArg[13];
  739. if( read_argv(0, sArg, 12) > 11 )
  740. {
  741. return PLUGIN_CONTINUE;
  742. }
  743.  
  744. for( new i = 0; i < sizeof(g_weaponsnames); i++ )
  745. {
  746. if( equali(g_weaponsnames[i], sArg, 0) )
  747. {
  748. return PLUGIN_HANDLED;
  749. }
  750. }
  751. return PLUGIN_CONTINUE;
  752. }
  753.  
  754. // =================================================================================================
  755. // Global Functions
  756. // =================================================================================================
  757.  
  758. public Pause(id)
  759. {
  760.  
  761. if (get_pcvar_num(kz_pause) == 0)
  762. {
  763. kz_chat(id, "%L", id, "KZ_PAUSE_DISABLED")
  764.  
  765. return PLUGIN_HANDLED
  766. }
  767.  
  768. if(! is_user_alive(id) )
  769. {
  770. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  771.  
  772. return PLUGIN_HANDLED
  773. }
  774.  
  775.  
  776. if(!IsPaused[id])
  777. {
  778. if(! timer_started[id])
  779. {
  780. kz_chat(id, "%L", id, "KZ_TIMER_NOT_STARTED")
  781. return PLUGIN_HANDLED
  782. }
  783.  
  784. g_pausetime[id] = get_gametime() - timer_time[id]
  785. timer_time[id] = 0.0
  786. IsPaused[id] = true
  787. kz_chat(id, "%L", id, "KZ_PAUSE_ON")
  788. set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN)
  789. pev(id, pev_origin, PauseOrigin[id])
  790.  
  791. }
  792. else
  793. {
  794. if(timer_started[id])
  795. {
  796. kz_chat(id, "%L", id, "KZ_PAUSE_OFF")
  797. if(get_user_noclip(id))
  798. noclip(id)
  799. timer_time[id] = get_gametime() - g_pausetime[id]
  800. }
  801. IsPaused[id] = false
  802. set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
  803. }
  804.  
  805. return PLUGIN_HANDLED
  806. }
  807.  
  808. public timer_task()
  809. {
  810. if ( get_pcvar_num(kz_show_timer) > 0 )
  811. {
  812. new Alive[32], Dead[32], alivePlayers, deadPlayers;
  813. get_players(Alive, alivePlayers, "ach")
  814. get_players(Dead, deadPlayers, "bch")
  815. for(new i=0;i<alivePlayers;i++)
  816. {
  817. if( timer_started[Alive[i]])
  818. {
  819. new Float:kreedztime = get_gametime() - (IsPaused[Alive[i]] ? get_gametime() - g_pausetime[Alive[i]] : timer_time[Alive[i]])
  820.  
  821. if( ShowTime[Alive[i]] == 1 )
  822. {
  823. new colors[12], r[4], g[4], b[4];
  824. new imin = floatround(kreedztime / 60.0,floatround_floor)
  825. new isec = floatround(kreedztime - imin * 60.0,floatround_floor)
  826. new ims = floatround( ( kreedztime - ( imin * 60.0 + isec ) ) * 100.0, floatround_floor )
  827. get_pcvar_string(kz_hud_color, colors, 11)
  828. parse(colors, r, 255, g, 255, b, 255)
  829.  
  830. set_hudmessage(str_to_num(r), str_to_num(g), str_to_num(b), -1.0, 0.02, 0, 0.0, 1.0, 0.0, 0.0, 1)
  831. show_hudmessage(Alive[i], "[ %02d:%02d.%02d ] %s",imin, isec, ims, IsPaused[Alive[i]] ? "" : "")
  832. }
  833. else
  834. if( ShowTime[Alive[i]] == 2 )
  835. {
  836. kz_showtime_roundtime(Alive[i], floatround(kreedztime))
  837. }
  838. }
  839.  
  840. }
  841. for(new i=0;i<deadPlayers;i++)
  842. {
  843. new specmode = pev(Dead[i], pev_iuser1)
  844. if(specmode == 2 || specmode == 4)
  845. {
  846. new target = pev(Dead[i], pev_iuser2)
  847. if(target != Dead[i])
  848. if(is_user_alive(target) && timer_started[target])
  849. {
  850. new name[32], colors[12], r[4], g[4], b[4];
  851. get_user_name (target, name, 31)
  852.  
  853. new Float:kreedztime = get_gametime() - (IsPaused[target] ? get_gametime() - g_pausetime[target] : timer_time[target])
  854. new imin = floatround(kreedztime / 60.0,floatround_floor)
  855. new isec = floatround(kreedztime - imin * 60.0,floatround_floor)
  856. new ims = floatround( ( kreedztime - ( imin * 60.0 + isec ) ) * 100.0, floatround_floor )
  857.  
  858. get_pcvar_string(kz_hud_color, colors, 11)
  859. parse(colors, r, 3, g, 3, b, 4)
  860.  
  861. set_hudmessage(str_to_num(r), str_to_num(g), str_to_num(b), -1.0, 0.17, 0, 0.0, 1.0, 0.0, 0.0, 1)
  862. show_hudmessage(Dead[i], "%02d:%02d.%02d CPs: %d GCs: %d %s",imin, isec, ims, checknumbers[target], gochecknumbers[target], IsPaused[target] ? "Paused" : "")
  863. }
  864. }
  865. }
  866. }
  867. }
  868.  
  869. // ============================ Block Commands ================================
  870.  
  871.  
  872. public BlockRadio(id)
  873. {
  874. if (get_pcvar_num(kz_use_radio) == 1)
  875. return PLUGIN_CONTINUE
  876. return PLUGIN_HANDLED
  877. }
  878.  
  879. public BlockDrop(id)
  880. {
  881. if (get_pcvar_num(kz_drop_weapons) == 1)
  882. return PLUGIN_CONTINUE
  883. return PLUGIN_HANDLED
  884. }
  885.  
  886. public BlockBuy(id)
  887. {
  888. return PLUGIN_HANDLED
  889. }
  890.  
  891. public CmdRespawn(id)
  892. {
  893. if ( get_user_team(id) == 3 )
  894. return PLUGIN_HANDLED
  895. else
  896. ExecuteHamB(Ham_CS_RoundRespawn, id)
  897.  
  898. return PLUGIN_HANDLED
  899. }
  900.  
  901. public ChatHud(id)
  902. {
  903. if(get_pcvar_num(kz_chatorhud) == 0)
  904. {
  905. ColorChat(id, GREEN, "%s^x01 %L", id, "KZ_CHECKPOINT_OFF", prefix)
  906. return PLUGIN_HANDLED
  907. }
  908. if(chatorhud[id] == -1)
  909. ++chatorhud[id];
  910.  
  911. ++chatorhud[id];
  912.  
  913. if(chatorhud[id] == 3)
  914. chatorhud[id] = 0;
  915. else
  916. kz_chat(id, "%L", id, "KZ_CHATORHUD", chatorhud[id] == 1 ? "Chat" : "HUD")
  917.  
  918. return PLUGIN_HANDLED
  919. }
  920.  
  921. public ct(id)
  922. {
  923. new CsTeams:team = cs_get_user_team(id)
  924. if (team == CS_TEAM_CT)
  925. {
  926. if( !( pev( id, pev_flags ) & FL_ONGROUND2 ) && timer_started[id] )
  927. return PLUGIN_HANDLED
  928.  
  929. if (get_pcvar_num(kz_spec_saves) == 1)
  930. {
  931. pev(id, pev_origin, SpecLoc[id])
  932.  
  933. if ( timer_started[id] )
  934. {
  935. if ( IsPaused[id] )
  936. {
  937. Pause(id)
  938. WasPaused[id]=true
  939. }
  940.  
  941. g_pausetime[id] = get_gametime() - timer_time[id]
  942. timer_time[id] = 0.0
  943. kz_chat(id, "%L", id, "KZ_PAUSE_ON")
  944. }
  945. }
  946.  
  947. if(gViewInvisible[id])
  948. gViewInvisible[id] = false
  949.  
  950. cs_set_user_team(id,CS_TEAM_SPECTATOR)
  951. set_pev(id, pev_solid, SOLID_NOT)
  952. set_pev(id, pev_movetype, MOVETYPE_FLY)
  953. set_pev(id, pev_effects, EF_NODRAW)
  954. set_pev(id, pev_deadflag, DEAD_DEAD)
  955. }
  956. else
  957. {
  958. cs_set_user_team(id,CS_TEAM_CT)
  959. set_pev(id, pev_effects, 0)
  960. set_pev(id, pev_movetype, MOVETYPE_WALK)
  961. set_pev(id, pev_deadflag, DEAD_NO)
  962. set_pev(id, pev_takedamage, DAMAGE_AIM)
  963. CmdRespawn(id)
  964. give_item(id,"weapon_knife")
  965. give_item(id,"weapon_usp")
  966. cs_set_user_bpammo(id, CSW_USP, 36)
  967.  
  968. if (get_pcvar_num(kz_spec_saves) == 1)
  969. {
  970. set_pev(id, pev_origin, SpecLoc[id])
  971. if ( timer_started [id] )
  972. timer_time[id] = get_gametime() - g_pausetime[id] + timer_time[id]
  973. if( WasPaused[id] )
  974. {
  975. Pause(id)
  976. WasPaused[id]=false
  977. }
  978. }
  979. }
  980. return PLUGIN_HANDLED
  981. }
  982.  
  983.  
  984. //=================== Weapons ==============
  985. public curweapon(id)
  986. {
  987. /*
  988. if(get_pcvar_num(kz_maxspeedmsg) == 1 && is_user_alive(id))
  989. {
  990. new clip, ammo, speed,
  991. switch(get_user_weapon(id,clip,ammo))
  992. {
  993. case CSW_SCOUT: speed = 260
  994. 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
  995. case CSW_P90: speed = 245
  996. case CSW_XM1014, CSW_AUG, CSW_GALIL, CSW_FAMAS: speed = 240
  997. case CSW_SG552: speed = 235
  998. case CSW_M3, CSW_M4A1: speed= 230
  999. case CSW_AK47: speed = 221
  1000. case CSW_M249: speed = 220
  1001. case CSW_G3SG1, CSW_SG550, CSW_AWP: speed = 210
  1002. }
  1003. kz_hud_message(id,"%L",id, "KZ_WEAPONS_SPEED",speed)
  1004. }
  1005. */
  1006. static last_weapon[33];
  1007. static weapon_active, weapon_num
  1008. weapon_active = read_data(1)
  1009. weapon_num = read_data(2)
  1010.  
  1011. if( ( weapon_num != last_weapon[id] ) && weapon_active && get_pcvar_num(kz_maxspeedmsg) == 1)
  1012. {
  1013. last_weapon[id] = weapon_num;
  1014.  
  1015. static Float:maxspeed;
  1016. pev(id, pev_maxspeed, maxspeed );
  1017.  
  1018. if( maxspeed < 0.0 )
  1019. maxspeed = 250.0;
  1020.  
  1021. kz_hud_message(id,"%L",id, "KZ_WEAPONS_SPEED",floatround( maxspeed, floatround_floor ));
  1022. }
  1023. return PLUGIN_HANDLED
  1024. }
  1025.  
  1026. public weapons(id)
  1027. {
  1028. if(!is_user_alive(id))
  1029. {
  1030. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  1031. return PLUGIN_HANDLED
  1032. }
  1033.  
  1034. if(get_pcvar_num(kz_other_weapons) == 0)
  1035. {
  1036. kz_chat(id, "%L", id, "KZ_OTHER_WEAPONS_ZERO")
  1037. return PLUGIN_HANDLED
  1038. }
  1039.  
  1040. if (timer_started[id])
  1041. {
  1042. kz_chat(id, "%L", id, "KZ_WEAPONS_IN_RUN")
  1043. return PLUGIN_HANDLED
  1044. }
  1045.  
  1046. for(new i = 0; i < 8; i++)
  1047. if( !user_has_weapon(id, other_weapons[i]) )
  1048. {
  1049. new item;
  1050. item = give_item(id, other_weapons_name[i] );
  1051. cs_set_weapon_ammo(item, 0);
  1052. }
  1053.  
  1054. if( !user_has_weapon(id, CSW_USP) )
  1055. cmdUsp(id)
  1056.  
  1057. return PLUGIN_HANDLED
  1058. }
  1059.  
  1060.  
  1061. // ========================= Scout =======================
  1062. public cmdScout(id)
  1063. {
  1064. if (timer_started[id])
  1065. user_has_scout[id] = true
  1066.  
  1067. strip_user_weapons(id)
  1068. give_item(id,"weapon_usp")
  1069. give_item(id,"weapon_knife")
  1070. if( !user_has_weapon(id, CSW_SCOUT))
  1071. give_item(id,"weapon_scout")
  1072.  
  1073. return PLUGIN_HANDLED
  1074. }
  1075.  
  1076. public cmdUsp(id)
  1077. {
  1078. give_item(id,"weapon_usp")
  1079. give_item(id,"weapon_knife")
  1080.  
  1081. return PLUGIN_HANDLED
  1082. }
  1083.  
  1084. // ========================== Show Keys ================
  1085. public cmdShowKey(id)
  1086. {
  1087. g_showkey[id] = !g_showkey[id]
  1088.  
  1089. if (g_showkey[id])
  1090. set_task(0.1, "playersecondtask", id+TASK_ID_MINISECOND, _, _, "b");
  1091. else
  1092. remove_task(id+TASK_ID_MINISECOND);
  1093.  
  1094. kz_chat(id, "%L", id, "KZ_SHOWKEYS", g_showkey[id] == 1 ? "has been enabled." : "has been disabled.");
  1095.  
  1096. return PLUGIN_HANDLED
  1097. }
  1098.  
  1099. public playersecondtask(id)
  1100. {
  1101. id -= TASK_ID_MINISECOND
  1102.  
  1103. if( !is_user_alive(id) && g_showkey[id])
  1104. {
  1105. new mode = pev(id, pev_iuser1)
  1106. if( mode == 2 || mode == 4 )
  1107. {
  1108. new target = pev(id, pev_iuser2)
  1109. g_idspecting[1][id] = target
  1110. g_idspecting[0][id] = true
  1111.  
  1112. if (g_showkey[id])
  1113. {
  1114. new target = pev(id, pev_iuser2)
  1115.  
  1116. new button = pev(target, pev_button)
  1117.  
  1118. // Credit of this --> cheap_suit
  1119. static key[6][6]
  1120. formatex(key[0], 5, "%s", (button & IN_FORWARD) && !(button & IN_BACK) ? " W " : " ")
  1121. formatex(key[1], 5, "%s", (button & IN_BACK) && !(button & IN_FORWARD) ? " S " : " ")
  1122. formatex(key[2], 5, "%s", (button & IN_MOVELEFT) && !(button & IN_MOVERIGHT) ? "A " : " ")
  1123. formatex(key[3], 5, "%s", (button & IN_MOVERIGHT) && !(button & IN_MOVELEFT) ? " D" : " ")
  1124. formatex(key[4], 5, "%s", (button & IN_DUCK) ? " DUCK " : " ")
  1125. formatex(key[5], 5, "%s", (button & IN_JUMP) ? " JUMP " : " ")
  1126.  
  1127. kz_hud_center(id, "%s^n%s %s^n%s^n%s^n%s", key[0], key[2], key[3], key[1], key[5], key[4])
  1128. }
  1129. }
  1130. else
  1131. {
  1132. g_idspecting[0][id] = false
  1133. }
  1134. }
  1135. return PLUGIN_CONTINUE
  1136. }
  1137.  
  1138. stock kz_hud_center(id, const message[], {Float,Sql,Result,_}:...)
  1139. {
  1140. static msg[192];
  1141. vformat(msg, 191, message, 3);
  1142.  
  1143. set_hudmessage(255, 255, 255, -1.0, 0.46, 0, _, 0.1, _, _, -1)
  1144. ShowSyncHudMsg(id, g_hud_center, msg);
  1145. }
  1146.  
  1147. // ========================== End location =================
  1148.  
  1149. public goEnd(id)
  1150. {
  1151. if(timer_started[id])
  1152. {
  1153. goend_menu(id)
  1154. return PLUGIN_HANDLED
  1155. }
  1156. if(!timer_started[id])
  1157. {
  1158. kz_menu(id)
  1159. }
  1160. if( !is_user_alive( id ) )
  1161. {
  1162. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  1163. return PLUGIN_HANDLED
  1164. }
  1165.  
  1166. if (IsPaused[id])
  1167. {
  1168. kz_chat(id, "%L", id, "KZ_TELEPORT_PAUSE")
  1169. return PLUGIN_HANDLED
  1170. }
  1171.  
  1172. if(get_pcvar_num(kz_save_autoEnd) == 1 && AutoEnd [id] )
  1173. {
  1174. set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
  1175. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
  1176. set_pev(id, pev_origin, SavedEnd [id] )
  1177.  
  1178. kz_chat(id, "%L", id, "KZ_END")
  1179. }
  1180. else if ( DefaultEnd )
  1181. {
  1182. set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
  1183. set_pev(id, pev_origin, DefaultEndPos)
  1184.  
  1185. kz_chat(id, "%L", id, "KZ_END")
  1186. }
  1187. else
  1188. {
  1189. kz_chat(id, "%L", id, "KZ_NO_END")
  1190.  
  1191. CmdRespawn(id)
  1192. }
  1193.  
  1194. return PLUGIN_HANDLED
  1195. }
  1196.  
  1197. public setEnd(id)
  1198. {
  1199. if (! (get_user_flags( id ) & KZ_LEVEL ))
  1200. {
  1201. kz_chat(id, "%L", id, "KZ_NO_ACCESS")
  1202. return PLUGIN_HANDLED
  1203. }
  1204.  
  1205. new Float:origin[3]
  1206. pev(id, pev_origin, origin)
  1207. kz_set_End(MapName, origin)
  1208. AutoEnd[id] = false;
  1209. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SET_END")
  1210.  
  1211. return PLUGIN_HANDLED
  1212. }
  1213.  
  1214. // =================================================================================================
  1215.  
  1216. stock kz_set_End(const map[], Float:origin[3])
  1217. {
  1218. new realfile[128], tempfile[128], formatorigin[50]
  1219. formatex(realfile, 127, "%s/%s", Kzdir, KZ_ENDFILE)
  1220. formatex(tempfile, 127, "%s/%s", Kzdir, KZ_ENDFILE_TEMP)
  1221. formatex(formatorigin, 49, "%f %f %f", origin[0], origin[1], origin[2])
  1222.  
  1223. DefaultEndPos = origin
  1224. DefaultEnd = true
  1225.  
  1226. new file = fopen(tempfile, "wt")
  1227. new vault = fopen(realfile, "rt")
  1228.  
  1229. new data[128], key[64]
  1230. new bool:replaced = false
  1231.  
  1232. while( !feof(vault) )
  1233. {
  1234. fgets(vault, data, 127)
  1235. parse(data, key, 63)
  1236.  
  1237. if( equal(key, map) && !replaced )
  1238. {
  1239. fprintf(file, "%s %s^n", map, formatorigin)
  1240.  
  1241. replaced = true
  1242. }
  1243. else
  1244. {
  1245. fputs(file, data)
  1246. }
  1247. }
  1248.  
  1249. if( !replaced )
  1250. {
  1251. fprintf(file, "%s %s^n", map, formatorigin)
  1252. }
  1253.  
  1254. fclose(file)
  1255. fclose(vault)
  1256.  
  1257. delete_file(realfile)
  1258. while( !rename_file(tempfile, realfile, 1) ) {}
  1259. }
  1260.  
  1261.  
  1262. // ========================== Start location =================
  1263.  
  1264. public goStart(id)
  1265. {
  1266. if( !is_user_alive( id ) )
  1267. {
  1268. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  1269. return PLUGIN_HANDLED
  1270. }
  1271.  
  1272. if (IsPaused[id])
  1273. {
  1274. kz_chat(id, "%L", id, "KZ_TELEPORT_PAUSE")
  1275. return PLUGIN_HANDLED
  1276. }
  1277.  
  1278. if (MyStart[id])
  1279. {
  1280. timer_started[id] = false
  1281.  
  1282. if(IsPaused[id])
  1283. {
  1284. set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
  1285. IsPaused[id] = false
  1286. }
  1287.  
  1288. if (get_pcvar_num(kz_show_timer) > 0 && ShowTime[id] == 2)
  1289. kz_showtime_roundtime(id, 0)
  1290.  
  1291. set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
  1292. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
  1293. set_pev(id, pev_origin, MyStartPos [id] )
  1294.  
  1295. kz_chat(id, "%L", id, "KZ_START")
  1296. }
  1297.  
  1298. else if(get_pcvar_num(kz_save_autostart) == 1 && AutoStart [id] )
  1299. {
  1300. set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
  1301. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
  1302. set_pev(id, pev_origin, SavedStart [id] )
  1303.  
  1304. kz_chat(id, "%L", id, "KZ_START")
  1305. }
  1306. else if ( DefaultStart )
  1307. {
  1308. set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
  1309. set_pev(id, pev_origin, DefaultStartPos)
  1310.  
  1311. kz_chat(id, "%L", id, "KZ_START")
  1312. }
  1313. else
  1314. {
  1315. kz_chat(id, "%L", id, "KZ_NO_START")
  1316.  
  1317. CmdRespawn(id)
  1318. }
  1319.  
  1320. return PLUGIN_HANDLED
  1321. }
  1322.  
  1323. public setStart(id)
  1324. {
  1325. if (! (get_user_flags( id ) & KZ_LEVEL ))
  1326. {
  1327. kz_chat(id, "%L", id, "KZ_NO_ACCESS")
  1328. return PLUGIN_HANDLED
  1329. }
  1330.  
  1331. new Float:origin[3]
  1332. pev(id, pev_origin, origin)
  1333. kz_set_start(MapName, origin)
  1334. AutoStart[id] = false;
  1335. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SET_START")
  1336.  
  1337. return PLUGIN_HANDLED
  1338. }
  1339.  
  1340. // ========= Respawn CT if dies ========
  1341.  
  1342. public Ham_CBasePlayer_Killed_Post(id)
  1343. {
  1344. if(get_pcvar_num(kz_respawn_ct) == 1)
  1345. {
  1346. if( cs_get_user_team(id) == CS_TEAM_CT )
  1347. {
  1348. set_pev(id, pev_deadflag, DEAD_RESPAWNABLE)
  1349. cs_set_user_deaths(id, 0)
  1350. set_user_frags(id, 0)
  1351. }
  1352. }
  1353. }
  1354.  
  1355.  
  1356. // ============================= NightVision ================================================
  1357.  
  1358. public ToggleNVG(id)
  1359. {
  1360.  
  1361. if( get_pcvar_num(kz_nvg) == 0 || !is_user_alive(id))
  1362. return PLUGIN_CONTINUE;
  1363.  
  1364. if ( NightVisionUse[id] )
  1365. StopNVG(id)
  1366. else
  1367. StartNVG(id)
  1368.  
  1369. return PLUGIN_HANDLED
  1370. }
  1371.  
  1372. public StartNVG(id)
  1373. {
  1374. emit_sound(id,CHAN_ITEM,"items/nvg_on.wav",1.0,ATTN_NORM,0,PITCH_NORM)
  1375. set_task(0.1,"RunNVG",id+111111,_,_,"b")
  1376. NightVisionUse[id] = true;
  1377.  
  1378. return PLUGIN_HANDLED
  1379. }
  1380.  
  1381. public StopNVG(id)
  1382. {
  1383. emit_sound(id,CHAN_ITEM,"items/nvg_off.wav",1.0,ATTN_NORM,0,PITCH_NORM)
  1384. remove_task(id+111111)
  1385. NightVisionUse[id] = false;
  1386.  
  1387. return PLUGIN_HANDLED
  1388. }
  1389.  
  1390.  
  1391. public RunNVG(taskid)
  1392. {
  1393. new id = taskid - 111111
  1394.  
  1395. if (!is_user_alive(id)) return
  1396.  
  1397. new origin[3]
  1398. get_user_origin(id,origin,3)
  1399.  
  1400. new color[17];
  1401. get_pcvar_string(kz_nvg_colors,color,16);
  1402.  
  1403. new iRed[5], iGreen[7], iBlue[5]
  1404. parse(color,iRed,4,iGreen ,6,iBlue,4)
  1405.  
  1406. message_begin(MSG, SVC_TEMPENTITY, _, id)
  1407. write_byte(TE_DLIGHT)
  1408. write_coord(origin[0])
  1409. write_coord(origin[1])
  1410. write_coord(origin[2])
  1411. write_byte(80)
  1412. write_byte(str_to_num(iRed))
  1413. write_byte(str_to_num(iGreen))
  1414. write_byte(str_to_num(iBlue))
  1415. write_byte(2)
  1416. write_byte(0)
  1417. message_end()
  1418. }
  1419.  
  1420. // ============================ Hook ==============================================================
  1421.  
  1422. public give_hook(id)
  1423. {
  1424. if (!( get_user_flags( id ) & KZ_LEVEL ))
  1425. return PLUGIN_HANDLED
  1426.  
  1427. new szarg1[32], szarg2[8], bool:mode
  1428. read_argv(1,szarg1,32)
  1429. read_argv(2,szarg2,32)
  1430. if(equal(szarg2,"on"))
  1431. mode = true
  1432.  
  1433. if(equal(szarg1,"@ALL"))
  1434. {
  1435. new Alive[32], alivePlayers
  1436. get_players(Alive, alivePlayers, "ach")
  1437. for(new i;i<alivePlayers;i++)
  1438. {
  1439. canusehook[i] = mode
  1440. if(mode)
  1441. ColorChat(i, GREEN, "%s^x01, %L", prefix, i, "KZ_HOOK")
  1442. }
  1443. }
  1444. else
  1445. {
  1446. new pid = find_player("bl",szarg1);
  1447. if(pid > 0)
  1448. {
  1449. canusehook[pid] = mode
  1450. if(mode)
  1451. {
  1452. ColorChat(pid, GREEN, "%s^x01 %L", prefix, pid, "KZ_HOOK")
  1453. }
  1454. }
  1455. }
  1456.  
  1457. return PLUGIN_HANDLED
  1458. }
  1459.  
  1460. public hook_on(id)
  1461. {
  1462. if( !canusehook[id] && !( get_user_flags( id ) & KZ_LEVEL ) || !is_user_alive(id) )
  1463. return PLUGIN_HANDLED
  1464.  
  1465. if (IsPaused[id])
  1466. {
  1467. kz_chat(id, "%L", id, "KZ_HOOK_PAUSE")
  1468. return PLUGIN_HANDLED
  1469. }
  1470.  
  1471. set_user_godmode(id, 1)
  1472.  
  1473. detect_cheat(id,"Hook")
  1474. get_user_origin(id,hookorigin[id],3)
  1475. ishooked[id] = true
  1476. antihookcheat[id] = get_gametime()
  1477.  
  1478. if (get_pcvar_num(kz_hook_sound) == 1)
  1479. emit_sound(id,CHAN_STATIC,"weapons/xbow_hit2.wav",1.0,ATTN_NORM,0,PITCH_NORM)
  1480.  
  1481. set_task(0.1,"hook_task",id,"",0,"ab")
  1482. hook_task(id)
  1483.  
  1484. return PLUGIN_HANDLED
  1485. }
  1486.  
  1487. public hook_off(id)
  1488. {
  1489. remove_hook(id)
  1490.  
  1491. return PLUGIN_HANDLED
  1492. }
  1493.  
  1494. public hook_task(id)
  1495. {
  1496. if(!is_user_connected(id) || !is_user_alive(id))
  1497. remove_hook(id)
  1498.  
  1499. remove_beam(id)
  1500. draw_hook(id)
  1501.  
  1502. new origin[3], Float:velocity[3]
  1503. get_user_origin(id,origin)
  1504. new distance = get_distance(hookorigin[id],origin)
  1505. velocity[0] = (hookorigin[id][0] - origin[0]) * (2.0 * get_pcvar_num(kz_hook_speed) / distance)
  1506. velocity[1] = (hookorigin[id][1] - origin[1]) * (2.0 * get_pcvar_num(kz_hook_speed) / distance)
  1507. velocity[2] = (hookorigin[id][2] - origin[2]) * (2.0 * get_pcvar_num(kz_hook_speed) / distance)
  1508.  
  1509. set_pev(id,pev_velocity,velocity)
  1510. }
  1511.  
  1512. public draw_hook(id)
  1513. {
  1514. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  1515. write_byte(1) // TE_BEAMENTPOINT
  1516. write_short(id) // entid
  1517. write_coord(hookorigin[id][0]) // origin
  1518. write_coord(hookorigin[id][1]) // origin
  1519. write_coord(hookorigin[id][2]) // origin
  1520. write_short(Sbeam) // sprite index
  1521. write_byte(0) // start frame
  1522. write_byte(0) // framerate
  1523. write_byte(random_num(1,100)) // life
  1524. write_byte(random_num(1,20)) // width
  1525. write_byte(random_num(1,0)) // noise
  1526. write_byte(random_num(1,255)) // r
  1527. write_byte(random_num(1,255)) // g
  1528. write_byte(random_num(1,255)) // b
  1529. write_byte(random_num(1,500)) // brightness
  1530. write_byte(random_num(1,200)) // speed
  1531. message_end()
  1532. }
  1533.  
  1534. public remove_hook(id)
  1535. {
  1536. if(task_exists(id))
  1537. remove_task(id)
  1538. remove_beam(id)
  1539. ishooked[id] = false
  1540. }
  1541.  
  1542. public remove_beam(id)
  1543. {
  1544. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  1545. write_byte(99) // TE_KILLBEAM
  1546. write_short(id)
  1547. message_end()
  1548. }
  1549.  
  1550.  
  1551. //============================ VIP In ScoreBoard =================================================
  1552.  
  1553. public MessageScoreAttrib( iMsgID, iDest, iReceiver )
  1554. {
  1555. if( get_pcvar_num(kz_vip) )
  1556. {
  1557. new iPlayer = get_msg_arg_int( 1 )
  1558. if( is_user_alive( iPlayer ) && ( get_user_flags( iPlayer ) & KZ_LEVEL ) )
  1559. {
  1560. set_msg_arg_int( 2, ARG_BYTE, SCOREATTRIB_VIP );
  1561. }
  1562. }
  1563. }
  1564.  
  1565. public EventStatusValue( const id )
  1566. {
  1567.  
  1568. new szMessage[ 34 ], Target, aux
  1569. get_user_aiming(id, Target, aux)
  1570. if (is_user_alive(Target))
  1571. {
  1572. formatex( szMessage, 33, "1 %s: %%p2", get_user_flags( Target ) & KZ_LEVEL ? "VIP" : "Player" )
  1573. message_begin( MSG, get_user_msgid( "StatusText" ) , _, id )
  1574. write_byte( 0 )
  1575. write_string( szMessage )
  1576. message_end( )
  1577. }
  1578. }
  1579.  
  1580. public detect_cheat(id,reason[])
  1581. {
  1582. if(timer_started[id] && get_pcvar_num(kz_cheatdetect) == 1)
  1583. {
  1584. timer_started[id] = false
  1585. if(IsPaused[id])
  1586. {
  1587. set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
  1588. IsPaused[id] = false
  1589. }
  1590. if (get_pcvar_num(kz_show_timer) > 0 && ShowTime[id] == 2)
  1591. kz_showtime_roundtime(id, 0)
  1592. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_CHEAT_DETECT", reason)
  1593. }
  1594. }
  1595.  
  1596. // =================================================================================================
  1597. // Cmds
  1598. // =================================================================================================
  1599.  
  1600. public CheckPoint(id)
  1601. {
  1602.  
  1603. if( !is_user_alive( id ) )
  1604. {
  1605. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  1606. return PLUGIN_HANDLED
  1607. }
  1608.  
  1609. if(get_pcvar_num(kz_checkpoints) == 0)
  1610. {
  1611. kz_chat(id, "%L", id, "KZ_CHECKPOINT_OFF")
  1612. return PLUGIN_HANDLED
  1613. }
  1614.  
  1615. if( !( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id))
  1616. {
  1617. kz_chat(id, "%L", id, "KZ_CHECKPOINT_AIR")
  1618. return PLUGIN_HANDLED
  1619. }
  1620.  
  1621. if( IsPaused[id] )
  1622. {
  1623. kz_chat(id, "%L", id, "KZ_CHECKPOINT_PAUSE")
  1624. return PLUGIN_HANDLED
  1625. }
  1626.  
  1627. pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id] ? 1 : 0])
  1628. g_bCpAlternate[id] = !g_bCpAlternate[id]
  1629. checknumbers[id]++
  1630.  
  1631. kz_chat(id, "%L", id, "KZ_CHECKPOINT", checknumbers[id])
  1632.  
  1633. return PLUGIN_HANDLED
  1634. }
  1635.  
  1636. public GoCheck(id)
  1637. {
  1638. if( !is_user_alive( id ) )
  1639. {
  1640. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  1641. return PLUGIN_HANDLED
  1642. }
  1643.  
  1644. if( checknumbers[id] == 0 )
  1645. {
  1646. kz_chat(id, "%L", id, "KZ_NOT_ENOUGH_CHECKPOINTS")
  1647. return PLUGIN_HANDLED
  1648. }
  1649.  
  1650. if( IsPaused[id] )
  1651. {
  1652. kz_chat(id, "%L", id, "KZ_TELEPORT_PAUSE")
  1653. return PLUGIN_HANDLED
  1654. }
  1655.  
  1656. set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} );
  1657. set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 } );
  1658. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
  1659. set_pev( id, pev_fuser2, 0.0 );
  1660. engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } );
  1661. set_pev(id, pev_origin, Checkpoints[ id ][ !g_bCpAlternate[id] ] )
  1662. gochecknumbers[id]++
  1663.  
  1664. kz_chat(id, "%L", id, "KZ_GOCHECK", gochecknumbers[id])
  1665.  
  1666. return PLUGIN_HANDLED
  1667. }
  1668.  
  1669. public Stuck(id)
  1670. {
  1671. if( !is_user_alive( id ) )
  1672. {
  1673. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  1674. return PLUGIN_HANDLED
  1675. }
  1676.  
  1677. if( checknumbers[id] < 2 )
  1678. {
  1679. kz_chat(id, "%L", id, "KZ_NOT_ENOUGH_CHECKPOINTS")
  1680. return PLUGIN_HANDLED
  1681. }
  1682.  
  1683. set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} )
  1684. set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 })
  1685. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
  1686. set_pev( id, pev_fuser2, 0.0 )
  1687. engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } )
  1688. set_pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id]] )
  1689. g_bCpAlternate[id] = !g_bCpAlternate[id];
  1690. gochecknumbers[id]++
  1691.  
  1692. kz_chat(id, "%L", id, "KZ_GOCHECK", gochecknumbers[id])
  1693.  
  1694. return PLUGIN_HANDLED;
  1695. }
  1696.  
  1697. // =================================================================================================
  1698.  
  1699. public reset_checkpoints(id)
  1700. {
  1701. checknumbers[id] = 0
  1702. gochecknumbers[id] = 0
  1703. timer_started[id] = false
  1704. timer_time[id] = 0.0
  1705. user_has_scout[id] = false
  1706. if(IsPaused[id])
  1707. {
  1708. set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
  1709. IsPaused[id] = false
  1710. }
  1711. if (get_pcvar_num(kz_show_timer) > 0 && ShowTime[id] == 2)
  1712. kz_showtime_roundtime(id, 0)
  1713.  
  1714. return PLUGIN_HANDLED
  1715. }
  1716.  
  1717. //===== Invis =======
  1718.  
  1719. public cmdInvisible(id)
  1720. {
  1721.  
  1722. gViewInvisible[id] = !gViewInvisible[id]
  1723. if(gViewInvisible[id])
  1724. kz_chat(id, "%L", id, "KZ_INVISIBLE_PLAYERS_ON")
  1725. else
  1726. kz_chat(id, "%L", id, "KZ_INVISIBLE_PLAYERS_OFF")
  1727.  
  1728. return PLUGIN_HANDLED
  1729. }
  1730.  
  1731. public cmdWaterInvisible(id)
  1732. {
  1733. if( !gWaterFound )
  1734. {
  1735. kz_chat(id, "%L", id, "KZ_INVISIBLE_NOWATER")
  1736. return PLUGIN_HANDLED
  1737. }
  1738.  
  1739. gWaterInvisible[id] = !gWaterInvisible[id]
  1740. if(gWaterInvisible[id])
  1741. kz_chat(id, "%L", id, "KZ_INVISIBLE_WATER_ON")
  1742. else
  1743. kz_chat(id, "%L", id, "KZ_INVISIBLE_WATER_OFF")
  1744.  
  1745. return PLUGIN_HANDLED
  1746. }
  1747.  
  1748. //======================Semiclip / Invis==========================
  1749.  
  1750. public FM_client_AddToFullPack_Post(es, e, ent, host, hostflags, player, pSet)
  1751. {
  1752. if( player )
  1753. {
  1754. if (get_pcvar_num(kz_semiclip) == 1)
  1755. {
  1756. if ( host != ent && get_orig_retval() && is_user_alive(host) )
  1757. {
  1758. set_es(es, ES_Solid, SOLID_NOT)
  1759. set_es(es, ES_RenderMode, kRenderTransAlpha)
  1760. set_es(es, ES_RenderAmt, get_pcvar_num(kz_semiclip_transparency))
  1761. }
  1762. }
  1763. if(gMarkedInvisible[ent] && gViewInvisible[host])
  1764. {
  1765. set_es(es, ES_RenderMode, kRenderTransTexture)
  1766. set_es(es, ES_RenderAmt, 0)
  1767. set_es(es, ES_Origin, { 999999999.0, 999999999.0, 999999999.0 } )
  1768. }
  1769. }
  1770. else if( gWaterInvisible[host] && gWaterEntity[ent] )
  1771. {
  1772. set_es(es, ES_Effects, get_es( es, ES_Effects ) | EF_NODRAW )
  1773. }
  1774.  
  1775. return FMRES_IGNORED
  1776. }
  1777.  
  1778. public Ham_CBasePlayer_PreThink_Post(id)
  1779. {
  1780. if( !is_user_alive(id) )
  1781. {
  1782. return
  1783. }
  1784.  
  1785. RefreshPlayersList()
  1786.  
  1787. if (get_pcvar_num(kz_semiclip) == 1)
  1788. {
  1789. for(new i = 0; i<g_iNum; i++)
  1790. {
  1791. g_iPlayer = g_iPlayers[i]
  1792. if( id != g_iPlayer )
  1793. {
  1794. set_pev(g_iPlayer, pev_solid, SOLID_NOT)
  1795. }
  1796. }
  1797. }
  1798. }
  1799.  
  1800. public client_PostThink(id)
  1801. {
  1802. if( !is_user_alive(id) )
  1803. return
  1804.  
  1805. RefreshPlayersList()
  1806.  
  1807. if (get_pcvar_num(kz_semiclip) == 1)
  1808. for(new i = 0; i<g_iNum; i++)
  1809. {
  1810. g_iPlayer = g_iPlayers[i]
  1811. if( g_iPlayer != id )
  1812. set_pev(g_iPlayer, pev_solid, SOLID_SLIDEBOX)
  1813. }
  1814. }
  1815.  
  1816. public noclip(id)
  1817. {
  1818. if(!is_user_alive(id))
  1819. {
  1820. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  1821. return PLUGIN_HANDLED
  1822. }
  1823. new noclip = !get_user_noclip(id)
  1824. set_user_noclip(id, noclip)
  1825.  
  1826. if(IsPaused[id] && (get_pcvar_num(kz_noclip_pause) == 1))
  1827. {
  1828. if(noclip)
  1829. {
  1830. pev(id, pev_origin, NoclipPos[id])
  1831. set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
  1832. }
  1833. else
  1834. {
  1835. set_pev(id, pev_origin, NoclipPos[id])
  1836. set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN)
  1837. }
  1838. }
  1839. else if(noclip)
  1840. detect_cheat(id,"Noclip")
  1841. kz_chat(id, "%L", id, "KZ_NOCLIP" , noclip ? "has been enabled." : "has been disabled.")
  1842.  
  1843. return PLUGIN_HANDLED
  1844. }
  1845.  
  1846. public GodMode(id)
  1847. {
  1848. if(!is_user_alive(id))
  1849. {
  1850. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  1851. return PLUGIN_HANDLED
  1852. }
  1853.  
  1854. new godmode = !get_user_godmode(id)
  1855. set_user_godmode(id, godmode)
  1856. if(godmode)
  1857. detect_cheat(id,"God Mode")
  1858. kz_chat(id, "%L", id, "KZ_GODMODE" , godmode ? "has been enabled." : "has been disabled.")
  1859.  
  1860. return PLUGIN_HANDLED
  1861. }
  1862.  
  1863. // =================================================================================================
  1864.  
  1865. stock kz_set_start(const map[], Float:origin[3])
  1866. {
  1867. new realfile[128], tempfile[128], formatorigin[50]
  1868. formatex(realfile, 127, "%s/%s", Kzdir, KZ_STARTFILE)
  1869. formatex(tempfile, 127, "%s/%s", Kzdir, KZ_STARTFILE_TEMP)
  1870. formatex(formatorigin, 49, "%f %f %f", origin[0], origin[1], origin[2])
  1871.  
  1872. DefaultStartPos = origin
  1873. DefaultStart = true
  1874.  
  1875. new file = fopen(tempfile, "wt")
  1876. new vault = fopen(realfile, "rt")
  1877.  
  1878. new data[128], key[64]
  1879. new bool:replaced = false
  1880.  
  1881. while( !feof(vault) )
  1882. {
  1883. fgets(vault, data, 127)
  1884. parse(data, key, 63)
  1885.  
  1886. if( equal(key, map) && !replaced )
  1887. {
  1888. fprintf(file, "%s %s^n", map, formatorigin)
  1889.  
  1890. replaced = true
  1891. }
  1892. else
  1893. {
  1894. fputs(file, data)
  1895. }
  1896. }
  1897.  
  1898. if( !replaced )
  1899. {
  1900. fprintf(file, "%s %s^n", map, formatorigin)
  1901. }
  1902.  
  1903. fclose(file)
  1904. fclose(vault)
  1905.  
  1906. delete_file(realfile)
  1907. while( !rename_file(tempfile, realfile, 1) ) {}
  1908. }
  1909.  
  1910. stock kz_showtime_roundtime(id, time)
  1911. {
  1912. if( is_user_connected(id) )
  1913. {
  1914. message_begin(MSG, get_user_msgid( "RoundTime" ), _, id);
  1915. write_short(time + 1);
  1916. message_end();
  1917. }
  1918. }
  1919.  
  1920. stock kz_chat(id, const message[], {Float,Sql,Result,_}:...)
  1921. {
  1922. new cvar = get_pcvar_num(kz_chatorhud)
  1923. if(cvar == 0)
  1924. return PLUGIN_HANDLED
  1925.  
  1926. new msg[180], final[192]
  1927. if (cvar == 1 && chatorhud[id] == -1 || chatorhud[id] == 1)
  1928. {
  1929. vformat(msg, 179, message, 3)
  1930. formatex(final, 191, "%s^x01 %s", prefix, msg)
  1931. kz_remplace_colors(final, 191)
  1932. ColorChat(id, GREEN, "%s", final)
  1933. }
  1934. else if( cvar == 2 && chatorhud[id] == -1 || chatorhud[id] == 2)
  1935. {
  1936. vformat(msg, 179, message, 3)
  1937. replace_all(msg, 191, "^x01", "")
  1938. replace_all(msg, 191, "^x03", "")
  1939. replace_all(msg, 191, "^x04", "")
  1940. replace_all(msg, 191, ".", "")
  1941. kz_hud_message(id, "%s", msg)
  1942. }
  1943.  
  1944. return 1
  1945. }
  1946.  
  1947. stock kz_print_config(id, const msg[])
  1948. {
  1949. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, id);
  1950. write_byte(id);
  1951. write_string(msg);
  1952. message_end();
  1953. }
  1954.  
  1955. stock kz_remplace_colors(message[], len)
  1956. {
  1957. replace_all(message, len, "!g", "^x04")
  1958. replace_all(message, len, "!t", "^x03")
  1959. replace_all(message, len, "!y", "^x01")
  1960. }
  1961.  
  1962. stock kz_hud_message(id, const message[], {Float,Sql,Result,_}:...)
  1963. {
  1964. static msg[192], colors[12], r[4], g[4], b[4];
  1965. vformat(msg, 191, message, 3);
  1966.  
  1967. get_pcvar_string(kz_hud_color, colors, 11)
  1968. parse(colors, r, 3, g, 3, b, 4)
  1969.  
  1970. 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);
  1971. ShowSyncHudMsg(id, hud_message, msg);
  1972. }
  1973.  
  1974. stock kz_register_saycmd(const saycommand[], const function[], flags)
  1975. {
  1976. new temp[64]
  1977. formatex(temp, 63, "say /%s", saycommand)
  1978. register_clcmd(temp, function, flags)
  1979. formatex(temp, 63, "say .%s", saycommand)
  1980. register_clcmd(temp, function, flags)
  1981. formatex(temp, 63, "say_team /%s", saycommand)
  1982. register_clcmd(temp, function, flags)
  1983. formatex(temp, 63, "say_team .%s", saycommand)
  1984. register_clcmd(temp, function, flags)
  1985. }
  1986.  
  1987. stock get_configsdir(name[],len)
  1988. {
  1989. return get_localinfo("amxx_configsdir",name,len);
  1990. }
  1991.  
  1992. #if defined USE_SQL
  1993. stock GetNewRank(id, type)
  1994. {
  1995. new createinto[1001]
  1996.  
  1997. new cData[2]
  1998. cData[0] = id
  1999. cData[1] = type
  2000.  
  2001. formatex(createinto, 1000, "SELECT authid FROM `%s` WHERE mapname='%s' ORDER BY time LIMIT 15", type == PRO_TOP ? "kz_pro15" : "kz_nub15", MapName)
  2002. SQL_ThreadQuery(g_SqlTuple, "GetNewRank_QueryHandler", createinto, cData, 2)
  2003. }
  2004.  
  2005. stock kz_update_plrname(id)
  2006. {
  2007. new createinto[1001], authid[32], name[32]
  2008. get_user_authid(id, authid, 31)
  2009. get_user_name(id, name, 31)
  2010.  
  2011. replace_all(name, 31, "\", "")
  2012. replace_all(name, 31, "`", "")
  2013. replace_all(name, 31, "'", "")
  2014.  
  2015. if(equal(authid, "VALVE_ID_LAN") || equal(authid, "STEAM_ID_LAN") || strlen(authid) > 18)
  2016. return 0;
  2017. else
  2018. {
  2019. formatex(createinto, 1000, "UPDATE `kz_pro15` SET name='%s' WHERE authid='%s'", name, authid)
  2020. SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
  2021. formatex(createinto, 1000, "UPDATE `kz_nub15` SET name='%s' WHERE authid='%s'", name, authid)
  2022. SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
  2023. }
  2024. return 1
  2025. }
  2026. #endif
  2027.  
  2028. public FwdSpawnWeaponbox( iEntity )
  2029. {
  2030. if(get_pcvar_num(kz_remove_drops) == 1)
  2031. {
  2032. set_pev( iEntity, pev_flags, FL_KILLME )
  2033. dllfunc( DLLFunc_Think, iEntity )
  2034. }
  2035.  
  2036. return HAM_IGNORED
  2037. }
  2038.  
  2039. public FwdHamDoorSpawn( iEntity )
  2040. {
  2041. static const szNull[ ] = "common/null.wav";
  2042.  
  2043. new Float:flDamage;
  2044. pev( iEntity, pev_dmg, flDamage );
  2045.  
  2046. if( flDamage < -999.0 ) {
  2047. set_pev( iEntity, pev_noise1, szNull );
  2048. set_pev( iEntity, pev_noise2, szNull );
  2049. set_pev( iEntity, pev_noise3, szNull );
  2050.  
  2051. if( !HealsOnMap )
  2052. HealsOnMap = true
  2053. }
  2054. }
  2055.  
  2056. public FwdHamPlayerSpawn( id )
  2057. {
  2058.  
  2059. if( !is_user_alive( id ) )
  2060. return;
  2061.  
  2062. if(firstspawn[id])
  2063. {
  2064. ColorChat(id, GREEN, "%s^x01 Bienvenido a el^x04 Servidor Oficial^x01 de^x04 KZ-Argentina^x01!", prefix)
  2065.  
  2066. if(get_pcvar_num(kz_checkpoints) == 0)
  2067. ColorChat(id, GREEN, "%s^x01 %L", id, "KZ_CHECKPOINT_OFF", prefix)
  2068.  
  2069.  
  2070. if(Verif(id,1) && get_pcvar_num(kz_save_pos) == 1)
  2071. savepos_menu(id)
  2072. else if(get_pcvar_num(kz_spawn_mainmenu) == 1)
  2073. kz_menu (id)
  2074. }
  2075. firstspawn[id] = false
  2076.  
  2077.  
  2078. if( !user_has_weapon(id,CSW_KNIFE) )
  2079. give_item( id,"weapon_knife" )
  2080.  
  2081. if( HealsOnMap )
  2082. {
  2083. set_user_godmode(id, 1)
  2084. set_user_health(id, 5000)
  2085. if(get_user_health(id) > 5000)
  2086. set_user_health(id, 5000)
  2087. }
  2088. if( IsPaused[id] )
  2089. {
  2090. set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN)
  2091. set_pev(id, pev_origin, PauseOrigin[id])
  2092. }
  2093.  
  2094. if(get_pcvar_num(kz_use_radio) == 0)
  2095. {
  2096. #define XO_PLAYER 5
  2097. #define m_iRadiosLeft 192
  2098. set_pdata_int(id, m_iRadiosLeft, 0, XO_PLAYER)
  2099. }
  2100. }
  2101.  
  2102. public GroundWeapon_Touch(iWeapon, id)
  2103. {
  2104. if( is_user_alive(id) && timer_started[id] && get_pcvar_num(kz_pick_weapons) == 0 )
  2105. return HAM_SUPERCEDE
  2106.  
  2107. return HAM_IGNORED
  2108. }
  2109.  
  2110.  
  2111.  
  2112. // ==================================Save positions=================================================
  2113.  
  2114. public SavePos(id)
  2115. {
  2116.  
  2117. new authid[33];
  2118. get_user_authid(id, authid, 32)
  2119. if(get_pcvar_num(kz_save_pos) == 0)
  2120. {
  2121. kz_chat(id, "%L", id, "KZ_SAVEPOS_DISABLED")
  2122. return PLUGIN_HANDLED
  2123. }
  2124.  
  2125. if(equal(authid, "VALVE_ID_LAN") || equal(authid, "STEAM_ID_LAN") || strlen(authid) > 18)
  2126. {
  2127. ColorChat (id, GREEN, "%s^x01 %L", prefix, id, "KZ_NO_STEAM")
  2128.  
  2129. return PLUGIN_HANDLED
  2130. }
  2131.  
  2132. if( !( pev( id, pev_flags ) & FL_ONGROUND2 ) )
  2133. {
  2134. kz_chat(id, "%L", id, "KZ_NOT_ON_GROUND")
  2135.  
  2136. return PLUGIN_HANDLED
  2137. }
  2138.  
  2139. if(!timer_started[id])
  2140. {
  2141. kz_chat(id, "%L", id, "KZ_TIMER_NOT_STARTED")
  2142. return PLUGIN_HANDLED
  2143. }
  2144.  
  2145. if(Verif(id,1))
  2146. {
  2147. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SAVEPOS_ALREADY")
  2148. savepos_menu(id)
  2149. return PLUGIN_HANDLED
  2150. }
  2151.  
  2152. if(get_user_noclip(id))
  2153. {
  2154. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SAVEPOS_NOCLIP")
  2155. return PLUGIN_HANDLED
  2156. }
  2157.  
  2158. new Float:origin[3], scout
  2159. pev(id, pev_origin, origin)
  2160. new Float:Time,check,gocheck
  2161. if(IsPaused[id])
  2162. {
  2163. Time = g_pausetime[id]
  2164. Pause(id)
  2165. }
  2166. else
  2167. Time=get_gametime() - timer_time[id]
  2168. check=checknumbers[id]
  2169. gocheck=gochecknumbers[id]
  2170. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SAVEPOS")
  2171. if (user_has_scout[id])
  2172. scout=1
  2173. else
  2174. scout=0
  2175. kz_savepos(id, Time, check, gocheck, origin, scout)
  2176. reset_checkpoints(id)
  2177.  
  2178. return PLUGIN_HANDLED
  2179. }
  2180.  
  2181. public GoPos(id)
  2182. {
  2183. remove_hook(id)
  2184. set_user_godmode(id, 0)
  2185. set_user_noclip(id, 0)
  2186. if(Verif(id,0))
  2187. {
  2188. set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
  2189. set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
  2190. set_pev(id, pev_origin, SavedOrigins[id] )
  2191. }
  2192.  
  2193. checknumbers[id]=SavedChecks[id]
  2194. gochecknumbers[id]=SavedGoChecks[id]+((get_pcvar_num(kz_save_pos_gochecks)>0) ? 1 : 0)
  2195. CheckPoint(id)
  2196. CheckPoint(id)
  2197. strip_user_weapons(id)
  2198. give_item(id,"weapon_usp")
  2199. give_item(id,"weapon_knife")
  2200. if(SavedScout[id])
  2201. {
  2202. give_item(id, "weapon_scout")
  2203. user_has_scout[id] = true
  2204. }
  2205. timer_time[id]=get_gametime()-SavedTime[id]
  2206. timer_started[id]=true
  2207. Pause(id)
  2208.  
  2209. }
  2210.  
  2211. public Verif(id, action)
  2212. {
  2213. new realfile[128], tempfile[128], authid[32], map[64]
  2214. new bool:exist = false
  2215. get_mapname(map, 63)
  2216. get_user_authid(id, authid, 31)
  2217. formatex(realfile, 127, "%s/%s.ini", SavePosDir, map)
  2218. formatex(tempfile, 127, "%s/temp.ini", SavePosDir)
  2219.  
  2220. if( !file_exists(realfile) )
  2221. return 0
  2222.  
  2223. new file = fopen(tempfile, "wt")
  2224. new vault = fopen(realfile, "rt")
  2225. new data[150], sid[32], time[25], checks[5], gochecks[5], x[25], y[25], z[25], scout[5]
  2226. while( !feof(vault) )
  2227. {
  2228. fgets(vault, data, 149)
  2229. parse(data, sid, 31, time, 24, checks, 4, gochecks, 4, x, 24, y, 24, z, 24, scout, 4)
  2230.  
  2231. if( equal(sid, authid) && !exist) // ma aflu in fisier?
  2232. {
  2233. if(action == 1)
  2234. fputs(file, data)
  2235. exist= true
  2236. SavedChecks[id] = str_to_num(checks)
  2237. SavedGoChecks[id] = str_to_num(gochecks)
  2238. SavedTime[id] = str_to_float(time)
  2239. SavedOrigins[id][0]=str_to_num(x)
  2240. SavedOrigins[id][1]=str_to_num(y)
  2241. SavedOrigins[id][2]=str_to_num(z)
  2242. SavedScout[id] = str_to_num(scout)
  2243. }
  2244. else
  2245. {
  2246. fputs(file, data)
  2247. }
  2248. }
  2249.  
  2250. fclose(file)
  2251. fclose(vault)
  2252.  
  2253. delete_file(realfile)
  2254. if(file_size(tempfile) == 0)
  2255. delete_file(tempfile)
  2256. else
  2257. while( !rename_file(tempfile, realfile, 1) ) {}
  2258.  
  2259.  
  2260. if(!exist)
  2261. return 0
  2262.  
  2263. return 1
  2264. }
  2265. public kz_savepos (id, Float:time, checkpoints, gochecks, Float:origin[3], scout)
  2266. {
  2267. new realfile[128], formatorigin[128], map[64], authid[32]
  2268. get_mapname(map, 63)
  2269. get_user_authid(id, authid, 31)
  2270. formatex(realfile, 127, "%s/%s.ini", SavePosDir, map)
  2271. formatex(formatorigin, 127, "%s %f %d %d %d %d %d %d", authid, time, checkpoints, gochecks, origin[0], origin[1], origin[2], scout)
  2272.  
  2273. new vault = fopen(realfile, "rt+")
  2274. write_file(realfile, formatorigin) // La sfarsit adaug datele mele
  2275.  
  2276. fclose(vault)
  2277.  
  2278. }
  2279.  
  2280. // =================================================================================================
  2281. // Events / Forwards
  2282. // =================================================================================================
  2283.  
  2284. //=================================================================================================
  2285.  
  2286. public client_disconnect(id)
  2287. {
  2288. checknumbers[id] = 0
  2289. gochecknumbers[id] = 0
  2290. antihookcheat[id] = 0.0
  2291. chatorhud[id] = -1
  2292. remove_task(id+TASK_ID_MINISECOND);
  2293. timer_started[id] = false
  2294. ShowTime[id] = get_pcvar_num(kz_show_timer)
  2295. firstspawn[id] = true
  2296. NightVisionUse[id] = false
  2297. IsPaused[id] = false
  2298. WasPaused[id] = false
  2299. user_has_scout[id] = false
  2300. remove_hook(id)
  2301. }
  2302.  
  2303. public client_putinserver(id)
  2304. {
  2305. checknumbers[id] = 0
  2306. gochecknumbers[id] = 0
  2307. antihookcheat[id] = 0.0
  2308. chatorhud[id] = -1
  2309. g_showkey[id] = true
  2310. set_task(0.1, "playersecondtask", id+TASK_ID_MINISECOND, _, _, "b");
  2311. timer_started[id] = false
  2312. ShowTime[id] = get_pcvar_num(kz_show_timer)
  2313. firstspawn[id] = true
  2314. NightVisionUse[id] = false
  2315. IsPaused[id] = false
  2316. WasPaused[id] = false
  2317. user_has_scout[id] = false
  2318. remove_hook(id)
  2319. }
  2320.  
  2321. // =================================================================================================
  2322. // Menu
  2323. // =================================================================================================
  2324. public goend_menu(id)
  2325. {
  2326. new title[64]
  2327. formatex(title, 63, "\rReset time and go to End?")
  2328. new menu = menu_create(title, "goendHandler")
  2329.  
  2330. menu_additem( menu, "Yes.", "1" )
  2331. menu_additem( menu, "No.", "2" )
  2332.  
  2333. menu_display(id, menu, 0)
  2334. return PLUGIN_HANDLED
  2335. }
  2336.  
  2337. public goendHandler(id, menu, item)
  2338. {
  2339. switch(item){
  2340. case 0:{
  2341. reset_checkpoints(id)
  2342. goEnd(id)
  2343. kz_menu(id)
  2344. }
  2345. case 1:{
  2346. others_menu(id)
  2347. }
  2348. }
  2349. return PLUGIN_HANDLED
  2350. }
  2351.  
  2352. public others_menu(id)
  2353. {
  2354. new title[64]
  2355. formatex(title, 63, "\yOther Commands")
  2356. new menu = menu_create(title, "MenuHandler1")
  2357.  
  2358. menu_additem( menu, "End Button", "1" )
  2359. menu_additem( menu, "Top15", "2" )
  2360. menu_additem( menu, "Info^n", "3" )
  2361. menu_additem( menu, "Timer Menu", "4" )
  2362. menu_additem( menu, "Invis Menu", "5" )
  2363. menu_additem( menu, "Spectator/CT", "6" )
  2364. menu_additem( menu, "Main Menu", "7" )
  2365.  
  2366. menu_display(id, menu, 0)
  2367. return PLUGIN_HANDLED
  2368. }
  2369.  
  2370. public MenuHandler1(id , menu, item)
  2371. {
  2372. if( item == MENU_EXIT ) {
  2373. menu_destroy(menu)
  2374. return PLUGIN_HANDLED
  2375. }
  2376.  
  2377.  
  2378. switch(item) {
  2379. case 0:{
  2380. goEnd(id)
  2381. }
  2382. case 1:{
  2383. top15menu(id)
  2384. }
  2385. case 2:{
  2386. PluginInfo(id)
  2387. others_menu(id)
  2388. }
  2389. case 3:{
  2390. ShowTimer_Menu(id)
  2391. }
  2392. case 4:{
  2393. InvisMenu(id)
  2394. }
  2395. case 5:{
  2396. ct(id)
  2397. }
  2398. case 6:{
  2399. kz_menu(id)
  2400. }
  2401. }
  2402.  
  2403. return PLUGIN_HANDLED
  2404. }
  2405.  
  2406. public kz_menu(id)
  2407. {
  2408. new title[64];
  2409. new mapita[32];
  2410. get_mapname(mapita, 31);
  2411.  
  2412. if(equali(mapita, "kz_longjumps2"))
  2413. {
  2414. formatex(title, 63, "\rKZ-Argentina \wLongJumps")
  2415. new menu = menu_create(title, "MenuHandler")
  2416.  
  2417. new msgcheck[64], msggocheck[64]
  2418. formatex(msgcheck, 63, "Checkpoint - \y[\r%i\y]", checknumbers[id])
  2419. formatex(msggocheck, 63, "Gocheck - \y[\r%i\y]", gochecknumbers[id])
  2420.  
  2421. menu_additem( menu, msgcheck, "1" )
  2422. menu_additem( menu, msggocheck, "2" )
  2423. menu_additem( menu, "Stuck^n", "3")
  2424. menu_additem( menu, "Start", "4")
  2425. menu_additem( menu, "Goto Menu", "5" )
  2426. menu_additem( menu, "Spec/CT", "6" )
  2427. menu_additem( menu, "Others", "7" )
  2428.  
  2429. menu_display(id, menu, 0)
  2430. return PLUGIN_HANDLED
  2431. }
  2432. else
  2433. {
  2434. formatex(title, 63, "\rKZ-Argentina \wMain Menu")
  2435. new menu = menu_create(title, "MenuHandler")
  2436.  
  2437. new msgcheck[64], msggocheck[64], msgpause[64]
  2438. if(!timer_started[id]){
  2439. formatex(msgcheck, 63, "Checkpoint - \y[\d%i\y]", checknumbers[id])
  2440. formatex(msggocheck, 63, "Gocheck - \y[\d%i\y]", gochecknumbers[id])
  2441. }
  2442. else if(gochecknumbers[id] == 0){
  2443. formatex(msgcheck, 63, "Checkpoint - \y[\d%i\y]", checknumbers[id])
  2444. formatex(msggocheck, 63, "Gocheck - \y[\d%i\y]", gochecknumbers[id])
  2445. }
  2446. else{
  2447. formatex(msgcheck, 63, "Checkpoint - \y[\r%i\y]", checknumbers[id])
  2448. formatex(msggocheck, 63, "Gocheck - \y[\r%i\y]", gochecknumbers[id])
  2449. }
  2450. formatex(msgpause, 63, "Pause - %s^n", IsPaused[id] ? "\yON" : "\rOFF" )
  2451.  
  2452. menu_additem( menu, msgcheck, "1" )
  2453. menu_additem( menu, msggocheck, "2" )
  2454. menu_additem( menu, "Stuck", "3")
  2455. menu_additem( menu, msgpause, "4" )
  2456. menu_additem( menu, "Start", "5")
  2457. menu_additem( menu, "Others^n", "6" )
  2458. menu_additem( menu, "Reset time", "7")
  2459.  
  2460. menu_display(id, menu, 0)
  2461.  
  2462. }
  2463. return PLUGIN_HANDLED
  2464. }
  2465.  
  2466. public MenuHandler(id , menu, item)
  2467. {
  2468. if( item == MENU_EXIT ) {
  2469. menu_destroy(menu)
  2470. return PLUGIN_HANDLED
  2471. }
  2472. new mapita[32];
  2473. get_mapname(mapita, 31);
  2474. if(equali(mapita, "kz_longjumps2"))
  2475. {
  2476. switch(item) {
  2477. case 0:{
  2478. CheckPoint(id)
  2479. kz_menu(id)
  2480. }
  2481. case 1:{
  2482. GoCheck(id)
  2483. kz_menu(id)
  2484. }
  2485. case 2:{
  2486. Stuck(id)
  2487. kz_menu(id)
  2488. }
  2489. case 3:{
  2490. goStart(id)
  2491. kz_menu(id)
  2492. }
  2493. case 4:{
  2494. gotomenu(id)
  2495. }
  2496. case 5:{
  2497. ct(id)
  2498. }
  2499. case 6:{
  2500. others_menu(id)
  2501. }
  2502. }
  2503. }
  2504. else
  2505. {
  2506.  
  2507. switch(item) {
  2508. case 0:{
  2509. CheckPoint(id)
  2510. kz_menu(id)
  2511. }
  2512. case 1:{
  2513. GoCheck(id)
  2514. kz_menu(id)
  2515. }
  2516. case 2:{
  2517. Stuck(id)
  2518. kz_menu(id)
  2519. }
  2520. case 3:{
  2521. Pause(id)
  2522. kz_menu(id)
  2523. }
  2524. case 4:{
  2525. goStart(id)
  2526. kz_menu(id)
  2527. }
  2528. case 5:{
  2529. others_menu(id)
  2530. }
  2531. case 6:{
  2532. reset_checkpoints(id)
  2533. kz_menu(id)
  2534. }
  2535. }
  2536. }
  2537. return PLUGIN_HANDLED
  2538. }
  2539.  
  2540. public InvisMenu(id)
  2541. {
  2542. new menu = menu_create("\yInvis Menu\w", "InvisMenuHandler")
  2543. new msginvis[64], msgwaterinvis[64]
  2544.  
  2545. formatex(msginvis, 63, "Players - %s", gViewInvisible[id] ? "\yON" : "\rOFF" )
  2546. formatex(msgwaterinvis, 63, "Water - %s^n^n", gWaterInvisible[id] ? "\yON" : "\rOFF" )
  2547.  
  2548. menu_additem( menu, msginvis, "1" )
  2549. menu_additem( menu, msgwaterinvis, "2" )
  2550. menu_additem( menu, "Others Menu", "3" )
  2551.  
  2552. menu_display(id, menu, 0)
  2553. return PLUGIN_HANDLED
  2554. }
  2555.  
  2556. public InvisMenuHandler (id, menu, item)
  2557. {
  2558. if( item == MENU_EXIT )
  2559. {
  2560. menu_destroy(menu)
  2561. return PLUGIN_HANDLED
  2562. }
  2563.  
  2564. switch(item)
  2565. {
  2566. case 0:
  2567. {
  2568. cmdInvisible(id)
  2569. InvisMenu(id)
  2570. }
  2571. case 1:
  2572. {
  2573. cmdWaterInvisible(id)
  2574. InvisMenu(id)
  2575. }
  2576. case 2:
  2577. {
  2578. others_menu(id)
  2579. }
  2580. }
  2581. return PLUGIN_HANDLED
  2582. }
  2583.  
  2584. public ShowTimer_Menu(id)
  2585. {
  2586. if (get_pcvar_num(kz_show_timer) == 0 )
  2587. {
  2588. kz_chat(id, "%L", id, "KZ_TIMER_DISABLED")
  2589. return PLUGIN_HANDLED
  2590. }
  2591. else
  2592. {
  2593. new menu = menu_create("\yTimer Menu\w", "TimerHandler")
  2594.  
  2595. new roundtimer[64], hudtimer[64], notimer[64];
  2596.  
  2597. formatex(roundtimer, 63, "Round Timer %s", ShowTime[id] == 2 ? "\y x" : "" )
  2598. formatex(hudtimer, 63, "HUD Timer %s", ShowTime[id] == 1 ? "\y x" : "" )
  2599. formatex(notimer, 63, "No Timer %s^n", ShowTime[id] == 0 ? "\y x" : "" )
  2600.  
  2601. menu_additem( menu, roundtimer, "1" )
  2602. menu_additem( menu, hudtimer, "2" )
  2603. menu_additem( menu, notimer, "3" )
  2604. menu_additem( menu, "Others Menu", "4" )
  2605.  
  2606. menu_display(id, menu, 0)
  2607. return PLUGIN_HANDLED
  2608. }
  2609.  
  2610. return PLUGIN_HANDLED
  2611. }
  2612.  
  2613. public TimerHandler (id, menu, item)
  2614. {
  2615. if( item == MENU_EXIT )
  2616. {
  2617. menu_destroy(menu)
  2618. return PLUGIN_HANDLED
  2619. }
  2620.  
  2621. switch(item)
  2622. {
  2623.  
  2624. case 0:
  2625. {
  2626. ShowTime[id]= 2
  2627. ShowTimer_Menu(id)
  2628. }
  2629. case 1:
  2630. {
  2631. ShowTime[id]= 1
  2632. ShowTimer_Menu(id)
  2633. if (timer_started[id])
  2634. kz_showtime_roundtime(id, 0)
  2635. }
  2636. case 2:
  2637. {
  2638. ShowTime[id]= 0
  2639. ShowTimer_Menu(id)
  2640. if (timer_started[id])
  2641. kz_showtime_roundtime(id, 0)
  2642. }
  2643. case 3:
  2644. {
  2645. others_menu(id)
  2646. }
  2647. }
  2648. return PLUGIN_HANDLED
  2649. }
  2650.  
  2651. public savepos_menu(id)
  2652. {
  2653. new menu = menu_create("SavePos Menu", "SavePosHandler")
  2654.  
  2655. menu_additem( menu, "Reload previous run", "1" )
  2656. menu_additem( menu, "Start a new run", "2" )
  2657.  
  2658. menu_display(id, menu, 0)
  2659. return PLUGIN_HANDLED
  2660. }
  2661.  
  2662. public SavePosHandler(id, menu, item)
  2663. {
  2664.  
  2665. switch(item)
  2666. {
  2667. case 0:
  2668. {
  2669. GoPos(id)
  2670. }
  2671. case 1:
  2672. {
  2673. Verif(id,0)
  2674. }
  2675. }
  2676. return PLUGIN_HANDLED
  2677. }
  2678.  
  2679. public top15menu(id)
  2680. {
  2681. new menu = menu_create("\rKZ \yTop15 \w", "top15handler")
  2682. menu_additem(menu, "\wPro 15", "1", 0)
  2683. menu_additem(menu, "\wNoob 15^n^n", "2", 0)
  2684. #if defined USE_SQL
  2685. menu_additem(menu, "Pro Records","3")
  2686. menu_additem(menu, "Players Rankings^n","4")
  2687. menu_additem(menu, "Last 10 Pro Entries", "5")
  2688. menu_additem(menu, "Maps Statistic","6")
  2689. menu_additem(menu, "Main Menu", "7")
  2690. #else
  2691. menu_additem(menu, "\wOthers Menu", "3", 0)
  2692. #endif
  2693.  
  2694. menu_display(id, menu, 0);
  2695.  
  2696. return PLUGIN_HANDLED;
  2697. }
  2698.  
  2699. public top15handler(id, menu, item)
  2700. {
  2701. if(item == MENU_EXIT)
  2702. {
  2703. menu_destroy(menu)
  2704. return PLUGIN_HANDLED
  2705. }
  2706. #if defined USE_SQL
  2707. switch(item)
  2708. {
  2709. case 0:
  2710. {
  2711. ProTop_show(id)
  2712. top15menu(id)
  2713. }
  2714. case 1:
  2715. {
  2716. NoobTop_show(id)
  2717. top15menu(id)
  2718. }
  2719. case 2:
  2720. {
  2721. kz_showhtml_motd(id, PRO_RECORDS, "")
  2722. top15menu(id)
  2723. }
  2724. case 3:
  2725. {
  2726. kz_showhtml_motd(id, PLAYERS_RANKING, "")
  2727. top15menu(id)
  2728. }
  2729. case 4:
  2730. {
  2731. kz_showhtml_motd(id, LAST_PRO10, "")
  2732. top15menu(id)
  2733. }
  2734. case 5:
  2735. {
  2736. kz_showhtml_motd(id, MAPS_STATISTIC, "")
  2737. top15menu(id)
  2738. }
  2739. case 6:
  2740. {
  2741. others_menu(id)
  2742. }
  2743. }
  2744. #else
  2745. switch(item)
  2746. {
  2747. case 0:
  2748. {
  2749. ProTop_show(id)
  2750. top15menu(id)
  2751. }
  2752. case 1:
  2753. {
  2754. NoobTop_show(id)
  2755. top15menu(id)
  2756. }
  2757. case 2:
  2758. {
  2759. others_menu(id)
  2760. }
  2761. }
  2762. #endif
  2763.  
  2764. return PLUGIN_HANDLED;
  2765. }
  2766.  
  2767. // =================================================================================================
  2768.  
  2769. //
  2770. // Timersystem
  2771. // =================================================================================================
  2772. public fwdUse(ent, id)
  2773. {
  2774. if( !ent || id > 32 )
  2775. {
  2776. return HAM_IGNORED;
  2777. }
  2778.  
  2779. if( !is_user_alive(id) )
  2780. {
  2781. return HAM_IGNORED;
  2782. }
  2783.  
  2784.  
  2785. new name[32]
  2786. get_user_name(id, name, 31)
  2787.  
  2788. new szTarget[ 32 ];
  2789. pev(ent, pev_target, szTarget, 31);
  2790.  
  2791. if( TrieKeyExists( g_tStarts, szTarget ) )
  2792. {
  2793. if(get_user_noclip(id))
  2794. {
  2795. if(!timer_started[id])
  2796. kz_hud_message( id, "%L", id, "KZ_NOCLIP_TIMER")
  2797. return PLUGIN_HANDLED
  2798.  
  2799. }
  2800. if(ishooked[id])
  2801. return PLUGIN_HANDLED
  2802.  
  2803. if ( get_gametime() - antihookcheat[id] < 3.0 )
  2804. {
  2805. kz_hud_message( id, "%L", id, "KZ_HOOK_PROTECTION" );
  2806. return PLUGIN_HANDLED
  2807. }
  2808.  
  2809. if(Verif(id,1))
  2810. {
  2811. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SAVEPOS_SAVED")
  2812. savepos_menu(id)
  2813. return HAM_IGNORED
  2814. }
  2815.  
  2816. if ( reset_checkpoints(id) && !timer_started[id] )
  2817. {
  2818. start_climb(id)
  2819. new wpn=get_user_weapon(id)
  2820. for(new i = 0; i < 8; i++)
  2821. if( user_has_weapon(id, other_weapons[i]) )
  2822. {
  2823. strip_user_weapons(id)
  2824. give_item(id,"weapon_knife")
  2825. give_item(id,"weapon_usp")
  2826. set_pdata_int(id, 382, 24, 5)
  2827. if(wpn==CSW_SCOUT)
  2828. {
  2829. user_has_scout[id]=true
  2830. give_item(id,"weapon_scout")
  2831. }
  2832. else
  2833. user_has_scout[id]=false
  2834. }
  2835.  
  2836. if( get_user_health(id) < 100 )
  2837. set_user_health(id, 100)
  2838.  
  2839. pev(id, pev_origin, SavedStart[id])
  2840. if(get_pcvar_num(kz_save_autostart) == 1)
  2841. AutoStart[id] = true;
  2842.  
  2843. if( !DefaultStart )
  2844. {
  2845. kz_set_start(MapName, SavedStart[id])
  2846. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SET_START")
  2847. }
  2848.  
  2849. remove_hook(id)
  2850. }
  2851.  
  2852. }
  2853.  
  2854. if( TrieKeyExists( g_tStops, szTarget ) )
  2855. {
  2856. if( timer_started[id] )
  2857. {
  2858. if(get_user_noclip(id))
  2859. return PLUGIN_HANDLED
  2860.  
  2861. finish_climb(id)
  2862.  
  2863. pev(id, pev_origin, SavedEnd[id])
  2864. if(get_pcvar_num(kz_save_autoEnd) == 1)
  2865. AutoEnd[id] = true;
  2866.  
  2867. if( !DefaultEnd )
  2868. {
  2869. kz_set_End(MapName, SavedEnd[id])
  2870. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SET_END")
  2871. }
  2872.  
  2873. if(get_pcvar_num(kz_hook_prize) == 1 && !canusehook[id])
  2874. {
  2875. canusehook[id] = true
  2876. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_HOOK")
  2877. }
  2878. }
  2879. else
  2880. kz_hud_message(id, "%L", id, "KZ_TIMER_NOT_STARTED")
  2881.  
  2882. }
  2883. return HAM_IGNORED
  2884. }
  2885.  
  2886. public start_climb(id)
  2887. {
  2888. kz_chat(id, "%L", id, "KZ_START_CLIMB")
  2889.  
  2890. if (get_pcvar_num(kz_reload_weapons) == 1)
  2891. {
  2892. strip_user_weapons(id)
  2893. give_item(id,"weapon_knife")
  2894. give_item(id,"weapon_usp")
  2895. }
  2896.  
  2897. if (ShowTime[id] == 2)
  2898. kz_showtime_roundtime(id, 0)
  2899. set_pev(id, pev_gravity, 1.0);
  2900. set_pev(id, pev_movetype, MOVETYPE_WALK)
  2901. reset_checkpoints(id)
  2902. IsPaused[id] = false
  2903. timer_started[id] = true
  2904. timer_time[id] = get_gametime()
  2905. if ( HealsOnMap )
  2906. set_user_godmode(id, 1)
  2907. else
  2908. set_user_godmode(id, 0)
  2909. }
  2910.  
  2911. public finish_climb(id)
  2912. {
  2913. if (!is_user_alive (id))
  2914. {
  2915. return;
  2916. }
  2917.  
  2918. if ( (get_pcvar_num(kz_top15_authid) > 1) || (get_pcvar_num(kz_top15_authid) < 0) )
  2919. {
  2920. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_TOP15_DISABLED")
  2921. return;
  2922. }
  2923.  
  2924. #if defined USE_SQL
  2925. new Float: time, wpn
  2926. time = get_gametime() - timer_time[id]
  2927. show_finish_message(id, time)
  2928. timer_started[id] = false
  2929. if (get_pcvar_num(kz_show_timer) > 0 && ShowTime[id] == 2)
  2930. kz_showtime_roundtime(id, 0)
  2931. new checkpoints=checknumbers[id]
  2932. new gocheck=gochecknumbers[id]
  2933. if(user_has_scout[id])
  2934. wpn=CSW_SCOUT
  2935. else
  2936. wpn=get_user_weapon( id )
  2937.  
  2938. new steam[32], name[32]
  2939. get_user_name(id, name, 31)
  2940. get_user_authid(id, steam, 31 )
  2941. client_cmd(0, "spk buttons/bell1")
  2942. new createinto[1001]
  2943.  
  2944. new cData[192]
  2945. cData[0] = id
  2946. formatex(cData[2], charsmax(cData)-2, "^"%f^" ^"%d^" ^"%d^" ^"%d^"", time, wpn, checkpoints ,gocheck)
  2947.  
  2948.  
  2949. if(equal(steam, "VALVE_ID_LAN") || equal(steam, "STEAM_ID_LAN") || strlen(steam) > 18)
  2950. {
  2951. if (gochecknumbers[id] == 0 && !user_has_scout[id] )
  2952. {
  2953. cData[1] = PRO_TOP
  2954. formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_pro15` WHERE mapname='%s' AND name='%s'", MapName, name)
  2955. SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
  2956. }
  2957. if (gochecknumbers[id] > 0 || user_has_scout[id] )
  2958. {
  2959. cData[1] = NUB_TOP
  2960. formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_nub15` WHERE mapname='%s' AND name='%s'", MapName, name)
  2961. SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
  2962. }
  2963. } else
  2964. {
  2965.  
  2966. if (gochecknumbers[id] == 0 && !user_has_scout[id] )
  2967. {
  2968. cData[1] = PRO_TOP
  2969. formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_pro15` WHERE mapname='%s' AND authid='%s'", MapName, steam)
  2970. SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
  2971. }
  2972. if (gochecknumbers[id] > 0 || user_has_scout[id] )
  2973. {
  2974. cData[1] = NUB_TOP
  2975. formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_nub15` WHERE mapname='%s' AND authid='%s'", MapName, steam)
  2976. SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
  2977. }
  2978. }
  2979. #else
  2980. new Float: time, authid[32]
  2981. time = get_gametime() - timer_time[id]
  2982. get_user_authid(id, authid, 31)
  2983. show_finish_message(id, time)
  2984. timer_started[id] = false
  2985. if (get_pcvar_num(kz_show_timer) > 0 && ShowTime[id] == 2)
  2986. kz_showtime_roundtime(id, 0)
  2987.  
  2988. if (gochecknumbers[id] == 0 && !user_has_scout[id] )
  2989. ProTop_update(id, time)
  2990. if (gochecknumbers[id] > 0 || user_has_scout[id] )
  2991. NoobTop_update(id, time, checknumbers[id], gochecknumbers[id])
  2992. #endif
  2993. user_has_scout[id] = false
  2994.  
  2995. }
  2996.  
  2997. public show_finish_message(id, Float:kreedztime)
  2998. {
  2999. new name[32]
  3000. new imin,isec,ims, wpn
  3001. if(user_has_scout[id])
  3002. wpn=CSW_SCOUT
  3003. else
  3004. wpn=get_user_weapon( id )
  3005. get_user_name(id, name, 31)
  3006. imin = floatround(kreedztime / 60.0, floatround_floor)
  3007. isec = floatround(kreedztime - imin * 60.0,floatround_floor)
  3008. ims = floatround( ( kreedztime - ( imin * 60.0 + isec ) ) * 100.0, floatround_floor )
  3009.  
  3010. ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 %02i:%02i.%02i ^x01with ^x04%d^x01 Gochecks^x04! ^x01(^x01%L: ^x04%s^x01)", prefix, name, LANG_PLAYER, "KZ_FINISH_MSG", imin, isec, ims, gochecknumbers[id], LANG_PLAYER, "KZ_WEAPON", g_weaponsnames[wpn])
  3011. }
  3012.  
  3013. //==================Plugin Info===================
  3014.  
  3015. public PluginInfo(id)
  3016. {
  3017. ColorChat(id, GREEN, "%s^x01 ProKreedz edited by^x04 f0rged^x01.", prefix)
  3018. }
  3019.  
  3020. //==========================================================
  3021. #if defined USE_SQL
  3022. public Set_QueryHandler(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
  3023. {
  3024. new id = cData[0]
  3025. new style = cData[1]
  3026. if( iFailState != TQUERY_SUCCESS )
  3027. {
  3028. log_amx("[KZ-Arg] TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
  3029. ColorChat(0, GREEN, "%s^x01 %F", prefix, LANG_PLAYER, "KZ_TOP15_SQL_ERROR")
  3030. }
  3031.  
  3032. server_print("[KZ-Arg] Server Geting Info of SQL Server")
  3033.  
  3034. new createinto[1001]
  3035. new x1[16], x2[4], x3[5], x4[5]
  3036. parse(cData[2], x1, 15, x2, 3, x3, 4, x4, 4)
  3037.  
  3038. new dia[64], steam[32], name[32], ip[15], countty[3], checkpoints[32], gochecks[32]
  3039. new Float:newtime = str_to_float(x1)
  3040. new iMin, iSec, iMs, server[64]
  3041. get_pcvar_string(kz_sql_name, server, 63)
  3042. get_time("%Y%m%d%H%M%S", dia, sizeof dia - 1)
  3043. get_user_authid(id, steam, 31)
  3044. get_user_name(id, name, sizeof name - 1)
  3045. get_user_ip (id, ip, sizeof ip - 1, 1)
  3046. geoip_code2_ex( ip, countty)
  3047.  
  3048. replace_all(name, 31, "\", "")
  3049. replace_all(name, 31, "`", "")
  3050. replace_all(name, 31, "'", "")
  3051.  
  3052.  
  3053. if( SQL_NumResults(hQuery) == 0 )
  3054. {
  3055. formatex(checkpoints, 31, ", '%d'", str_to_num(x3))
  3056. formatex(gochecks, 31, ", '%d'", str_to_num(x4))
  3057. 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, countty, name, newtime, dia, g_weaponsnames[str_to_num(x2)], server, style == PRO_TOP ? "" : checkpoints, style == PRO_TOP ? "" : gochecks)
  3058. SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
  3059. GetNewRank(id, style)
  3060. }
  3061. else
  3062. {
  3063. new Float:oldtime, Float:thetime
  3064. SQL_ReadResult(hQuery, 0, oldtime)
  3065.  
  3066. if(newtime < oldtime)
  3067. {
  3068. thetime = oldtime - newtime
  3069. iMin = floatround(thetime / 60.0, floatround_floor)
  3070. iSec = floatround(thetime - iMin * 60.0,floatround_floor)
  3071. iMs = floatround( ( thetime - ( iMin * 60.0 + iSec ) ) * 100.0, floatround_floor )
  3072. ColorChat(id, GREEN, "[KZ-Arg]^x01 %L^x03 %02i:%02i.%02i^x01 in ^x03%s", id, "KZ_IMPROVE", iMin, iSec, iMs, style == PRO_TOP ? "Pro 15" : "Noob 15")
  3073. formatex(checkpoints, 31, ", checkpoints='%d'", str_to_num(x3))
  3074. formatex(gochecks, 31, ", gocheck='%d'", str_to_num(x4))
  3075. if(equal(steam, "VALVE_ID_LAN") || equal(steam, "STEAM_ID_LAN") || strlen(steam) > 18)
  3076. 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)
  3077. else
  3078. 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)
  3079.  
  3080. SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto )
  3081. GetNewRank(id, style)
  3082. }
  3083. else
  3084. {
  3085. thetime = newtime - oldtime
  3086. iMin = floatround(thetime / 60.0, floatround_floor)
  3087. iSec = floatround(thetime - iMin * 60.0,floatround_floor)
  3088. iMs = floatround( ( thetime - ( iMin * 60.0 + iSec ) ) * 100.0, floatround_floor )
  3089. ColorChat(id, GREEN, "[KZ-Arg]^x01 %L^x03 %02i:%02i.%02i ^x01in ^x03%s", id, "KZ_SLOWER", iMin, iSec, iMs, style == PRO_TOP ? "Pro 15" : "Noob 15")
  3090. }
  3091. }
  3092.  
  3093. return PLUGIN_CONTINUE
  3094.  
  3095. }
  3096.  
  3097. public GetNewRank_QueryHandler(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
  3098. {
  3099. new id = cData[0]
  3100. if( iFailState != TQUERY_SUCCESS )
  3101. {
  3102. return log_amx("TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
  3103. }
  3104.  
  3105. new steam[32], authid[32], namez[32], name[32], i = 0
  3106. get_user_authid(id, steam, 31)
  3107. get_user_name(id, namez, 31)
  3108.  
  3109. while( SQL_MoreResults(hQuery) )
  3110. {
  3111. i++
  3112. if(equal(steam, "VALVE_ID_LAN") || equal(steam, "STEAM_ID_LAN") || strlen(steam) > 18)
  3113. {
  3114. SQL_ReadResult(hQuery, 0, name, 31)
  3115. if( equal(name, namez) )
  3116. {
  3117. 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");
  3118. break;
  3119. }
  3120. }
  3121. else
  3122. {
  3123. SQL_ReadResult(hQuery, 0, authid, 31)
  3124. if( equal(authid, steam) )
  3125. {
  3126. 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");
  3127. break;
  3128. }
  3129. }
  3130. SQL_NextRow(hQuery)
  3131. }
  3132.  
  3133. return PLUGIN_CONTINUE
  3134. }
  3135.  
  3136. public ProTop_show(id)
  3137. {
  3138. kz_showhtml_motd(id, PRO_TOP, MapName)
  3139.  
  3140. return PLUGIN_HANDLED
  3141. }
  3142.  
  3143. public NoobTop_show(id)
  3144. {
  3145.  
  3146. kz_showhtml_motd(id, NUB_TOP, MapName)
  3147.  
  3148. return PLUGIN_HANDLED
  3149. }
  3150.  
  3151. public ProRecs_show(id)
  3152. {
  3153. new authid[32]
  3154. get_user_authid(id, authid, 31)
  3155.  
  3156. if(equal(authid, "VALVE_ID_LAN") || equal(authid, "STEAM_ID_LAN") || strlen(authid) > 18)
  3157. {
  3158. ColorChat (id, GREEN, "%s^x01 %L", prefix, id, "KZ_NO_STEAM")
  3159. return PLUGIN_HANDLED
  3160. }
  3161.  
  3162. kz_showhtml_motd(id, PRO_RECORDS, MapName)
  3163.  
  3164. return PLUGIN_HANDLED
  3165. }
  3166.  
  3167. stock kz_showhtml_motd(id, type, const map[])
  3168. {
  3169. new buffer[1001], namebuffer[64], filepath[96]
  3170. get_pcvar_string(kz_sql_files, filepath, 95)
  3171. new authid[32]
  3172. get_user_authid(id, authid, 31)
  3173.  
  3174. switch( type )
  3175. {
  3176. case PRO_TOP:
  3177. {
  3178. formatex(namebuffer, 63, "Pro 15 of %s", equal(map, "") ? "All Maps" : map)
  3179. formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/pro15.php?map=%s^"></head><body><p>LOADING...</p></body></html>", filepath, map)
  3180. }
  3181. case NUB_TOP:
  3182. {
  3183. formatex(namebuffer, 63, "Noob 15 of %s", equal(map, "") ? "All Maps" : map)
  3184. formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/nub15.php?map=%s^"></head><body><p>LOADING...</p></body></html>", filepath, map)
  3185. }
  3186. case PRO_RECORDS:
  3187. {
  3188. formatex(namebuffer, 63, "ProRecords and Rank")
  3189. formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/player.php?authid=%s^"></head><body><p>LOADING...</p></body></html>", filepath, authid)
  3190. }
  3191. case PLAYERS_RANKING:
  3192. {
  3193. formatex(namebuffer, 63, "Players Ranking")
  3194. formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/players.php^"></head><body><p>LOADING...</p></body></html>", filepath, authid)
  3195. }
  3196. case LAST_PRO10:
  3197. {
  3198. formatex(namebuffer, 63, "Last 10 Pro Entries")
  3199. formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/lastpro.php^"></head><body><p>LOADING...</p></body></html>", filepath)
  3200. }
  3201. case MAPS_STATISTIC:
  3202. {
  3203. formatex(namebuffer, 63, "Maps Statistic")
  3204. formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/map.php^"></head><body><p>LOADING...</p></body></html>", filepath)
  3205. }
  3206. }
  3207.  
  3208. show_motd(id, buffer, namebuffer)
  3209. }
  3210. #else
  3211. public ProTop_update(id, Float:time)
  3212. {
  3213. new authid[32], name[32], thetime[32], Float: slower, Float: faster, Float:protiempo
  3214. get_user_name(id, name, 31);
  3215. get_user_authid(id, authid, 31);
  3216. get_time(" %d/%m/%Y ", thetime, 31);
  3217. new bool:Is_in_pro15
  3218. Is_in_pro15 = false
  3219.  
  3220. for(new i = 0; i < 15; i++)
  3221. {
  3222. 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)) )
  3223. {
  3224. Is_in_pro15 = true
  3225. slower = time - Pro_Times[i]
  3226. faster = Pro_Times[i] - time
  3227. protiempo = Pro_Times[i]
  3228. }
  3229. }
  3230.  
  3231. for (new i = 0; i < 15; i++)
  3232. {
  3233. if( time < Pro_Times[i])
  3234. {
  3235. new pos = i
  3236. if ( get_pcvar_num(kz_top15_authid) == 0 )
  3237. while( !equal(Pro_Names[pos], name) && pos < 15 )
  3238. {
  3239. pos++;
  3240. }
  3241. else if ( get_pcvar_num(kz_top15_authid) == 1)
  3242. while( !equal(Pro_AuthIDS[pos], authid) && pos < 15 )
  3243. {
  3244. pos++;
  3245. }
  3246.  
  3247. for (new j = pos; j > i; j--)
  3248. {
  3249. formatex(Pro_AuthIDS[j], 31, Pro_AuthIDS[j-1]);
  3250. formatex(Pro_Names[j], 31, Pro_Names[j-1]);
  3251. formatex(Pro_Date[j], 31, Pro_Date[j-1])
  3252. Pro_Times[j] = Pro_Times[j-1];
  3253. }
  3254.  
  3255. formatex(Pro_AuthIDS[i], 31, authid);
  3256. formatex(Pro_Names[i], 31, name);
  3257. formatex(Pro_Date[i], 31, thetime)
  3258. Pro_Times[i] = time
  3259.  
  3260. save_pro15()
  3261.  
  3262. if( Is_in_pro15 )
  3263. {
  3264.  
  3265. if( time < protiempo )
  3266. {
  3267. new min, Float:sec;
  3268. min = floatround(faster, floatround_floor)/60;
  3269. sec = faster - (60*min);
  3270. ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_IMPROVE", min, sec < 10 ? "0" : "", sec);
  3271.  
  3272. if( (i + 1) == 1)
  3273. {
  3274. client_cmd(0, "spk woop");
  3275. ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #1^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
  3276. }
  3277. else
  3278. {
  3279. client_cmd(0, "spk buttons/bell1");
  3280. ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #%d^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
  3281. }
  3282. }
  3283. }
  3284. else
  3285. {
  3286. if( (i + 1) == 1)
  3287. {
  3288. client_cmd(0, "spk woop");
  3289. ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #1^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
  3290. }
  3291. else
  3292. {
  3293. client_cmd(0, "spk buttons/bell1");
  3294. ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #%d^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
  3295. }
  3296. }
  3297.  
  3298. return;
  3299. }
  3300.  
  3301. 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)) )
  3302. {
  3303. if( time > protiempo )
  3304. {
  3305. new min, Float:sec;
  3306. min = floatround(slower, floatround_floor)/60;
  3307. sec = slower - (60*min);
  3308. ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_SLOWER", min, sec < 10 ? "0" : "", sec);
  3309. return;
  3310. }
  3311. }
  3312.  
  3313. }
  3314. }
  3315.  
  3316. public save_pro15()
  3317. {
  3318. new profile[128]
  3319. formatex(profile, 127, "%s/pro_%s.cfg", Topdir, MapName)
  3320.  
  3321. if( file_exists(profile) )
  3322. {
  3323. delete_file(profile)
  3324. }
  3325.  
  3326. new Data[256];
  3327. new f = fopen(profile, "at")
  3328.  
  3329. for(new i = 0; i < 15; i++)
  3330. {
  3331. formatex(Data, 255, "^"%.2f^" ^"%s^" ^"%s^" ^"%s^"^n", Pro_Times[i], Pro_AuthIDS[i], Pro_Names[i], Pro_Date[i])
  3332. fputs(f, Data)
  3333. }
  3334. fclose(f);
  3335. }
  3336.  
  3337. public read_pro15()
  3338. {
  3339. new profile[128], prodata[256]
  3340. formatex(profile, 127, "%s/pro_%s.cfg", Topdir, MapName)
  3341.  
  3342. new f = fopen(profile, "rt" )
  3343. new i = 0
  3344. while( !feof(f) && i < 16)
  3345. {
  3346. fgets(f, prodata, 255)
  3347. new totime[25]
  3348. parse(prodata, totime, 24, Pro_AuthIDS[i], 31, Pro_Names[i], 31, Pro_Date[i], 31)
  3349. Pro_Times[i] = str_to_float(totime)
  3350. i++;
  3351. }
  3352. fclose(f)
  3353. }
  3354.  
  3355. //==================================================================================================
  3356.  
  3357. public NoobTop_update(id, Float:time, checkpoints, gochecks)
  3358. {
  3359. new authid[32], name[32], thetime[32], wpn, Float: slower, Float: faster, Float:noobtiempo
  3360. get_user_name(id, name, 31);
  3361. get_user_authid(id, authid, 31);
  3362. get_time(" %d/%m/%Y ", thetime, 31);
  3363. new bool:Is_in_noob15
  3364. Is_in_noob15 = false
  3365. if(user_has_scout[id])
  3366. wpn=CSW_SCOUT
  3367. else
  3368. wpn=get_user_weapon(id)
  3369.  
  3370. for(new i = 0; i < 15; i++)
  3371. {
  3372. 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)) )
  3373. {
  3374. Is_in_noob15 = true
  3375. slower = time - Noob_Tiempos[i];
  3376. faster = Noob_Tiempos[i] - time;
  3377. noobtiempo = Noob_Tiempos[i]
  3378. }
  3379. }
  3380.  
  3381. for (new i = 0; i < 15; i++)
  3382. {
  3383. if( time < Noob_Tiempos[i])
  3384. {
  3385. new pos = i
  3386.  
  3387. if ( get_pcvar_num(kz_top15_authid) == 0 )
  3388. while( !equal(Noob_Names[pos], name) && pos < 15 )
  3389. {
  3390. pos++;
  3391. }
  3392. else if ( get_pcvar_num(kz_top15_authid) == 1)
  3393. while( !equal(Noob_AuthIDS[pos], authid) && pos < 15 )
  3394. {
  3395. pos++;
  3396. }
  3397.  
  3398. for (new j = pos; j > i; j--)
  3399. {
  3400. formatex(Noob_AuthIDS[j], 31, Noob_AuthIDS[j-1])
  3401. formatex(Noob_Names[j], 31, Noob_Names[j-1])
  3402. formatex(Noob_Date[j], 31, Noob_Date[j-1])
  3403. formatex(Noob_Weapon[j], 31, Noob_Weapon[j-1])
  3404. Noob_Tiempos[j] = Noob_Tiempos[j-1]
  3405. Noob_CheckPoints[j] = Noob_CheckPoints[j-1]
  3406. Noob_GoChecks[j] = Noob_GoChecks[j-1]
  3407. }
  3408.  
  3409. formatex(Noob_AuthIDS[i], 31, authid);
  3410. formatex(Noob_Names[i], 31, name);
  3411. formatex(Noob_Date[i], 31, thetime)
  3412. formatex(Noob_Weapon[i], 31, g_weaponsnames[wpn])
  3413. Noob_Tiempos[i] = time
  3414. Noob_CheckPoints[i] = checkpoints
  3415. Noob_GoChecks[i] = gochecks
  3416.  
  3417. save_Noob15()
  3418.  
  3419. if( Is_in_noob15 )
  3420. {
  3421.  
  3422. if( time < noobtiempo )
  3423. {
  3424. new min, Float:sec;
  3425. min = floatround(faster, floatround_floor)/60;
  3426. sec = faster - (60*min);
  3427. ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_IMPROVE", min, sec < 10 ? "0" : "", sec);
  3428.  
  3429. if( (i + 1) == 1)
  3430. {
  3431. client_cmd(0, "spk woop");
  3432. ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #1^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
  3433. }
  3434. else
  3435. {
  3436. client_cmd(0, "spk buttons/bell1");
  3437. ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #%d^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
  3438. }
  3439. }
  3440. }
  3441. else
  3442. {
  3443. if( (i + 1) == 1)
  3444. {
  3445. client_cmd(0, "spk woop");
  3446. ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #1^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
  3447. }
  3448. else
  3449. {
  3450. client_cmd(0, "spk buttons/bell1");
  3451. ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #%d^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
  3452. }
  3453. }
  3454. return;
  3455. }
  3456.  
  3457. 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)) )
  3458. {
  3459. if( time > noobtiempo )
  3460. {
  3461.  
  3462. new min, Float:sec;
  3463. min = floatround(slower, floatround_floor)/60;
  3464. sec = slower - (60*min);
  3465. ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_SLOWER", min, sec < 10 ? "0" : "", sec);
  3466. return;
  3467. }
  3468. }
  3469.  
  3470. }
  3471. }
  3472.  
  3473. public save_Noob15()
  3474. {
  3475. new profile[128]
  3476. formatex(profile, 127, "%s/Noob_%s.cfg", Topdir, MapName)
  3477.  
  3478. if( file_exists(profile) )
  3479. {
  3480. delete_file(profile)
  3481. }
  3482.  
  3483. new Data[256];
  3484. new f = fopen(profile, "at")
  3485.  
  3486. for(new i = 0; i < 15; i++)
  3487. {
  3488. 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])
  3489. fputs(f, Data)
  3490. }
  3491. fclose(f);
  3492. }
  3493.  
  3494. public read_Noob15()
  3495. {
  3496. new profile[128], prodata[256]
  3497. formatex(profile, 127, "%s/Noob_%s.cfg", Topdir, MapName)
  3498.  
  3499. new f = fopen(profile, "rt" )
  3500. new i = 0
  3501. while( !feof(f) && i < 16)
  3502. {
  3503. fgets(f, prodata, 255)
  3504. new totime[25], checks[5], gochecks[5]
  3505. parse(prodata, totime, 24, Noob_AuthIDS[i], 31, Noob_Names[i], 31, checks, 4, gochecks, 4, Noob_Date[i], 31, Noob_Weapon[i], 31)
  3506. Noob_Tiempos[i] = str_to_float(totime)
  3507. Noob_CheckPoints[i] = str_to_num(checks)
  3508. Noob_GoChecks[i] = str_to_num(gochecks)
  3509. i++;
  3510. }
  3511. fclose(f)
  3512. }
  3513.  
  3514. public ProTop_show(id)
  3515. {
  3516. new buffer[2048], len, name[32]
  3517.  
  3518. len = formatex(buffer, 2047, "<body bgcolor=#FFFFFF><table width=100%% cellpadding=2 cellspacing=0 border=0>")
  3519. len += formatex(buffer[len], 2047-len, "<tr align=center bgcolor=#0052FF><th width=5%%> # <th width=45%% align=center> Player <th width=30%%> Time <th width=20%%> Date ")
  3520.  
  3521. for (new i = 0; i < 10; i++)
  3522. {
  3523. name = Pro_Names[i]
  3524.  
  3525. if( Pro_Times[i] > 9999999.0 )
  3526. {
  3527. len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=center> %s <td> %s <td> %s", ((i%2)==0) ? " bgcolor=#FFFFFF" : " bgcolor=#3399FF", (i+1), "", "", "")
  3528. }
  3529.  
  3530. else
  3531. {
  3532. new minutos, Float:segundos
  3533. minutos = floatround(Pro_Times[i], floatround_floor)/60
  3534. segundos = Pro_Times[i] - (60*minutos)
  3535.  
  3536. len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=center> %s <td> <b>%02d:%s%.2f <td> %s", ((i%2)==0) ? " bgcolor=#FFFFFF" : " bgcolor=#3399FF", (i+1), Pro_Names[i], minutos, segundos < 10 ? "0" : "", segundos, Pro_Date[i])
  3537.  
  3538. }
  3539. }
  3540.  
  3541. len += formatex(buffer[len], 2047-len, "</table></body>")
  3542. len += formatex(buffer[len], 2047-len, "<tr><Center><b><BR>www.kz-arg.com")
  3543.  
  3544. show_motd(id, buffer, "Pro10 Kreedz")
  3545.  
  3546. return PLUGIN_HANDLED
  3547. }
  3548.  
  3549. public NoobTop_show(id)
  3550. {
  3551. new buffer[2048], name[32], len
  3552.  
  3553. len = formatex(buffer, 2047, "<body bgcolor=#FFFFFF><table width=100%% cellpadding=2 cellspacing=0 border=0>")
  3554. len += formatex(buffer[len], 2047-len, "<tr align=center bgcolor=#0052FF><th width=5%%> # <th width=35%% align=center> Player <th width=20%%> Time <th width=10%%> CPs <th width=10%%> TPs <th width=10%%> Date")
  3555.  
  3556. for (new i = 0; i < 10; i++)
  3557. {
  3558. if( Noob_Tiempos[i] > 9999999.0 )
  3559. {
  3560. len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=center> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? " bgcolor=#FFFFFF" : " bgcolor=#3399FF", (i+1), "", "", "", "", "")
  3561. }
  3562.  
  3563. else
  3564. {
  3565. name = Noob_Names[i]
  3566. new minutos, Float:segundos
  3567. minutos = floatround(Noob_Tiempos[i], floatround_floor)/60
  3568. segundos = Noob_Tiempos[i] - (60*minutos)
  3569.  
  3570. len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=center> %s%s <td> <b>%02d:%s%.2f <td> %d <td> %d <td> %s", ((i%2)==0) ? " bgcolor=#FFFFFF" : " 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])
  3571. }
  3572. }
  3573.  
  3574. len += formatex(buffer[len], 2047-len, "</table></body>")
  3575. len += formatex(buffer[len], 2047-len, "<tr><Center><b><BR>www.kz-arg.com")
  3576.  
  3577. show_motd(id, buffer, "Noob10 Kreedz")
  3578.  
  3579. return PLUGIN_HANDLED
  3580. }
  3581. #endif
  3582.  
  3583.  
  3584. public customStart (id)
  3585. {
  3586. if( !is_user_alive( id ) )
  3587. {
  3588. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  3589. return PLUGIN_HANDLED
  3590. }
  3591.  
  3592. if( !( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id))
  3593. {
  3594. kz_chat(id, "%L", id, "KZ_CHECKPOINT_AIR")
  3595. return PLUGIN_HANDLED
  3596. }
  3597.  
  3598. if( IsPaused[id] )
  3599. {
  3600. kz_chat(id, "%L", id, "KZ_CHECKPOINT_PAUSE")
  3601. return PLUGIN_HANDLED
  3602. }
  3603.  
  3604. pev(id, pev_origin, MyStartPos[id])
  3605. MyStart[id] = true
  3606. kz_chat(id, "Custom start position saved.")
  3607.  
  3608. return PLUGIN_HANDLED
  3609. }
  3610.  
  3611. //=======================Give Hook by f0rged=======================
  3612.  
  3613. public set_hook(id)
  3614. {
  3615. set_hook_menu(id, 0)
  3616.  
  3617. return PLUGIN_HANDLED
  3618. }
  3619.  
  3620. stock set_hook_menu(id, page)
  3621. {
  3622. if( ! (get_user_flags( id ) & KZ_LEVEL ) )
  3623. {
  3624. ColorChat(id, GREEN, "%s Only admins can give hook.", prefix)
  3625. return PLUGIN_HANDLED;
  3626. }
  3627.  
  3628. new menu = menu_create("\rKZ-Argentina \wGive Hook", "set_hook_show")
  3629. new count = 0
  3630. givehook[id][0] = 0
  3631.  
  3632. for(new i = 1; i <= 32 ; i++)
  3633. {
  3634. if( is_user_connected(i) )
  3635. {
  3636. count++
  3637. new showmsg[64], name[32], countt[4]
  3638. get_user_name(i, name, 31)
  3639. formatex(showmsg, 63, "\w %s - %s", name, !canusehook[i] && !(get_user_flags(i) & KZ_LEVEL) ? "\y[\dOFF\y]" : "\y[\rON\y]")
  3640. num_to_str(count, countt, 3)
  3641. menu_additem(menu, showmsg, countt, 0)
  3642. givehook[id][count] = i
  3643. }
  3644. }
  3645.  
  3646. menu_display(id, menu, page)
  3647.  
  3648. return PLUGIN_HANDLED;
  3649. }
  3650.  
  3651. public set_hook_show(id, menu, item)
  3652. {
  3653. if(item == MENU_EXIT)
  3654. {
  3655. return PLUGIN_HANDLED
  3656. }
  3657.  
  3658. new lediohook[32]
  3659. new data[6], iName[64]
  3660. new access, callback
  3661.  
  3662. menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
  3663.  
  3664. new key = str_to_num(data)
  3665. new LALA = floatround(str_to_float(data)/7.0001, floatround_floor)
  3666.  
  3667. new i = givehook[id][key]
  3668.  
  3669. canusehook[i] = !canusehook[i]
  3670.  
  3671. set_hook_menu(id, LALA)
  3672. lediohook[i] = true
  3673. if(lediohook[i]){
  3674. new name[32]
  3675. get_user_name(i, name, 31)
  3676. if(!(get_user_flags(i) & KZ_LEVEL))
  3677. ColorChat(id, GREEN, "%s ^x01Hook ha sido %s a ^x04%s^x01.", prefix, canusehook[i] ? "habilitado" : "deshabilitado", name)
  3678. }
  3679. return PLUGIN_HANDLED
  3680. }
  3681.  
  3682. //============================ Goto Lj2 ==============================================
  3683.  
  3684. public gotomenu(id)
  3685. {
  3686.  
  3687. new menu1 = menu_create("\rKZ-Argentina \wGoto Menu: Main", "menugoto");
  3688. menu_additem(menu1, "Start", "1", 0);
  3689. menu_additem(menu1, "Long Jumps", "2", 0);
  3690. menu_additem(menu1, "Bhop Jumps", "3", 0);
  3691. menu_additem(menu1, "Count Jumps", "4", 0);
  3692. menu_additem(menu1, "High Jumps", "5", 0);
  3693. menu_additem(menu1, "Ladder Jumps", "6", 0);
  3694. menu_additem(menu1, "Secret Room", "7", 0);
  3695.  
  3696. menu_display(id, menu1, 0);
  3697. }
  3698.  
  3699. public menugoto(id, menu, item)
  3700. {
  3701. if(item == MENU_EXIT)
  3702. {
  3703. return PLUGIN_HANDLED;
  3704. }
  3705.  
  3706. new data[6], iName[64];
  3707. new access, callback;
  3708.  
  3709. menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
  3710.  
  3711. new key = str_to_num(data);
  3712.  
  3713. switch(key)
  3714. {
  3715. case 1:
  3716. {
  3717. set_pev(id, pev_origin, {-4.830482, 2.784362, -27.968750});
  3718. gotomenu(id);
  3719. }
  3720. case 2:
  3721. {
  3722. ljmenu(id, 0);
  3723. }
  3724. case 3:
  3725. {
  3726. bhopmenu(id, 0);
  3727. }
  3728. case 4:
  3729. {
  3730. cjmenu(id, 0);
  3731. }
  3732. case 5:
  3733. {
  3734. hjmenu(id, 0);
  3735. }
  3736. case 6:
  3737. {
  3738. laddermenu(id, 0);
  3739. }
  3740. case 7:
  3741. {
  3742. set_pev(id, pev_origin, {-778.922546, -1908.944580, 720.031250});
  3743. gotomenu(id);
  3744. }
  3745. }
  3746.  
  3747. return PLUGIN_HANDLED;
  3748. }
  3749.  
  3750. public ljmenu(id, page)
  3751. {
  3752. new menu2 = menu_create("\rKZ-Argentina \wGoto: Long Jumps", "menulj");
  3753.  
  3754. new lala = 1, popo = 219;
  3755. menu_additem(menu2, "\wLj Place ^n^n\yBlocks", "1", 0);
  3756.  
  3757. for(new i = 0; i <= charsmax(lj_position); i++)
  3758. {
  3759. popo++;
  3760. lala++;
  3761. new lugar[5], ljblock[8];
  3762. num_to_str(lala, lugar, 4);
  3763. num_to_str(popo, ljblock, 7);
  3764. menu_additem(menu2, ljblock, lugar, 0);
  3765. }
  3766. menu_setprop(menu2, MPROP_EXITNAME, "\wMain Menu");
  3767.  
  3768. menu_display(id, menu2, page);
  3769. }
  3770.  
  3771. public menulj(id, menu, item)
  3772. {
  3773. if(item == MENU_EXIT)
  3774. {
  3775. gotomenu(id);
  3776. return PLUGIN_HANDLED;
  3777. }
  3778.  
  3779. new data[6], iName[64];
  3780. new access, callback;
  3781.  
  3782. menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
  3783.  
  3784. new key = str_to_num(data);
  3785. new Float:floatkey = str_to_float(data);
  3786.  
  3787. switch( key )
  3788. {
  3789. case 1:
  3790. {
  3791. set_pev(id, pev_origin, place_position[0]);
  3792. ljmenu(id, 0);
  3793. }
  3794. default:
  3795. {
  3796. set_pev(id, pev_origin, lj_position[key-2]);
  3797. ljmenu(id, floatround( floatkey/7.001, floatround_floor));
  3798. }
  3799. }
  3800.  
  3801. return PLUGIN_HANDLED;
  3802. }
  3803.  
  3804. public bhopmenu(id, page)
  3805. {
  3806. new menu3 = menu_create("\rKZ-Argentina \wGoto: Bhop Jumps", "menubhop");
  3807.  
  3808. new lala = 1, popo = 219;
  3809. menu_additem(menu3, "\wBhop Place ^n^n\yBlocks", "1", 0);
  3810.  
  3811. for(new i = 0; i <= charsmax(bhop_position); i++)
  3812. {
  3813. popo++;
  3814. lala++;
  3815. new lugar[5], ljblock[8];
  3816. num_to_str(lala, lugar, 4);
  3817. num_to_str(popo, ljblock, 7);
  3818. menu_additem(menu3, ljblock, lugar, 0);
  3819. }
  3820. menu_setprop(menu3, MPROP_EXITNAME, "\wMain Menu");
  3821.  
  3822. menu_display(id, menu3, page);
  3823. }
  3824.  
  3825. public menubhop(id, menu, item)
  3826. {
  3827. if(item == MENU_EXIT)
  3828. {
  3829. gotomenu(id);
  3830. return PLUGIN_HANDLED;
  3831. }
  3832.  
  3833. new data[6], iName[64];
  3834. new access, callback;
  3835.  
  3836. menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
  3837.  
  3838. new key = str_to_num(data);
  3839. new Float:floatkey = str_to_float(data);
  3840.  
  3841. switch( key )
  3842. {
  3843. case 1:
  3844. {
  3845. set_pev(id, pev_origin, place_position[1]);
  3846. bhopmenu(id, 0);
  3847. }
  3848. default:
  3849. {
  3850. set_pev(id, pev_origin, bhop_position[key-2]);
  3851. bhopmenu(id, floatround( floatkey/7.001, floatround_floor));
  3852. }
  3853. }
  3854.  
  3855. return PLUGIN_HANDLED;
  3856. }
  3857.  
  3858. public cjmenu(id, page)
  3859. {
  3860. new menu4 = menu_create("\rKZ-Argentina \wGoto: Cj Jumps", "menucj");
  3861.  
  3862. new lala = 1, popo = 239;
  3863. menu_additem(menu4, "\wCj Place ^n^n\yBlocks", "1", 0);
  3864.  
  3865. for(new i = 0; i <= charsmax(cj_position); i++)
  3866. {
  3867. popo++;
  3868. lala++;
  3869. new lugar[5], ljblock[8];
  3870. num_to_str(lala, lugar, 4);
  3871. num_to_str(popo, ljblock, 7);
  3872. menu_additem(menu4, ljblock, lugar, 0);
  3873. }
  3874. menu_setprop(menu4, MPROP_EXITNAME, "\wMain Menu");
  3875.  
  3876. menu_display(id, menu4, page);
  3877. }
  3878.  
  3879. public menucj(id, menu, item)
  3880. {
  3881. if(item == MENU_EXIT)
  3882. {
  3883. gotomenu(id);
  3884. return PLUGIN_HANDLED;
  3885. }
  3886.  
  3887. new data[6], iName[64];
  3888. new access, callback;
  3889.  
  3890. menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
  3891.  
  3892. new key = str_to_num(data);
  3893. new Float:floatkey = str_to_float(data);
  3894.  
  3895. switch( key )
  3896. {
  3897. case 1:
  3898. {
  3899. set_pev(id, pev_origin, place_position[2]);
  3900. cjmenu(id, 0);
  3901. }
  3902. default:
  3903. {
  3904. set_pev(id, pev_origin, cj_position[key-2]);
  3905. cjmenu(id, floatround( floatkey/7.001, floatround_floor));
  3906. }
  3907. }
  3908.  
  3909. return PLUGIN_HANDLED;
  3910. }
  3911.  
  3912. public hjmenu(id, page)
  3913. {
  3914. new menu5 = menu_create("\rKZ-Argentina \wGoto: High Jumps", "menuhj");
  3915.  
  3916. new lala = 1, popo = 219;
  3917. menu_additem(menu5, "\wHj Place ^n^n\yBlocks", "1", 0);
  3918.  
  3919. for(new i = 0; i <= charsmax(hj_position); i++)
  3920. {
  3921. popo++;
  3922. lala++;
  3923. new lugar[5], ljblock[8];
  3924. num_to_str(lala, lugar, 4);
  3925. num_to_str(popo, ljblock, 7);
  3926. menu_additem(menu5, ljblock, lugar, 0);
  3927. }
  3928. menu_setprop(menu5, MPROP_EXITNAME, "\wMain Menu");
  3929.  
  3930. menu_display(id, menu5, page);
  3931. }
  3932.  
  3933. public menuhj(id, menu, item)
  3934. {
  3935. if(item == MENU_EXIT)
  3936. {
  3937. gotomenu(id);
  3938. return PLUGIN_HANDLED;
  3939. }
  3940.  
  3941. new data[6], iName[64];
  3942. new access, callback;
  3943.  
  3944. menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
  3945.  
  3946. new key = str_to_num(data);
  3947. new Float:floatkey = str_to_float(data);
  3948.  
  3949. switch( key )
  3950. {
  3951. case 1:
  3952. {
  3953. set_pev(id, pev_origin, place_position[3]);
  3954. hjmenu(id, 0);
  3955. }
  3956. default:
  3957. {
  3958. set_pev(id, pev_origin, hj_position[key-2]);
  3959. hjmenu(id, floatround( floatkey/7.001, floatround_floor));
  3960. }
  3961. }
  3962.  
  3963. return PLUGIN_HANDLED;
  3964. }
  3965.  
  3966. public laddermenu(id, page)
  3967. {
  3968. new menu6 = menu_create("\rKZ-Argentina \wGoto: Ladder Jumps", "menuladder");
  3969.  
  3970. new lala = 1, popo = 149;
  3971. menu_additem(menu6, "\wLadder Place ^n^n\yBlocks", "1", 0);
  3972.  
  3973. for(new i = 0; i <= charsmax(ladder_position); i++)
  3974. {
  3975. popo++;
  3976. lala++;
  3977. new lugar[5], ljblock[8];
  3978. num_to_str(lala, lugar, 4);
  3979. num_to_str(popo, ljblock, 7);
  3980. menu_additem(menu6, ljblock, lugar, 0);
  3981. }
  3982. menu_setprop(menu6, MPROP_EXITNAME, "\wMain Menu");
  3983.  
  3984. menu_display(id, menu6, page);
  3985. }
  3986.  
  3987. public menuladder(id, menu, item)
  3988. {
  3989. if(item == MENU_EXIT)
  3990. {
  3991. gotomenu(id);
  3992. return PLUGIN_HANDLED;
  3993. }
  3994.  
  3995. new data[6], iName[64];
  3996. new access, callback;
  3997.  
  3998. menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
  3999.  
  4000. new key = str_to_num(data);
  4001. new Float:floatkey = str_to_float(data);
  4002.  
  4003. switch( key )
  4004. {
  4005. case 1:
  4006. {
  4007. set_pev(id, pev_origin, place_position[4]);
  4008. laddermenu(id, 0);
  4009. }
  4010. default:
  4011. {
  4012. set_pev(id, pev_origin, ladder_position[key-2]);
  4013. laddermenu(id, floatround( floatkey/7.001, floatround_floor));
  4014. }
  4015. }
  4016.  
  4017. return PLUGIN_HANDLED;
  4018. }
  4019.  
  4020. public hooksay(id)
  4021. {
  4022. new args[64], commando[12], tipo[12], bloke[4];
  4023. read_args(args, 63);
  4024. remove_quotes(args);
  4025.  
  4026. if( containi(args, "goto") == -1 && args[0] != '/' )
  4027. return PLUGIN_CONTINUE;
  4028.  
  4029. parse(args, commando, 11, tipo, 11, bloke, 3);
  4030.  
  4031. if( equali(commando, "/goto", 4) && equali(tipo, "") )
  4032. {
  4033. gotomenu(id);
  4034. return PLUGIN_CONTINUE;
  4035. }
  4036. else if( equali(commando, "/goto", 4) )
  4037. {
  4038. new lalin = str_to_num(bloke);
  4039.  
  4040. if( equali(tipo, "lj") )
  4041. {
  4042. if( is_block_valid(lalin, 220, 265) )
  4043. {
  4044. set_pev(id, pev_origin, lj_position[lalin-220]);
  4045. ColorChat(id, GREEN, "%s ^x01Moved to Lj Block: %i", prefix, lalin);
  4046. }
  4047. else
  4048. {
  4049. set_pev(id, pev_origin, place_position[0]);
  4050. ColorChat(id, GREEN, "%s ^x01Moved to Long Jumps Place", prefix);
  4051. }
  4052. }
  4053. else if( equali(tipo, "bhop") )
  4054. {
  4055. if( is_block_valid(lalin, 220, 250) )
  4056. {
  4057. set_pev(id, pev_origin, bhop_position[lalin-220]);
  4058. ColorChat(id, GREEN, "%s ^x01Moved to Bhop Block: %i", prefix, lalin);
  4059. }
  4060. else
  4061. {
  4062. set_pev(id, pev_origin, place_position[1]);
  4063. ColorChat(id, GREEN, "%s ^x01Moved to Bhop Place", prefix);
  4064. }
  4065. }
  4066. else if( equali(tipo, "cj") )
  4067. {
  4068. if( is_block_valid(lalin, 240, 275) )
  4069. {
  4070. set_pev(id, pev_origin, cj_position[lalin-240]);
  4071. ColorChat(id, GREEN, "%s ^x01Moved to Cj Block: %i", prefix, lalin);
  4072. }
  4073. else
  4074. {
  4075. set_pev(id, pev_origin, place_position[2]);
  4076. ColorChat(id, GREEN, "%s ^x01Moved to Count Jumps Place", prefix);
  4077. }
  4078. }
  4079. else if( equali(tipo, "hj") )
  4080. {
  4081. if( is_block_valid(lalin, 220, 250) )
  4082. {
  4083. set_pev(id, pev_origin, hj_position[lalin-220]);
  4084. ColorChat(id, GREEN, "%s ^x01Moved to Hj Block: %i", prefix, lalin);
  4085. }
  4086. else
  4087. {
  4088. set_pev(id, pev_origin, place_position[3]);
  4089. ColorChat(id, GREEN, "%s ^x01Moved to High Jumps Place", prefix);
  4090. }
  4091. }
  4092. else if( equali(tipo, "ladder") )
  4093. {
  4094. if( is_block_valid(lalin, 150, 170) )
  4095. {
  4096. set_pev(id, pev_origin, ladder_position[lalin-150]);
  4097. ColorChat(id, GREEN, "%s ^x01Moved to Ladder Block: %i", prefix, lalin);
  4098. }
  4099. else
  4100. {
  4101. set_pev(id, pev_origin, place_position[4]);
  4102. ColorChat(id, GREEN, "%s ^x01Moved to Ladders Place", prefix);
  4103. }
  4104. }
  4105. else if( equali(tipo, "start") )
  4106. {
  4107. set_pev(id, pev_origin, {-4.830482, 2.784362, -27.968750});
  4108. ColorChat(id, GREEN, "%s ^x01Moved to Start Position", prefix);
  4109. }
  4110. else if( containi(tipo, "room") != -1 )
  4111. {
  4112. set_pev(id, pev_origin, {-778.922546, -1908.944580, 720.031250});
  4113. ColorChat(id, GREEN, "%s ^x01Moved to Secret Room", prefix);
  4114. }
  4115.  
  4116. return PLUGIN_HANDLED;
  4117. }
  4118.  
  4119. return PLUGIN_CONTINUE;
  4120. }
  4121.  
  4122. stock is_block_valid(value, num1, num2)
  4123. {
  4124. if( value >= num1 && value <= num2 )
  4125. return true;
  4126.  
  4127. return false;
  4128. }
  4129.  
  4130. // You reached the end of file
  4131. // The original plugin was made by p4ddY
  4132. // This plugin was edited by f0rged
  4133. // Version 2.31
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement