Advertisement
Guest User

Untitled

a guest
Feb 13th, 2017
555
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 150.40 KB | None | 0 0
  1. ///Added Autojoin
  2. ///Added Semiclip
  3. ///Added Allchat (if have any other say plugin you must add upper then prokreedz in plugins.ini)
  4. ///Added Block Kill
  5. ///Added Block Change Team
  6. ///Added No Buyzone
  7. ///NonSpriteGlowfix
  8. ///Added Silencer Cvar kz_weapon_silencer
  9. ///Added Cvar kz_admin_check
  10. ///HudTextArgs Blocker
  11. ///Invis Fixed in Spec
  12. ///Hook Fixed through player
  13. ///Added /wr command uncomment DOWNLOAD_NEW_WR if Not Local demos.txt and demoz.txt
  14. ///Added Tp To Finish in Teleport menu
  15. ///Added Owner & BOT in aiming player
  16. ///Added Cvar Show WR Different Time kz_wr_diff (FIXED)
  17. ///Added Added Pro1 Show and Nub1 Show if SQL DEFINED (Finish Msg or WR or in spec).
  18. ///Added Description server cvar kz_gamename
  19. ///Added define KZ_DUEL and cvar kz_duel
  20. ///Delete Dropped Weapons or on death and when drop alive
  21. ///Fixed NVG on SPEC And Damage -HP on spec
  22.  
  23. #include <amxmodx>
  24. #include <amxmisc> //cmd_access
  25. #include <cstrike>
  26. #include <colorchat>
  27. #include <fun>
  28. #include <fakemeta>
  29. #include <hamsandwich>
  30. #include <engine>
  31. #include <dhudmessage>
  32. #include <xs>
  33.  
  34.  
  35. #define USE_SQL
  36. //#define KZ_DUEL
  37. //#define CREATE_TABLES_1ST_TIME
  38.  
  39. #if defined USE_SQL
  40. #include <sqlx>
  41. #include <geoip>
  42. #endif
  43.  
  44. //===========================WR===============================//
  45.  
  46. //#define DOWNLOAD_NEW_WR ////////////// if you want download (update) uncomment it
  47.  
  48.  
  49. #if defined DOWNLOAD_NEW_WR ///////////////////////////////////
  50.  
  51. #include <sockets>
  52. new const g_szDemoFiles[][][] =
  53. {
  54. { "http://kreedz.uz/demos.txt", "demos.txt", "demos_last_update_xj.txt" },
  55. { "http://kreedz.uz/demoz.txt", "demoz.txt", "demos_last_update_cc.txt" }
  56. };
  57. enum _:RecordDemo
  58. {
  59. URLS,
  60. DEMOS,
  61. UPDATEDEMOS
  62. }
  63.  
  64. new g_szDemosBuffer[25001];
  65.  
  66. #else /////////////////////////////////////////////
  67.  
  68. new const g_szDemoFiles[][][] =
  69. {
  70. { "demos.txt" },
  71. { "demoz.txt" }
  72. };
  73. enum _:RecordDemo
  74. {
  75. DEMOS
  76. }
  77. #endif //////////////////////////////////////////////
  78.  
  79. new const g_szDirFile[] = "kzrecords";
  80.  
  81. new Float:g_flWorldRecordTime[5];
  82. new Float:DiffWRTime[16];
  83. new g_szWorldRecordPlayer[5][32];
  84.  
  85. new g_szDir[128];
  86. new g_szMapName[32];
  87. new g_iWorldRecordsNum;
  88. new norecord;
  89. new g_szWorldExt[5][20];
  90. new g_szWorldRecords[256];
  91.  
  92. #if defined USE_SQL
  93.  
  94. new proinfo[64], noobinfo[64], myproinfo[33][64], mynoobinfo[33][64]
  95. new bool:MyPosUpdated[33]
  96. new bool:TopUpdated
  97. new bool:FinishMsg
  98.  
  99. #endif
  100.  
  101. new g_entid[33]
  102. new g_maxents
  103.  
  104. //===========================END OF WR===============================//
  105.  
  106. #define KZ_LEVEL ADMIN_KICK
  107. #define MSG MSG_ONE_UNRELIABLE
  108. #define MAX_ENTITYS 900+15*32
  109. #define IsOnLadder(%1) (pev(%1, pev_movetype) == MOVETYPE_FLY)
  110. #define VERSION "2.31"
  111.  
  112. #define is_user(%1) (1 <= %1 <= get_maxplayers())
  113.  
  114. #define TEAM_SELECT_VGUI_MENU_ID 2
  115.  
  116. #define SCOREATTRIB_NONE 0
  117. #define SCOREATTRIB_DEAD ( 1 << 0 )
  118. #define SCOREATTRIB_BOMB ( 1 << 1 )
  119. #define SCOREATTRIB_VIP ( 1 << 2 )
  120.  
  121. #define SEMICLIP_RENDERING_RADIUS 400.0
  122. const Float:SEMICLIP_RADIUS = SEMICLIP_RENDERING_RADIUS;
  123.  
  124. #define TASK_INFO 12222
  125. #define TASK_INFO_KREEDZ 17232
  126. #define TASK_GETTOP 12583
  127. #define SHOW_POS_TASK 87631
  128. #define SHOW_BEACON 87632
  129. #define SHOW_BEACON1 87633
  130.  
  131. #define WBOX "models/w_weaponbox.mdl"
  132. #define BOMB "models/w_backpack.mdl"
  133. #define SHLD "models/w_shield.mdl"
  134.  
  135. ///=======================Measure ===============/////////////
  136. #define TASK_BEAM 45896
  137.  
  138. new Float:g_vFirstLoc[33][3];
  139. new Float:g_vSecondLoc[33][3];
  140.  
  141. new bool:g_bReturnFloat[33];
  142. new bool:g_bShowBeams[33];
  143. new bool:g_bDetailedResults[33];
  144. new bool:g_bAutoSetting[33];
  145. new id_spectated[33]
  146.  
  147. new g_iColors[3] = { 255, 85, 0 };
  148.  
  149. new g_flBeam;
  150.  
  151. ////=====================Measure ======================///////////
  152.  
  153.  
  154. //////////////////////admin_check/////////////////////
  155. #define ADMIN_CHECK ADMIN_KICK
  156.  
  157. static const COLOR[] = "^x01" //yellow
  158. // static const COLOR1[] = "^x03" //blue
  159. // static const COLOR2[] = "^x04" //green
  160. static const CONTACT[] = ""
  161.  
  162. ///////////////////admin_check///////////////////////
  163.  
  164. //////////////////////////hudtextargblock/////////////////
  165.  
  166. const NextHudTextArgsOffset = 198 // ConnorMcLeod
  167.  
  168. const HintMaxLen = 38
  169.  
  170. new Hints[][HintMaxLen] =
  171. {
  172. "hint_win_round_by_killing_enemy",
  173. "hint_press_buy_to_purchase",
  174. "hint_spotted_an_enemy",
  175. "hint_use_nightvision",
  176. "hint_lost_money",
  177. "hint_removed_for_next_hostage_killed",
  178. "hint_careful_around_hostages",
  179. "hint_careful_around_teammates",
  180. "hint_reward_for_killing_vip",
  181. "hint_win_round_by_killing_enemy",
  182. "hint_try_not_to_injure_teammates",
  183. "hint_you_are_in_targetzone",
  184. "hint_hostage_rescue_zone",
  185. "hint_terrorist_escape_zone",
  186. "hint_ct_vip_zone",
  187. "hint_terrorist_vip_zone",
  188. "hint_cannot_play_because_tk",
  189. "hint_use_hostage_to_stop_him",
  190. "hint_lead_hostage_to_rescue_point",
  191. "hint_you_have_the_bomb",
  192. "hint_you_are_the_vip",
  193. "hint_out_of_ammo",
  194. "hint_spotted_a_friend",
  195. "hint_spotted_an_enemy",
  196. "hint_prevent_hostage_rescue",
  197. "hint_rescue_the_hostages",
  198. "hint_press_use_so_hostage_will_follow"
  199. }
  200.  
  201. new HintsDefaultStatus[sizeof Hints] =
  202. {
  203. 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
  204. }
  205.  
  206. new Trie:HintsStatus
  207.  
  208.  
  209. //////////////////////////hudtextargblock/////////////////
  210.  
  211. new bool:isFalling[33]
  212. new bool:isMpbhop[33]
  213. new Float:vFallingStart[33][3]
  214. new Float:MpbhopOrigin[33][3]
  215. new Float:vFallingTime[33]
  216.  
  217. new g_iPlayers[32], g_iNum
  218. new Float:hp_spec[33]
  219.  
  220.  
  221. new const FL_ONGROUND2 = ( FL_ONGROUND | FL_PARTIALGROUND | FL_INWATER | FL_CONVEYOR | FL_FLOAT )
  222. new const KZ_STARTFILE[] = "start.ini"
  223. new const KZ_STARTFILE_TEMP[] = "temp_start.ini"
  224.  
  225. new const KZ_FINISHFILE[] = "finish.ini"
  226. new const KZ_FINISHFILE_TEMP[] = "temp_finish.ini"
  227.  
  228. #if defined USE_SQL
  229. new bool:sqlconnected
  230. new Handle:g_SqlTuple
  231. new Handle:SqlConnection
  232. new g_Error[512]
  233. new kz_sql_host
  234. new kz_sql_user
  235. new kz_sql_pass
  236. new kz_sql_db
  237. new kz_sql_name
  238. new kz_sql_files
  239. #else
  240. new Float:Pro_Times[24]
  241. new Pro_AuthIDS[24][32]
  242. new Pro_Names[24][32]
  243. new Pro_Date[24][32]
  244. new Float:Noob_Tiempos[24]
  245. new Noob_AuthIDS[24][32]
  246. new Noob_Names[24][32]
  247. new Noob_Date[24][32]
  248. new Noob_CheckPoints[24]
  249. new Noob_GoChecks[24]
  250. new Noob_Weapon[24][32]
  251. #endif
  252.  
  253. new max_players;
  254. new g_maxplayers;
  255. new Float:gCheckpointAngle[33][3];
  256. new Float:gLastCheckpointAngle[33][3];
  257. new Float:gCheckpointStartAngle[33][3];
  258. new Float:gLastCheckpointStartAngle[33][3];
  259. new Float:Checkpoints[33][2][3]
  260. new Float:InPauseCheckpoints[33][2][3]
  261. new Float:CheckpointStarts[33][2][3]
  262. new Float:timer_time[33]
  263. new Float:g_pausetime[33]
  264. new Float:antihookcheat[33]
  265. new Float:antidiestart[33]
  266. new g_iHookWallOrigin[33][3];
  267. new Float:antinoclipstart[33]
  268. new Float:antiteleport[33]
  269. new Float:SpecLoc[33][3]
  270. new Float:PauseOrigin[33][3]
  271. new Float:SavedStart[33][3]
  272. new Float:SavedStop[33][3]
  273. new hookorigin[33][3]
  274. new Float:DefaultStartPos[3]
  275. new Float:DefaultStopPos[3]
  276.  
  277. new Float:SavedTime[33]
  278. new SavedChecks[33]
  279. new SavedGoChecks[33]
  280. new SavedScout[33]
  281. new SavedOrigins[33][3]
  282. new SavedVelocity[33][3]
  283. new Float:pausedvelocity[33][3]
  284.  
  285. new bool:gCheckpoint[33];
  286. new bool:gCheckpointStart[33];
  287. new bool:g_bCpAlternate[33]
  288. new bool:g_bInPauseCpAlternate[33]
  289. new bool:g_bCpAlternateStart[33]
  290. new bool:timer_started[33]
  291. new bool:IsPaused[33]
  292. new bool:StartSound[33]
  293. new bool:WasPlayed[33]
  294. new bool:firstspawn[33]
  295. new bool:canusehook[33]
  296. new bool:ishooked[33]
  297. new bool:GoPosed[33]
  298. new bool:GoPosCp[33]
  299. new bool:GoPosHp[33]
  300. new bool:user_has_scout[33]
  301. new bool:spec_user[33]
  302. new bool:tphook_user[33]
  303. new bool:menushow[33]
  304. new bool:block_change[33]
  305. new bool:tptostart[33]
  306. new bool:NightVisionUse[33]
  307. new bool:HealsOnMap
  308. new bool:gViewInvisible[33]
  309. new bool:gWaterInvisible[33]
  310. new bool:gWaterEntity[MAX_ENTITYS]
  311. new bool:gWaterFound
  312. new bool:DefaultStart
  313. new bool:DefaultStop
  314. new bool:AutoStart[33]
  315. new bool:Autosavepos[33]
  316. new bool:tpfenabled[33]
  317. new bool:gc1[33]
  318.  
  319. new Trie:g_tStarts
  320. new Trie:g_tStops;
  321.  
  322. new checknumbers[33]
  323. new inpausechecknumbers[33]
  324. new gochecknumbers[33]
  325. new chatorhud[33]
  326. new MapName[64]
  327. new Kzdir[128]
  328. new SavePosDir[128]
  329. new prefix[33]
  330. #if !defined USE_SQL
  331. new Topdir[128]
  332. #endif
  333.  
  334. new iconstatus
  335. new kz_help
  336. new kz_autosavepos
  337. new kz_gamename
  338. new kz_spawn_mainmenu
  339. new kz_duel
  340. new kz_admin_check
  341. new kz_hud_color
  342. new kz_chat_prefix
  343. new hud_message
  344. new kz_other_weapons
  345. new kz_maxspeedmsg
  346. new kz_weapon_silencer
  347. new kz_wr_diff
  348. new kz_drop_weapons
  349. new kz_pick_weapons
  350. new kz_use_radio
  351. new kz_hook_sound
  352. new kz_hook_speed
  353. new kz_nvg
  354. new kz_nvg_colors
  355. new kz_vip
  356. new kz_save_pos
  357. new kz_top15_authid
  358. new Sbeam = 0
  359. new my_sprite
  360.  
  361.  
  362. new g_msgid_SayText;
  363.  
  364. new const textchannels[][] = {
  365. "#Cstrike_Chat_T",
  366. "#Cstrike_Chat_CT",
  367. "#Cstrike_Chat_Spec",
  368. "#Cstrike_Chat_All",
  369. "#Cstrike_Chat_AllSpec",
  370. "#Cstrike_Chat_AllDead",
  371. "#Cstrike_Chat_T_Dead",
  372. "#Cstrike_Chat_CT_Dead"
  373. };
  374.  
  375.  
  376. new const other_weapons[8] =
  377. {
  378. CSW_SCOUT, CSW_P90, CSW_FAMAS, CSW_SG552,
  379. CSW_M4A1, CSW_M249, CSW_AK47, CSW_AWP
  380. }
  381.  
  382. new const other_weapons_name[8][] =
  383. {
  384. "weapon_scout", "weapon_p90", "weapon_famas", "weapon_sg552",
  385. "weapon_m4a1", "weapon_m249", "weapon_ak47", "weapon_awp"
  386. }
  387.  
  388. new const g_weaponsnames[][] =
  389. {
  390. "", // NULL
  391. "p228", "shield", "scout", "hegrenade", "xm1014", "c4",
  392. "mac10", "aug", "smokegrenade", "elite", "fiveseven",
  393. "ump45", "sg550", "galil", "famas", "usp", "glock18",
  394. "awp", "mp5navy", "m249", "m3", "m4a1", "tmp", "g3sg1",
  395. "flashbang", "deagle", "sg552", "ak47", "knife", "p90",
  396. "glock", "elites", "fn57", "mp5", "vest", "vesthelm",
  397. "flash", "hegren", "sgren", "defuser", "nvgs", "primammo",
  398. "secammo", "km45", "9x19mm", "nighthawk", "228compact",
  399. "12gauge", "autoshotgun", "mp", "c90", "cv47", "defender",
  400. "clarion", "krieg552", "bullpup", "magnum", "d3au1",
  401. "krieg550"
  402. }
  403.  
  404. new const g_block_commands[][]=
  405. {
  406. "buy", "buyammo1", "buyammo2", "buyequip",
  407. "cl_autobuy", "cl_rebuy", "cl_setautobuy", "cl_setrebuy"
  408.  
  409. }
  410.  
  411. #if defined USE_SQL
  412. enum
  413. {
  414. TOP_NULL,
  415. PRO_TOP,
  416. NUB_TOP,
  417. LAST_PRO10,
  418. PRO_RECORDS,
  419. PLAYERS_RANKING,
  420. MAPS_STATISTIC
  421. }
  422. #endif
  423.  
  424. ////////////////////////////////////////////////////////////////
  425.  
  426. const groupNone = 0;
  427.  
  428. enum _:renderGroups ( <<= 1 )
  429. {
  430. groupRenderVisible = 0b1, // 0b1
  431. groupRenderInvisible, // 0b10
  432. }
  433.  
  434. new const CLASS_PLAYER[] = "player";
  435.  
  436. #define IsPlayer(%0) ( 1 <= (%0) <= g_iMaxPlayers )
  437. #define MaskEnt(%0) ( 1<<(%0 & 31) )
  438.  
  439. new g_bitIsPlayerInSphere;
  440. #define MarkPlayerInSphere(%0) g_bitIsPlayerInSphere |= MaskEnt(%0)
  441. #define IsPlayerInSphere(%0) ( g_bitIsPlayerInSphere & MaskEnt(%0) )
  442.  
  443. new g_bitIsPlayerAlive;
  444. #define MarkPlayerAlive(%0) g_bitIsPlayerAlive |= MaskEnt(%0)
  445. #define IsPlayerAlive(%0) ( g_bitIsPlayerAlive & MaskEnt(%0) )
  446.  
  447. new g_bitBots;
  448. #define MarkPlayerBot(%0) g_bitBots |= MaskEnt(%0)
  449. #define ClearPlayerBot(%0) g_bitBots &= ~MaskEnt(%0)
  450. #define IsUserBot(%0) ( g_bitBots & MaskEnt(%0) )
  451.  
  452. new g_iLastPlayerIndex;
  453. new HamHook:g_iHhPreThink, HamHook:g_iHhPreThinkPost;
  454. new g_iFhAddToFullPackPost;
  455. new bool:g_bPreThinkHooked;
  456. new bool:g_bReadPackets;
  457. new bool:g_bClientMessages;
  458.  
  459.  
  460. #if defined KZ_DUEL
  461. new bool:plr_nonsteam[33]
  462. native kz_player_duel_cp(id)
  463. native kz_player_in_duel(id)
  464. native kz_player_can_hook(id)
  465. #endif
  466.  
  467. // =================================================================================================
  468.  
  469.  
  470. public plugin_init()
  471. {
  472. register_plugin("ProKreedz", VERSION, "Destroman Edited")
  473. register_clcmd("say /teleport", "Teleport")
  474. g_maxplayers = get_maxplayers()
  475. kz_autosavepos = register_cvar("kz_autosavepos","1")
  476. kz_spawn_mainmenu = register_cvar("kz_spawn_mainmenu", "1")
  477. kz_duel = register_cvar("kz_duel", "1")
  478. kz_gamename = register_cvar("kz_gamename", "KREEDZ")
  479. kz_admin_check = register_cvar("kz_admin_check", "1")
  480. kz_chat_prefix = register_cvar("kz_chat_prefix", "[KZ.M]")
  481. kz_hud_color = register_cvar("kz_hud_color", "0 100 255")
  482. kz_other_weapons = register_cvar("kz_other_weapons","1")
  483. kz_drop_weapons = register_cvar("kz_drop_weapons", "0")
  484. kz_pick_weapons = register_cvar("kz_pick_weapons", "0")
  485. kz_weapon_silencer = register_cvar("kz_weapon_silencer","1")
  486. kz_wr_diff = register_cvar("kz_wr_diff","1")
  487. kz_maxspeedmsg = register_cvar("kz_maxspeedmsg","1")
  488. kz_hook_sound = register_cvar("kz_hook_sound","1")
  489. kz_help = register_cvar("kz_help","1")
  490. kz_hook_speed = register_cvar("kz_hook_speed", "300.0")
  491. kz_use_radio = register_cvar("kz_use_radio", "0")
  492. kz_nvg = register_cvar("kz_nvg","1")
  493. kz_nvg_colors = register_cvar("kz_nvg_colors","248 248 255")
  494. kz_vip = register_cvar("kz_vip","1")
  495. kz_top15_authid = register_cvar("kz_top15_authid", "1")
  496. kz_save_pos = register_cvar("kz_save_pos", "1")
  497. iconstatus = get_user_msgid("StatusIcon");
  498.  
  499. max_players=get_maxplayers()+1;
  500. #if defined USE_SQL
  501. kz_sql_host = register_cvar("kz_sql_host", "") // Host of DB
  502. kz_sql_user = register_cvar("kz_sql_user", "") // Username of DB
  503. kz_sql_pass = register_cvar("kz_sql_pass", "", FCVAR_PROTECTED) // Password for DB user
  504. kz_sql_db = register_cvar("kz_sql_db", "") // DB Name for the top 15
  505. kz_sql_name = register_cvar("kz_sql_server", "") // Name of server
  506. kz_sql_files = register_cvar("kz_sql_files", "") // Path of the PHP files
  507. #endif
  508. register_clcmd("/cp","CheckPoint")
  509. register_clcmd("/ss","CheckPointStart")
  510. register_clcmd("/help","cmd_help")
  511. register_clcmd("/cs","CheckPointStart")
  512. register_clcmd("drop", "BlockDrop")
  513. register_clcmd("/gc", "GoCheck")
  514. register_clcmd("/gcf", "GoCheck1")
  515. register_clcmd("+hook","hook_on",KZ_LEVEL)
  516. register_clcmd("-hook","hook_off",KZ_LEVEL)
  517.  
  518. register_concmd("nightvision","ToggleNVG")
  519. register_clcmd("radio1", "BlockRadio")
  520. register_clcmd("radio2", "BlockRadio")
  521. register_clcmd("radio3", "BlockRadio")
  522. register_clcmd("stuck", "Stuck")
  523. register_clcmd("unstuck", "Stuck")
  524. register_clcmd("/tp","GoCheck")
  525. register_clcmd("/tpf","GoCheck1")
  526. register_clcmd("say menu","kz_menu", 0)
  527.  
  528. register_clcmd("chooseteam", "HookCmdChooseTeam");
  529.  
  530. register_concmd( "measure_color", "cmdChangeColor" );
  531. register_clcmd( "say /measure","cmdMeasure" );
  532. register_clcmd( "say /distance","cmdMeasure" );
  533. register_menucmd( register_menuid( "\rMeasure^n^n" ), 1023, "menuAction" );
  534.  
  535.  
  536. register_message(get_user_msgid("ShowMenu"), "message_show_menu")
  537. register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")
  538. register_message(get_user_msgid("HudTextArgs"),"hudTextArgs")
  539.  
  540.  
  541. kz_register_saycmd("help","cmd_help",0)
  542. kz_register_saycmd("cp","CheckPoint",0)
  543. kz_register_saycmd("ss","CheckPointStart",0)
  544. kz_register_saycmd("cs","CheckPointStart",0)
  545. kz_register_saycmd("chatorhud", "ChatHud", 0)
  546. kz_register_saycmd("ct","ct",0)
  547. kz_register_saycmd("gc", "GoCheck",0)
  548. kz_register_saycmd("gcf", "GoCheck1",0)
  549. kz_register_saycmd("gocheck", "GoCheck",0)
  550. kz_register_saycmd("gocheckf", "GoCheck1",0)
  551. kz_register_saycmd("invis", "InvisMenu", 0)
  552. kz_register_saycmd("kz", "kz_menu", 0)
  553. kz_register_saycmd("menu","kz_menu", 0)
  554. kz_register_saycmd("nc", "noclip", 0)
  555. kz_register_saycmd("noclip", "noclip", 0)
  556. kz_register_saycmd("noob10", "NoobTop_show", 0)
  557. kz_register_saycmd("noob15", "NoobTop_show", 0)
  558. kz_register_saycmd("nub10", "NoobTop_show", 0)
  559. kz_register_saycmd("nub15", "NoobTop_show", 0)
  560. kz_register_saycmd("p", "Pause", 0)
  561. kz_register_saycmd("pause", "Pause", 0)
  562. kz_register_saycmd("unpause", "Pause", 0)
  563. kz_register_saycmd("pinvis", "cmdInvisible", 0)
  564. kz_register_saycmd("pro10", "ProTop_show", 0)
  565. kz_register_saycmd("pro15", "ProTop_show", 0)
  566. kz_register_saycmd("reset", "reset_checkpoints", 0)
  567. kz_register_saycmd("rs", "reset_checkpoints", 0)
  568. kz_register_saycmd("respawn", "goStart1", 0)
  569. kz_register_saycmd("scout", "cmdScout", 0)
  570. kz_register_saycmd("setstart", "setStart", KZ_LEVEL)
  571. kz_register_saycmd("setstop", "setStop", KZ_LEVEL)
  572. kz_register_saycmd("origin", "Origin", KZ_LEVEL)
  573. kz_register_saycmd("spec", "ct", 0)
  574. kz_register_saycmd("start", "goStart", 0)
  575. kz_register_saycmd("stop", "goFinish", 0)
  576. kz_register_saycmd("stuck", "Stuck", 0)
  577. kz_register_saycmd("unstuck", "Stuck", 0)
  578. kz_register_saycmd("teleport", "GoCheck", 0)
  579. kz_register_saycmd("top15", "top15menu",0)
  580. kz_register_saycmd("top10", "top15menu",0)
  581. kz_register_saycmd("tp", "GoCheck",0)
  582. kz_register_saycmd("tpf", "GoCheck1",0)
  583. kz_register_saycmd("usp", "cmdUsp", 0)
  584. kz_register_saycmd("weapons", "weapons", 0)
  585. kz_register_saycmd("guns", "weapons", 0)
  586. kz_register_saycmd("winvis", "cmdWaterInvisible", 0)
  587.  
  588. #if defined USE_SQL
  589. kz_register_saycmd("prorecords", "ProRecs_show", 0)
  590. kz_register_saycmd("prorecs", "ProRecs_show", 0)
  591. #endif
  592.  
  593. register_message( get_user_msgid( "StatusIcon" ), "Msg_StatusIcon" );
  594.  
  595.  
  596. register_event("CurWeapon", "curweapon", "be", "1=1")
  597. register_event( "StatusValue", "EventStatusValue", "b", "1>0", "2>0" );
  598.  
  599. register_forward(FM_AddToFullPack, "FM_client_AddToFullPack_Post", 1)
  600. register_forward( FM_GetGameDescription,"Fwd_GameDesc" );
  601.  
  602. ///////////////////////////////////////////////
  603. register_forward(FM_CmdStart, "OnCmdStart", false);
  604. DisableHamForward( g_iHhPreThink = RegisterHam(Ham_Player_PreThink, CLASS_PLAYER, "OnCBasePlayer_PreThink", false) );
  605. DisableHamForward( g_iHhPreThinkPost = RegisterHam(Ham_Player_PreThink, CLASS_PLAYER, "OnCBasePlayer_PreThink_P", true) );
  606. register_forward(FM_UpdateClientData, "OnUpdateClientData_P", true);
  607.  
  608. /////////////////////////////////////////////////////
  609. register_forward(FM_PlayerPreThink, "fwdPlayerPreThink", 0)
  610. register_forward(FM_ClientKill, "Forward_ClientKill")
  611. RegisterHam( Ham_Use, "func_button", "fwdUse", 0)
  612. RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Pre")
  613. RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1)
  614. RegisterHam( Ham_Touch, "weaponbox", "FwdSpawnWeaponbox" )
  615. RegisterHam( Ham_Touch, "armoury_entity", "FwdSpawnWeaponbox" )
  616. RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", 1 )
  617. RegisterHam( Ham_TakeDamage, "player", "eventHamPlayerDamage")
  618. RegisterHam( Ham_Touch, "worldspawn", "Ham_HookTouch", false);
  619. RegisterHam( Ham_Touch, "func_wall", "Ham_HookTouch", false);
  620. RegisterHam( Ham_Touch, "func_breakable", "Ham_HookTouch", false);
  621. RegisterHam( Ham_Touch, "player", "Ham_HookTouch", false);
  622. register_forward(FM_Think,"fw_ThinkEntity")
  623. new iEnt
  624. iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString , "info_target"))
  625. set_pev(iEnt, pev_classname, "kz_time_think")
  626. set_pev(iEnt, pev_nextthink, get_gametime() + 1.0)
  627.  
  628. g_msgid_SayText = get_user_msgid("SayText");
  629. register_clcmd("say", "HandleSay");
  630. register_clcmd("say_team", "HandleSay");
  631.  
  632. register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib" )
  633. register_dictionary("prokreedz.txt")
  634. get_pcvar_string(kz_chat_prefix, prefix, 31)
  635. get_mapname(MapName, 63)
  636. set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
  637.  
  638. new kreedz_cfg[128], ConfigDir[64]
  639. get_configsdir( ConfigDir, 64)
  640. formatex(Kzdir,128, "%s/kz", ConfigDir)
  641. if( !dir_exists(Kzdir) )
  642. mkdir(Kzdir)
  643.  
  644. #if !defined USE_SQL
  645. formatex(Topdir,128, "%s/top15", Kzdir)
  646. if( !dir_exists(Topdir) )
  647. mkdir(Topdir)
  648. #endif
  649.  
  650.  
  651.  
  652. get_mapname(g_szMapName, sizeof(g_szMapName) - 1);
  653. strtolower(g_szMapName);
  654. CheckRecords()
  655.  
  656. new szModel[ 2 ],
  657. iMaxEntities = get_global_int( GL_maxEntities );
  658.  
  659. while( ++g_maxplayers <= iMaxEntities ) {
  660. if( is_valid_ent( g_maxplayers ) && entity_get_int( g_maxplayers, EV_INT_rendermode ) == kRenderGlow ) {
  661. entity_get_string( g_maxplayers, EV_SZ_model, szModel, 1 );
  662.  
  663. if( szModel[ 0 ] == '*' )
  664. entity_set_int( g_maxplayers, EV_INT_rendermode, kRenderNormal );
  665. }
  666. }
  667.  
  668. formatex(SavePosDir, 128, "%s/savepos", Kzdir)
  669. if( !dir_exists(SavePosDir) )
  670. mkdir(SavePosDir)
  671.  
  672. formatex(kreedz_cfg,128,"%s/kreedz.cfg", Kzdir)
  673.  
  674. if( file_exists( kreedz_cfg ) )
  675. {
  676. server_exec()
  677. server_cmd("exec %s",kreedz_cfg)
  678. }
  679.  
  680. for(new i = 0; i < sizeof(g_block_commands) ; i++)
  681. register_clcmd(g_block_commands[i], "BlockBuy")
  682.  
  683. g_tStarts = TrieCreate( )
  684. g_tStops = TrieCreate( )
  685.  
  686. new const szStarts[ ][ ] =
  687. {
  688. "counter_start", "clockstartbutton", "firsttimerelay", "but_start", "counter_start_button",
  689. "multi_start", "timer_startbutton", "start_timer_emi", "gogogo"
  690. }
  691.  
  692. new const szStops[ ][ ] =
  693. {
  694. "counter_off", "clockstopbutton", "clockstop", "but_stop", "counter_stop_button",
  695. "multi_stop", "stop_counter", "m_counter_end_emi"
  696. }
  697.  
  698. for( new i = 0; i < sizeof szStarts; i++ )
  699. TrieSetCell( g_tStarts, szStarts[ i ], 1 )
  700.  
  701. for( new i = 0; i < sizeof szStops; i++ )
  702. TrieSetCell( g_tStops, szStops[ i ], 1 )
  703.  
  704. }
  705.  
  706.  
  707.  
  708.  
  709.  
  710. public plugin_precache()
  711. {
  712. hud_message = CreateHudSyncObj()
  713. RegisterHam( Ham_Spawn, "func_door", "FwdHamDoorSpawn", 1 )
  714. precache_sound("weapons/xbow_hit2.wav")
  715. Sbeam = precache_model("sprites/lgtning.spr")
  716. precache_sound("warcraft3/resurrecttarget.wav")
  717. precache_sound( "misc/mod_unstopable.wav" );
  718. my_sprite = precache_model("sprites/black_smoke1.spr")
  719. g_flBeam = precache_model( "sprites/zbeam4.spr" );
  720. }
  721.  
  722.  
  723. public plugin_cfg()
  724. {
  725. sqlconnected = false
  726. TopUpdated = true
  727. FinishMsg = false
  728. #if !defined USE_SQL
  729. for (new i = 0 ; i < 15; ++i)
  730. {
  731. Pro_Times[i] = 999999999.00000;
  732. Noob_Tiempos[i] = 999999999.00000;
  733. }
  734.  
  735. read_pro15()
  736. read_Noob15()
  737. #endif
  738.  
  739. HintsStatus = TrieCreate()
  740.  
  741. for(new i=0, statusString[2]; i<sizeof Hints; i++)
  742. {
  743. statusString[0] = HintsDefaultStatus[i] + 48
  744.  
  745. if(get_pcvar_num(register_cvar(Hints[i],statusString)))
  746. TrieSetCell(HintsStatus,Hints[i][5],true)
  747. }
  748.  
  749. new startcheck[100], data[1024], map[64], x[13], y[13], z[13];
  750. formatex(startcheck, 99, "%s/%s", Kzdir, KZ_STARTFILE)
  751. new f = fopen(startcheck, "rt" )
  752. while( !feof( f ) )
  753. {
  754. fgets( f, data, sizeof data - 1 )
  755. parse( data, map, 63, x, 12, y, 12, z, 12)
  756.  
  757. if( equali( map, MapName ) )
  758. {
  759. DefaultStartPos[0] = str_to_float(x)
  760. DefaultStartPos[1] = str_to_float(y)
  761. DefaultStartPos[2] = str_to_float(z)
  762.  
  763. DefaultStart = true
  764. break;
  765. }
  766. }
  767. fclose(f)
  768.  
  769.  
  770. new stopcheck[100], data1[1024], map1[64], x1[13], y1[13], z1[13];
  771. formatex(stopcheck, 99, "%s/%s", Kzdir, KZ_FINISHFILE)
  772. new ff = fopen(stopcheck, "rt" )
  773. while( !feof( ff ) )
  774. {
  775. fgets( ff, data1, sizeof data1 - 1 )
  776. parse( data1, map1, 63, x1, 12, y1, 12, z1, 12)
  777.  
  778. if( equali( map1, MapName ) )
  779. {
  780. DefaultStopPos[0] = str_to_float(x1)
  781. DefaultStopPos[1] = str_to_float(y1)
  782. DefaultStopPos[2] = str_to_float(z1)
  783.  
  784. DefaultStop = true
  785. break;
  786. }
  787. }
  788. fclose(ff)
  789.  
  790. new ent = -1;
  791. while( ( ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_water") ) != 0 )
  792. {
  793. if( !gWaterFound )
  794. {
  795. gWaterFound = true;
  796. }
  797.  
  798. gWaterEntity[ent] = true;
  799. }
  800.  
  801. ent = -1;
  802. while( ( ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_illusionary") ) != 0 )
  803. {
  804. if( pev( ent, pev_skin ) == CONTENTS_WATER )
  805. {
  806. if( !gWaterFound )
  807. {
  808. gWaterFound = true;
  809. }
  810.  
  811. gWaterEntity[ent] = true;
  812. }
  813. }
  814.  
  815. ent = -1;
  816. while( ( ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_conveyor") ) != 0 )
  817. {
  818. if( pev( ent, pev_spawnflags ) == 3 )
  819. {
  820. if( !gWaterFound )
  821. {
  822. gWaterFound = true;
  823. }
  824.  
  825. gWaterEntity[ent] = true;
  826. }
  827. }
  828. }
  829.  
  830.  
  831. public HookCmdChooseTeam(id)
  832. {
  833. return PLUGIN_HANDLED ;
  834. }
  835.  
  836. public message_show_menu(msgid, dest, id) {
  837. if(block_change[id]) {
  838. return PLUGIN_HANDLED
  839. }
  840. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), {0,0,0}, id)
  841. write_short(12288); // 8192 = 2 seconds
  842. write_short(512);
  843. write_short(0x0000);
  844. write_byte(0);
  845. write_byte(0);
  846. write_byte(0);
  847. write_byte(255);
  848. message_end();
  849.  
  850. static team_select[] = "#Team_Select"
  851. static menu_text_code[sizeof team_select]
  852. get_msg_arg_string(4, menu_text_code, sizeof menu_text_code - 1)
  853. if (!equal(menu_text_code, team_select))
  854. return PLUGIN_CONTINUE
  855.  
  856. set_force_team_join_task(id, msgid)
  857. block_change[id] = true
  858. return PLUGIN_HANDLED
  859. }
  860.  
  861. public message_vgui_menu(msgid, dest, id) {
  862. if(block_change[id]) {
  863. return PLUGIN_HANDLED
  864. }
  865. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), {0,0,0}, id)
  866. write_short(12288); // 8192 = 2 seconds
  867. write_short(512);
  868. write_short(0x0000);
  869. write_byte(0);
  870. write_byte(0);
  871. write_byte(0);
  872. write_byte(255);
  873. message_end();
  874.  
  875. if (get_msg_arg_int(1) != TEAM_SELECT_VGUI_MENU_ID )
  876. return PLUGIN_CONTINUE
  877.  
  878. set_force_team_join_task(id, msgid)
  879. block_change[id] = true
  880. return PLUGIN_HANDLED
  881. }
  882.  
  883. set_force_team_join_task(id, menu_msgid) {
  884. static param_menu_msgid[2]
  885. param_menu_msgid[0] = menu_msgid
  886. set_task(0.1, "task_force_team_join", id, param_menu_msgid, sizeof param_menu_msgid)
  887. }
  888.  
  889. public task_force_team_join(menu_msgid[], id) {
  890. if (get_user_team(id))
  891. return
  892. force_team_join(id, menu_msgid[0])
  893. }
  894.  
  895. stock force_team_join(id, menu_msgid) {
  896. static jointeam[] = "jointeam"
  897. static msg_block, joinclass[] = "joinclass"
  898. msg_block = get_msg_block(menu_msgid)
  899. set_msg_block(menu_msgid, BLOCK_SET)
  900. engclient_cmd(id, jointeam, "2")
  901. engclient_cmd(id, joinclass, "5")
  902. set_msg_block(menu_msgid, msg_block)
  903. }
  904.  
  905. //============================================================================= WR ============================================================//
  906.  
  907.  
  908. stock WRTimer(const Float:flRealTime, szOutPut[], const iSizeOutPut, bMiliSeconds = true, gametime = true)
  909. {
  910. static Float:flTime, iMinutes, iSeconds;
  911. if(gametime)
  912. {
  913. flTime = get_gametime() - flRealTime;
  914. }
  915. else
  916. {
  917. flTime = flRealTime;
  918. }
  919. if(flTime < 0.0)
  920. {
  921. flTime = 0.0;
  922. }
  923. iMinutes = floatround(flTime / 60, floatround_floor);
  924. iSeconds = floatround(flTime - (iMinutes * 60), floatround_floor);
  925. formatex(szOutPut, iSizeOutPut, "%02d:%02d", iMinutes, iSeconds);
  926.  
  927. if(bMiliSeconds)
  928. {
  929. static iMiliSeconds;
  930. iMiliSeconds = floatround((flTime - (iMinutes * 60 + iSeconds)) * 100, floatround_round);
  931. format(szOutPut, iSizeOutPut, "%s.%02d", szOutPut, iMiliSeconds);
  932. }
  933. }
  934.  
  935.  
  936.  
  937. stock LoadWorldRecord(map[], szWorldRecord[], iWRsize)
  938. {
  939. new g_iMapNameLen = strlen(map);
  940. new iRecords;
  941.  
  942. new szFile[128];
  943. for(new i; i < 2; i++)
  944. {
  945. format(szFile, sizeof(szFile) - 1, "%s/%s", g_szDir, g_szDemoFiles[i][DEMOS]);
  946. if(file_exists(szFile))
  947. {
  948. new hFile = fopen(szFile, "r");
  949. new szData[128];
  950. new szMapName[64], szTime[14], szAuthor[32], szCountry[2], szExt[25], szCode[6];
  951. while(!feof(hFile))
  952. {
  953. fgets(hFile, szData, sizeof(szData) - 1);
  954. trim(szData);
  955.  
  956. if(!szData[0] || szData[0] == '^n' || !equali(szData, map, g_iMapNameLen))
  957. {
  958. continue;
  959. }
  960.  
  961.  
  962. parse(szData, szMapName, sizeof(szMapName) - 1, szTime, sizeof(szTime) - 1, szAuthor, sizeof(szAuthor) - 1, szCountry, sizeof(szCountry) - 1, szCode, sizeof(szCode) - 1);
  963.  
  964. if(szMapName[g_iMapNameLen] != '[' && g_iMapNameLen != strlen(szMapName))
  965. {
  966. continue;
  967. }
  968.  
  969. if(szMapName[g_iMapNameLen] == '[')
  970. {
  971. formatex(szExt, sizeof(szExt) - 1, "%s ", szMapName[g_iMapNameLen]);
  972. if(iRecords < 5)
  973. copy(g_szWorldExt[iRecords], sizeof(g_szWorldExt[]) - 1, szExt);
  974. }
  975.  
  976. if(szWorldRecord[0])
  977. {
  978. add(szWorldRecord, iWRsize, "^n");
  979. }
  980. if(szTime[0] == '*' || (equal(szAuthor, "n/a") && str_to_float(szTime) == 0.0))
  981. {
  982. add(szWorldRecord, iWRsize, szExt);
  983. add(szWorldRecord, iWRsize, "No Record");
  984. norecord = 1;
  985.  
  986. }
  987. else
  988. {
  989. if(containi(szTime, ":") < 0)
  990. {
  991. WRTimer(str_to_float(szTime), szTime, sizeof(szTime) - 1, true, false);
  992.  
  993. }
  994. if(equali(map, g_szMapName) && iRecords < 5)
  995. {
  996. g_flWorldRecordTime[iRecords] = FloatTimer(szTime);
  997. DiffWRTime[iRecords] = FloatTimer(szTime);
  998. if (DiffWRTime[iRecords] < DiffWRTime[0] && iRecords > 0 ) {
  999. DiffWRTime[0] = DiffWRTime[iRecords];
  1000. }
  1001. copy(g_szWorldRecordPlayer[iRecords], sizeof(g_szWorldRecordPlayer[]) - 1, szAuthor);
  1002. }
  1003. format(szWorldRecord, iWRsize, "%sWR: %s%s by %s", szWorldRecord, szExt, szTime , szAuthor);
  1004. }
  1005. iRecords++;
  1006. }
  1007. if(equali(map, g_szMapName) && !g_iWorldRecordsNum && iRecords && (norecord != 1))
  1008. {
  1009. g_iWorldRecordsNum = iRecords;
  1010. if(g_iWorldRecordsNum > 5)
  1011. g_iWorldRecordsNum = 5;
  1012. }
  1013. }
  1014. }
  1015.  
  1016. if(!iRecords)
  1017. {
  1018. copy(szWorldRecord, iWRsize, "No Record");
  1019. }
  1020. return PLUGIN_HANDLED;
  1021. }
  1022.  
  1023. stock Float:FloatTimer(const szInPut[])
  1024. {
  1025. new Float:flTime = 0.0;
  1026.  
  1027. if(szInPut[2] == ':' && szInPut[5] == '.')
  1028. {
  1029. flTime+= ((szInPut[0] - 48) * 600.0) + ((szInPut[1] - 48) * 60.0);
  1030. flTime+= ((szInPut[3] - 48) * 10.0) + (szInPut[4] - 48);
  1031. flTime+= ((szInPut[6] - 48) / 10.0) + ((szInPut[7] - 48) / 100.0);
  1032. }
  1033. else
  1034. {
  1035. flTime = str_to_float(szInPut);
  1036. }
  1037. return flTime;
  1038. }
  1039.  
  1040.  
  1041. #if defined DOWNLOAD_NEW_WR
  1042.  
  1043. stock CheckRecords(wr = true)
  1044. {
  1045. get_localinfo("amxx_datadir", g_szDir, 127);
  1046. format(g_szDir, sizeof(g_szDir) - 1,"%s/%s", g_szDir, g_szDirFile);
  1047.  
  1048. if(!dir_exists(g_szDir))
  1049. mkdir(g_szDir);
  1050.  
  1051. new szHost[96], szUrl[96], szSocket[256], iSocketError, iSocket, iPos;
  1052. new szFile[128], szFile2[128];
  1053. new szWebDate[64];
  1054. new szFileDate[64];
  1055.  
  1056. new imax = sizeof(g_szDemoFiles);
  1057. for(new i = 0; i < imax; i++)
  1058. {
  1059. if((wr && !g_szDemoFiles[i][URLS][0]) )
  1060. {
  1061. continue;
  1062. }
  1063. new start = 7;
  1064. if(wr)
  1065. {
  1066. if(g_szDemoFiles[i][URLS][4] == 's')
  1067. {
  1068. start = 8;
  1069. }
  1070. copy(szHost, 95, g_szDemoFiles[i][URLS][start]);
  1071. }
  1072.  
  1073. iPos = contain(szHost, "/");
  1074.  
  1075. if(iPos != -1)
  1076. {
  1077. copy(szUrl, 95, szHost[iPos + 1]);
  1078. szHost[iPos] = 0;
  1079. }
  1080.  
  1081. g_szDemosBuffer[0] = 0;
  1082. iSocket = socket_open(szHost, 80, SOCKET_TCP, iSocketError);
  1083.  
  1084. if(iSocketError > 0)
  1085. {
  1086. continue;
  1087. }
  1088.  
  1089. formatex(szSocket, charsmax(szSocket), "HEAD /%s HTTP/1.1^r^nHost: %s^r^nUser-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)^r^nConnection: close^r^n^r^n", szUrl, szHost);
  1090. socket_send(iSocket, szSocket, charsmax(szSocket));
  1091.  
  1092. socket_recv(iSocket, g_szDemosBuffer, charsmax(g_szDemosBuffer));
  1093. socket_close(iSocket);
  1094.  
  1095. if(!g_szDemosBuffer[0])
  1096. {
  1097. continue;
  1098. }
  1099.  
  1100. new iPos = contain(g_szDemosBuffer, "Last-Modified");
  1101. if(iPos == -1)
  1102. {
  1103. continue;
  1104. }
  1105.  
  1106. if(wr)
  1107. {
  1108. format(szFile, sizeof(szFile) - 1, "%s/%s", g_szDir, g_szDemoFiles[i][DEMOS]);
  1109. format(szFile2, sizeof(szFile2) - 1, "%s/%s", g_szDir, g_szDemoFiles[i][UPDATEDEMOS]);
  1110. }
  1111.  
  1112. copyc(szWebDate, charsmax(szWebDate), g_szDemosBuffer[iPos], '^n');
  1113.  
  1114. if(file_exists(szFile2))
  1115. {
  1116. new hFile = fopen(szFile2, "r");
  1117.  
  1118. fgets(hFile, szFileDate, charsmax(szFileDate));
  1119. fclose(hFile);
  1120. }
  1121.  
  1122. if(!equal(szFileDate, szWebDate))
  1123. {
  1124. new hFile = fopen(szFile2, "wt");
  1125. fputs(hFile, szWebDate);
  1126. fclose(hFile);
  1127.  
  1128. g_szDemosBuffer[0] = 0;
  1129. iSocket = socket_open(szHost, 80, SOCKET_TCP, iSocketError);
  1130.  
  1131. if(iSocketError > 0)
  1132. {
  1133. continue;
  1134. }
  1135. formatex(szSocket, charsmax(szSocket), "GET /%s HTTP/1.1^r^nHost: %s^r^nUser-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)^r^nConnection: close^r^n^r^n", szUrl, szHost);
  1136. socket_send(iSocket, szSocket, charsmax(szSocket));
  1137.  
  1138. hFile = fopen(szFile, "wt");
  1139. while(socket_recv(iSocket, g_szDemosBuffer, charsmax(g_szDemosBuffer)))
  1140. {
  1141. if(g_szDemosBuffer[0])
  1142. {
  1143. if(g_szDemosBuffer[0] == 'H' && g_szDemosBuffer[ 1 ] == 'T') // Header
  1144. {
  1145. new iPos;
  1146. iPos = contain(g_szDemosBuffer, "^r^n^r^n") + 4;
  1147. iPos += contain(g_szDemosBuffer[iPos], "^n") + 1;
  1148.  
  1149. formatex(g_szDemosBuffer, charsmax(g_szDemosBuffer), g_szDemosBuffer[iPos]);
  1150. }
  1151. fputs(hFile, g_szDemosBuffer);
  1152. }
  1153. }
  1154. fclose(hFile);
  1155. socket_close(iSocket);
  1156. }
  1157. }
  1158. if(wr)
  1159. {
  1160. LoadWorldRecord(g_szMapName, g_szWorldRecords, sizeof(g_szWorldRecords) - 1);
  1161. CheckRecords(false);
  1162. }
  1163. }
  1164.  
  1165. #else
  1166.  
  1167. stock CheckRecords(wr = true)
  1168. {
  1169. get_localinfo("amxx_datadir", g_szDir, 127);
  1170. format(g_szDir, sizeof(g_szDir) - 1,"%s/%s", g_szDir, g_szDirFile);
  1171.  
  1172. if(wr)
  1173. {
  1174. LoadWorldRecord(g_szMapName, g_szWorldRecords, sizeof(g_szWorldRecords) - 1);
  1175. CheckRecords(false);
  1176. }
  1177. }
  1178. #endif
  1179.  
  1180. //========================================================================= End WR =====================================================================//
  1181.  
  1182. //========================================================Description============================================================//
  1183. public Fwd_GameDesc()
  1184. {
  1185. new szGameName[33];
  1186. get_pcvar_string( kz_gamename, szGameName, 32 );
  1187.  
  1188. if( !strlen( szGameName ) ) // Ignore the gamename cvar if it's an empty string
  1189. {
  1190. return 1;
  1191. }
  1192.  
  1193. forward_return( FMV_STRING, szGameName );
  1194. return 4;
  1195. }
  1196.  
  1197. //=====================================================End of Desc ===================================================================//
  1198.  
  1199. public HandleSay(id) {
  1200. if ( ! is_user_connected(id) ) {
  1201. return PLUGIN_HANDLED;
  1202. }
  1203. new message[192];
  1204. read_argv(0, message, 5);
  1205. new is_team_msg = message[3] == '_';
  1206. new CsTeams:userTeam = cs_get_user_team(id);
  1207.  
  1208. read_args(message, 191);
  1209. remove_quotes(message);
  1210. trim(message);
  1211. if(strlen(message) > 190 || strlen(message) == 0) {
  1212. return PLUGIN_HANDLED;
  1213. }
  1214.  
  1215. new szMessage[192];
  1216. read_args(szMessage, sizeof szMessage - 1);
  1217. remove_quotes(szMessage);
  1218. trim(szMessage);
  1219.  
  1220. if(equali(szMessage, "/wr", 3))
  1221. {
  1222. #if defined USE_SQL
  1223. GetTop(id + TASK_GETTOP)
  1224. #endif
  1225.  
  1226. new szMap[60];
  1227. parse(szMessage, szMessage, 3, szMap, sizeof(szMap) - 1);
  1228.  
  1229. new szWrRecordMap[256];
  1230. if(!szMap[0])
  1231. {
  1232. copy(szWrRecordMap, sizeof(szWrRecordMap) - 1, g_szWorldRecords);
  1233. copy(szMap, sizeof(szMap) - 1, g_szMapName);
  1234. set_hudmessage(0, 100, 255, 0.02, 0.17, 0, 0.0, 12.0, 1.0, 1.0, -1);
  1235. show_hudmessage(id, "Records on %s:^n^n%s%s%s%s^n%s", szMap, proinfo, noobinfo, myproinfo[id],mynoobinfo[id], szWrRecordMap);
  1236.  
  1237. }
  1238. else
  1239. {
  1240. LoadWorldRecord(szMap, szWrRecordMap, sizeof(szWrRecordMap) - 1);
  1241. set_hudmessage(0, 100, 255, 0.02, 0.17, 0, 0.0, 12.0, 1.0, 1.0, -1);
  1242. show_hudmessage(id, "Records on %s:^n%s", szMap, szWrRecordMap);
  1243. }
  1244.  
  1245. return PLUGIN_HANDLED;
  1246. }
  1247. if(get_pcvar_num(kz_admin_check) == 1) {
  1248. register_cvar("amx_contactinfo", CONTACT, FCVAR_SERVER)
  1249.  
  1250. if( equal(message, "admin", 5) || equal(message, "/admin", 6)){
  1251. set_task(0.1,"print_adminlist",id)
  1252. return PLUGIN_HANDLED
  1253. }
  1254. }
  1255. for ( new i = 0 ; i <= g_maxplayers ; i++ ) {
  1256.  
  1257. if ( ! is_user_connected(i) )
  1258. continue;
  1259. message_begin(MSG_ONE_UNRELIABLE, g_msgid_SayText, {0,0,0}, i);
  1260. write_byte(id);
  1261. write_string(textchannels[get_user_text_channel(id, userTeam, is_team_msg)]);
  1262. write_string("");
  1263. write_string(message);
  1264. message_end();
  1265.  
  1266. }
  1267. return PLUGIN_HANDLED;
  1268. }
  1269.  
  1270. #if defined USE_SQL
  1271. public GetTop(id) {
  1272. id -= TASK_GETTOP
  1273. if(TopUpdated){
  1274. if(!sqlconnected) {
  1275. plugin_sql()
  1276. sqlconnected = true
  1277. }
  1278. new ProTopName[32], NoobTopName[32], ProTopTime[32], NoobTopTime[32]
  1279.  
  1280. new Handle:query = SQL_PrepareQuery(SqlConnection,"SELECT name, time FROM kz_pro15 WHERE mapname='%s' ORDER BY time LIMIT 1", MapName)
  1281. SQL_Execute(query)
  1282. if (!SQL_Execute(query) || !SQL_NumResults(query))
  1283. {
  1284. SQL_FreeHandle(query);
  1285. format(proinfo, 63, "ProTop #1: No Record^n")
  1286. } else {
  1287. SQL_ReadResult(query, 0, ProTopName, 31)
  1288. SQL_ReadResult(query, 1, ProTopTime, 31)
  1289. new proimin,proisec,proims
  1290. new Float:ProTime = str_to_float(ProTopTime)
  1291. proimin = floatround(ProTime / 60.0, floatround_floor)
  1292. proisec = floatround(ProTime - proimin * 60.0,floatround_floor)
  1293. proims = floatround( ( ProTime - ( proimin * 60.0 + proisec ) ) * 100.0, floatround_round )
  1294. format(proinfo, 63, "ProTop #1: %02i:%02i.%02i by %s^n", proimin, proisec, proims, ProTopName)
  1295. SQL_FreeHandle(query);
  1296. }
  1297. new Handle:query1 = SQL_PrepareQuery(SqlConnection,"SELECT name, time FROM kz_nub15 WHERE mapname='%s' ORDER BY time LIMIT 1", MapName)
  1298. SQL_Execute(query1)
  1299. if (!SQL_Execute(query1) || !SQL_NumResults(query1))
  1300. {
  1301. SQL_FreeHandle(query1);
  1302. format(noobinfo, 63, "NubTop #1: No Record^n")
  1303. } else {
  1304. SQL_ReadResult(query1, 0, NoobTopName, 31)
  1305. SQL_ReadResult(query1, 1, NoobTopTime, 31)
  1306. new noobimin,noobisec,noobims
  1307. new Float:NoobTime = str_to_float(NoobTopTime)
  1308. noobimin = floatround(NoobTime / 60.0, floatround_floor)
  1309. noobisec = floatround(NoobTime - noobimin * 60.0,floatround_floor)
  1310. noobims = floatround( ( NoobTime - ( noobimin * 60.0 + noobisec ) ) * 100.0, floatround_round )
  1311.  
  1312. format(noobinfo, 63, "NubTop #1: %02i:%02i.%02i by %s^n", noobimin, noobisec, noobims, NoobTopName)
  1313. SQL_FreeHandle(query1);
  1314. }
  1315. TopUpdated = false
  1316. }
  1317.  
  1318. if(MyPosUpdated[id]){
  1319. if(!sqlconnected) {
  1320. plugin_sql()
  1321. sqlconnected = true
  1322. }
  1323. new steam[32]
  1324. get_user_authid(id, steam, 31 )
  1325. new MyProTime[32], MyProPos[32], MyNoobTime[32], MyNoobPos[32]
  1326.  
  1327. new Handle:query3 = SQL_PrepareQuery(SqlConnection,"SELECT s.pos,s.time from(SELECT @pos:=@pos+1 as pos,time,authid FROM (SELECT @pos:=0) r,kz_pro15 where mapname='%s' ORDER BY time)s where s.authid = '%s'", MapName, steam)
  1328. SQL_Execute(query3)
  1329. if (!SQL_Execute(query3) || !SQL_NumResults(query3))
  1330. {
  1331. SQL_FreeHandle(query3);
  1332. format(myproinfo[id], 63, "Your Pro Rec : No Record^n")
  1333. } else {
  1334. SQL_ReadResult(query3, 0, MyProPos, 31)
  1335. SQL_ReadResult(query3, 1, MyProTime, 31)
  1336. new myproimin,myproisec,myproims
  1337. new Float:MyProT = str_to_float(MyProTime)
  1338. myproimin = floatround(MyProT / 60.0, floatround_floor)
  1339. myproisec = floatround(MyProT - myproimin * 60.0,floatround_floor)
  1340. myproims = floatround( ( MyProT - ( myproimin * 60.0 + myproisec ) ) * 100.0, floatround_round )
  1341. if(equal(MyProPos, "1", 3)){
  1342. myproinfo[id] = "";
  1343. } else {
  1344. format(myproinfo[id], 63, "Your Pro Rec : #%s - %02i:%02i.%02i^n", MyProPos, myproimin, myproisec, myproims)
  1345. }
  1346.  
  1347. SQL_FreeHandle(query3);
  1348. }
  1349. new Handle:query4 = SQL_PrepareQuery(SqlConnection,"SELECT s.pos,s.time from(SELECT @pos:=@pos+1 as pos,time,authid FROM (SELECT @pos:=0) r,kz_nub15 where mapname='%s' ORDER BY time)s where s.authid = '%s'", MapName, steam)
  1350. SQL_Execute(query4)
  1351. if (!SQL_Execute(query4) || !SQL_NumResults(query4))
  1352. {
  1353. SQL_FreeHandle(query4);
  1354. format(mynoobinfo[id], 63, "Your Nub Rec: No Record^n")
  1355. } else {
  1356. SQL_ReadResult(query4, 0, MyNoobPos, 31)
  1357. SQL_ReadResult(query4, 1, MyNoobTime, 31)
  1358. new mynoobimin,mynoobisec,mynoobims
  1359. new Float:MyNoobT = str_to_float(MyNoobTime)
  1360. mynoobimin = floatround(MyNoobT / 60.0, floatround_floor)
  1361. mynoobisec = floatround(MyNoobT - mynoobimin * 60.0,floatround_floor)
  1362. mynoobims = floatround( ( MyNoobT - ( mynoobimin * 60.0 + mynoobisec ) ) * 100.0, floatround_round )
  1363. if(equal(MyNoobPos, "1", 3)){
  1364. mynoobinfo[id] = "";
  1365. } else {
  1366. format(mynoobinfo[id], 63, "Your Nub Rec: #%s - %02i:%02i.%02i^n", MyNoobPos, mynoobimin, mynoobisec, mynoobims)
  1367. }
  1368. SQL_FreeHandle(query4);
  1369. }
  1370. MyPosUpdated[id] = false
  1371. }
  1372.  
  1373. if(FinishMsg) {
  1374. set_hudmessage(0, 100, 255, 0.02, 0.17, 0, 0.0, 12.0, 1.0, 1.0, -1);
  1375. for(new i = 1; i < max_players; i++ )
  1376. {
  1377. if( (i == id || is_user_spectating_player(i,id)))
  1378. {
  1379. show_hudmessage(i, "Records on %s:^n^n%s%s%s%s^n%s", MapName, proinfo, noobinfo,myproinfo[id],mynoobinfo[id], g_szWorldRecords);
  1380. }
  1381. }
  1382. FinishMsg = false
  1383. }
  1384. return PLUGIN_HANDLED;
  1385. }
  1386. #endif
  1387.  
  1388. stock get_user_text_channel(id, CsTeams:userTeam, is_team_msg) {
  1389. if ( is_team_msg ) {
  1390. switch ( userTeam ) {
  1391. case CS_TEAM_T : {
  1392. if ( is_user_alive(id) )
  1393. return 0;
  1394. else
  1395. return 6;
  1396. }
  1397. case CS_TEAM_CT : {
  1398. if ( is_user_alive(id) )
  1399. return 1;
  1400. else
  1401. return 7;
  1402. }
  1403. case CS_TEAM_SPECTATOR, CS_TEAM_UNASSIGNED :
  1404. return 2;
  1405. }
  1406. }
  1407. else {
  1408. if ( is_user_alive(id) )
  1409. return 3;
  1410. else if ( userTeam == CsTeams:3 )
  1411. return 4;
  1412. }
  1413. return 5;
  1414. }
  1415.  
  1416. public print_adminlist(user)
  1417. {
  1418. new adminnames[33][32]
  1419. new message[256]
  1420. new contactinfo[256], contact[112]
  1421. new id, count, x, len
  1422.  
  1423. for(id = 1 ; id <= g_maxplayers ; id++)
  1424. if(is_user_connected(id))
  1425. if(get_user_flags(id) & ADMIN_CHECK)
  1426. get_user_name(id, adminnames[count++], 31)
  1427.  
  1428. len = format(message, 255, "^x04[KZ.M] %sAdmins Online: ",COLOR)
  1429. if(count > 0) {
  1430. for(x = 0 ; x < count ; x++) {
  1431. len += format(message[len], 255-len, "^x03%s%s ", adminnames[x], x < (count-1) ? ", ":"")
  1432. if(len > 96 ) {
  1433. print_message(user, message)
  1434. len = format(message, 255, "%s ",COLOR)
  1435. }
  1436. }
  1437. print_message(user, message)
  1438. }
  1439. else {
  1440. len += format(message[len], 255-len, "^x01No Admins Online.")
  1441. print_message(user, message)
  1442. }
  1443.  
  1444. get_cvar_string("amx_contactinfo", contact, 63)
  1445. if(contact[0]) {
  1446. format(contactinfo, 111, "^x04[KZ.M] %sContact: ^x03%s", COLOR, contact)
  1447. print_message(user, contactinfo)
  1448. }
  1449. }
  1450.  
  1451. print_message(id, msg[]) {
  1452. message_begin(MSG_ONE, g_msgid_SayText, {0,0,0}, id)
  1453. write_byte(id)
  1454. write_string(msg)
  1455. message_end()
  1456. }
  1457.  
  1458.  
  1459.  
  1460. public Forward_ClientKill(id)
  1461. {
  1462. return FMRES_SUPERCEDE;
  1463. }
  1464.  
  1465.  
  1466. public Msg_StatusIcon( msgid, msgdest, id ) {
  1467. static szMsg[ 8 ];
  1468. get_msg_arg_string( 2, szMsg, 7 );
  1469.  
  1470. if( equal( szMsg, "buyzone" ) && get_msg_arg_int( 1 ) ) {
  1471. set_pdata_int( id, 235, get_pdata_int( id, 235 ) & ~( 1 << 0 ) );
  1472. return PLUGIN_HANDLED;
  1473. }
  1474. return PLUGIN_CONTINUE;
  1475. }
  1476.  
  1477. #if defined USE_SQL
  1478. public plugin_sql()
  1479. {
  1480. new host[64], user[64], pass[64], db[64]
  1481.  
  1482. get_pcvar_string(kz_sql_host, host, 63)
  1483. get_pcvar_string(kz_sql_user, user, 63)
  1484. get_pcvar_string(kz_sql_pass, pass, 63)
  1485. get_pcvar_string(kz_sql_db, db, 63)
  1486.  
  1487. g_SqlTuple = SQL_MakeDbTuple(host, user, pass, db)
  1488.  
  1489. new ErrorCode
  1490. SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
  1491.  
  1492.  
  1493. if(SqlConnection == Empty_Handle)
  1494. {
  1495. server_print("[DRM] TOP15 SQL Error: %s (%d)", g_Error, ErrorCode)
  1496. log_amx("SQL Error: %s (%d)", g_Error, ErrorCode)
  1497. return pause("a")
  1498. }
  1499.  
  1500. if(!SqlConnection)
  1501. {
  1502. server_print("[KZ.M] TOP15 SQL: Could not connect to SQL database.!")
  1503. log_amx("[KZ.M] TOP15 SQL: Could not connect to SQL database.")
  1504. return pause("a")
  1505. }
  1506. #if defined CREATE_TABLES_1ST_TIME
  1507. new createinto[1001]
  1508. formatex(createinto, 1000, "CREATE TABLE IF NOT EXISTS `kz_pro15` (`mapname` varchar(64) NOT NULL, `authid` varchar(64) NOT NULL, `country` varchar(6) NOT NULL, `name` varchar(64) NOT NULL, `time` decimal(65,2) NOT NULL, `date` datetime NOT NULL, `weapon` varchar(64) NOT NULL, `server` varchar(64) NOT NULL)")
  1509. SQL_ThreadQuery(g_SqlTuple,"QueryHandle", createinto)
  1510. formatex(createinto, 1000, "CREATE TABLE IF NOT EXISTS `kz_nub15` (`mapname` varchar(64) NOT NULL, `authid` varchar(64) NOT NULL, `country` varchar(6) NOT NULL, `name` varchar(64) NOT NULL, `time`decimal(65,2) NOT NULL, `date` datetime NOT NULL, `weapon` varchar(64) NOT NULL, `server` varchar(64) NOT NULL, `checkpoints` real NOT NULL, `gocheck` real NOT NULL)")
  1511. SQL_ThreadQuery(g_SqlTuple,"QueryHandle", createinto)
  1512. #endif
  1513. return PLUGIN_CONTINUE
  1514. }
  1515.  
  1516. public QueryHandle(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
  1517. {
  1518. if( iFailState != TQUERY_SUCCESS )
  1519. {
  1520. log_amx("[KZ.M] TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
  1521. // ColorChat(0, GREEN, "[KZ.M]^x01: Warning the SQL Tops can not be saved.")
  1522. }
  1523. return PLUGIN_CONTINUE
  1524. }
  1525. #endif
  1526.  
  1527.  
  1528. public client_command(id)
  1529. {
  1530.  
  1531. new sArg[13];
  1532. if( read_argv(0, sArg, 12) > 11 )
  1533. {
  1534. return PLUGIN_CONTINUE;
  1535. }
  1536.  
  1537. for( new i = 0; i < sizeof(g_weaponsnames); i++ )
  1538. {
  1539. if( equali(g_weaponsnames[i], sArg, 0) )
  1540. {
  1541. return PLUGIN_HANDLED;
  1542. }
  1543. }
  1544. return PLUGIN_CONTINUE;
  1545. }
  1546.  
  1547. // =================================================================================================
  1548. // Global Functions
  1549. // =================================================================================================
  1550.  
  1551. public PlayerInfo(id)
  1552. {
  1553. id -= TASK_INFO
  1554. client_print(id, print_chat, "[KZ.M] For see all Commands type '/help' in Chat" );
  1555. }
  1556.  
  1557. public InfoKreedz(id)
  1558. {
  1559. id -= TASK_INFO_KREEDZ
  1560. // ColorChat(id, BLUE, "^x04%s^x01 Welcome to^x03 Climb/Bhop Server^x01. Say^x03 /menu^x01 to open main menu", prefix)
  1561. ColorChat(id, BLUE, "^x04%s^x01 Welcome to^x03 Climb/Bhop Server^x01. Say^x03 /menu^x01 to open main menu", prefix)
  1562. FinishMsg = true
  1563. GetTop(id + TASK_GETTOP)
  1564. }
  1565.  
  1566. public hudTextArgs(msgid, msgDest, msgEnt)
  1567. {
  1568. static hint[HintMaxLen + 1]
  1569. get_msg_arg_string(1,hint,charsmax(hint))
  1570.  
  1571. if(TrieKeyExists(HintsStatus,hint[6]))
  1572. {
  1573. set_pdata_float(msgEnt,NextHudTextArgsOffset,0.0)
  1574. return PLUGIN_HANDLED
  1575. }
  1576. return PLUGIN_CONTINUE
  1577. }
  1578.  
  1579. public cmd_help(id)
  1580. {
  1581. if(get_pcvar_num(kz_help))
  1582. {
  1583. static MOTD[2048], MLTITEL[24], Pos
  1584.  
  1585. formatex(MLTITEL,23,"[KZ.M] Commands", id)
  1586.  
  1587. Pos = formatex(MOTD,sizeof MOTD - 1,"<style type=^"text/css^">.h1 { color:#228B22;font-weight:bold;} .h2 { color:#FFFFFF; font-weight:bold; font-family: Times New Roman}</style><body bgcolor=^"#000000^"><table width=^"100%%^" border=^"0^">")
  1588. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Shows Player Menu:", id)
  1589. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /menu")
  1590. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Shows Maps Menu:", id)
  1591. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /maps")
  1592. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Gives Player A Scout:", id)
  1593. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /scout")
  1594. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Gives Player A Usp:", id)
  1595. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /usp")
  1596. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Shows The Tops:", id)
  1597. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /top15")
  1598. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /nub15")
  1599. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /pro15")
  1600. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Create A Checkpoint:", id)
  1601. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /cp")
  1602. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Go To Last Checkpoint:", id)
  1603. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /tp")
  1604. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Go To Last Checkpoint with fixed angle:", id)
  1605. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /tpf")
  1606. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* If Player Stuck In Wall:", id)
  1607. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /stuck")
  1608. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Teleport Player To The Start:", id)
  1609. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /start")
  1610. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /respawn")
  1611. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Reset Time And Checkpoints:", id)
  1612. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /reset")
  1613. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Player Join Spec And Time Stopped:", id)
  1614. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /spec")
  1615. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Show World Record:", id)
  1616. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /wr")
  1617. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Save your own start position:", id)
  1618. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /ss")
  1619. if(get_pcvar_num(kz_duel) == 1) {
  1620. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Duel menu:", id)
  1621. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /duel")
  1622. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Show Duels:", id)
  1623. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /duels")
  1624. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Show Duels Rank:", id)
  1625. Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /dueltop")
  1626. }
  1627. show_motd(id,MOTD,MLTITEL)
  1628. }
  1629. return PLUGIN_CONTINUE
  1630. }
  1631.  
  1632.  
  1633. public fwdPlayerPreThink(id)
  1634. {
  1635. new entc[33];
  1636. pev(pev(id, pev_groundentity), pev_classname, entc, 32);
  1637. if(!is_user_alive(id) || is_user_bot(id)){
  1638. return FMRES_IGNORED
  1639. }
  1640. if(!(pev(id, pev_flags)&FL_ONGROUND2) && !isFalling[id] && timer_started[id] && !IsPaused[id] && !IsOnLadder(id))
  1641. {
  1642. pev(id, pev_origin, vFallingStart[id])
  1643. vFallingTime[id] = get_gametime() - timer_time[id]
  1644. isFalling[id] = true
  1645. }
  1646. if((pev(id, pev_flags)&FL_ONGROUND2 || IsOnLadder(id)) && isFalling[id] && timer_started[id] && !IsPaused[id] && !equal(entc, "func_door"))
  1647. {
  1648. isFalling[id] = false
  1649. }
  1650. return FMRES_IGNORED
  1651. }
  1652.  
  1653.  
  1654. public Pause(id)
  1655. {
  1656. if(! is_user_alive(id) )
  1657. {
  1658. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  1659. return PLUGIN_HANDLED
  1660. }
  1661. if(!timer_started[id])
  1662. {
  1663. client_print(id, print_center, "Timer is not Started")
  1664. return PLUGIN_HANDLED
  1665. }
  1666. static Float:hpp[33]
  1667. new entclassname[33];
  1668. pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
  1669.  
  1670. if(!IsPaused[id])
  1671. {
  1672. if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !tptostart[id] && !get_user_noclip(id))
  1673. {
  1674. client_print(id, print_center, "Cannot pause now")
  1675. return PLUGIN_HANDLED
  1676. }
  1677. tphook_user[id] = true;
  1678.  
  1679. g_pausetime[id] = get_gametime() - timer_time[id]
  1680. timer_time[id] = 0.0
  1681.  
  1682. static Float:velocityy[33][3], Float:v_angle[33][3];
  1683. pev(id, pev_health, hpp[id])
  1684. pev(id, pev_velocity, velocityy[id])
  1685. pev(id, pev_velocity, pausedvelocity[id])
  1686. pev(id, pev_origin, PauseOrigin[id])
  1687. pev(id, pev_v_angle, v_angle[id])
  1688.  
  1689. if(isFalling[id] && tptostart[id]) {
  1690. MpbhopOrigin[id] = vFallingStart[id]
  1691. isMpbhop[id] = true
  1692. }
  1693. if (!menushow[id] && is_user_alive(id)) {
  1694. hidetime(id)
  1695. pausetime(id)
  1696. }
  1697. IsPaused[id] = true
  1698. }
  1699. else
  1700. {
  1701. if( (!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id)))
  1702. {
  1703. kz_hud_message(id, "Cannot unpause now")
  1704. return PLUGIN_HANDLED
  1705. }
  1706. if(ishooked[id]) {
  1707. remove_hook(id)
  1708. }
  1709. if(get_user_noclip(id)) {
  1710. set_user_noclip(id,0)
  1711. }
  1712. if(timer_started[id])
  1713. {
  1714. client_print(id, print_center, "Timer is Unpaused")
  1715. timer_time[id] = get_gametime() - g_pausetime[id]
  1716. if(!menushow[id]) {
  1717. set_task(0.3, "showtimeduel", id)
  1718. }
  1719.  
  1720. }
  1721. IsPaused[id] = false
  1722. set_pev(id, pev_angles, v_angle[id])
  1723. if(isMpbhop[id] && !GoPosed[id]) {
  1724. if(callfunc_begin("setprokreedzorigin","mpbhop.amxx") == 1)
  1725. {
  1726. callfunc_push_int(id)
  1727. callfunc_push_float(MpbhopOrigin[id][0])
  1728. callfunc_push_float(MpbhopOrigin[id][1])
  1729. callfunc_push_float(MpbhopOrigin[id][2])
  1730. callfunc_end()
  1731. }
  1732. isMpbhop[id] = false
  1733. set_pev(id, pev_fixangle, 1);
  1734. }
  1735. tptostart[id] = false
  1736. set_pev(id, pev_origin, PauseOrigin[id])
  1737. set_pev(id, pev_velocity, velocityy[id])
  1738. set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
  1739.  
  1740. if(!GoPosHp[id] && !HealsOnMap) {
  1741. set_pev(id, pev_health, hpp[id])
  1742. }
  1743. tphook_user[id] = false
  1744. inpausechecknumbers[id] = 0
  1745. }
  1746. return PLUGIN_HANDLED
  1747. }
  1748.  
  1749.  
  1750.  
  1751. public fw_ThinkEntity(iEnt)
  1752. {
  1753. if(pev_valid(iEnt))
  1754. {
  1755. static ClassName[32]
  1756. pev(iEnt, pev_classname, ClassName, 31)
  1757.  
  1758. if(equal(ClassName, "kz_time_think"))
  1759. {
  1760. fw_TimeThink()
  1761. set_pev(iEnt, pev_nextthink, get_gametime() + 0.08)
  1762. }
  1763. }
  1764. }
  1765.  
  1766.  
  1767.  
  1768.  
  1769. public fw_TimeThink()
  1770. {
  1771. new Alive[32], Dead[32], alivePlayers, deadPlayers;
  1772. get_players(Alive, alivePlayers, "ach")
  1773. get_players(Dead, deadPlayers, "bch")
  1774. for(new i=0;i<alivePlayers;i++)
  1775. {
  1776. if(timer_started[Alive[i]])
  1777. {
  1778. new Float:kreedztime, imin, Float:isec
  1779. kreedztime = get_gametime() - (IsPaused[Alive[i]] ? get_gametime() - g_pausetime[Alive[i]] : timer_time[Alive[i]])
  1780.  
  1781. imin = floatround(kreedztime , floatround_floor)/60
  1782. isec = kreedztime - (60*imin) + 0.02
  1783.  
  1784. if(menushow[Alive[i]]) {
  1785. if( IsPaused[Alive[i]]) {
  1786. set_hudmessage(200, 3, 0, 0.465, 0.08, 0, 0.0, 0.2, 0.0, 0.0, 4)
  1787. } else {
  1788. set_hudmessage(200, 200, 200, 0.465, 0.08, 0, 0.0, 0.2, 0.0, 0.0, 4)
  1789. }
  1790. if( checknumbers[Alive[i]] > 0 )
  1791. {
  1792. show_hudmessage(Alive[i], "%02d:%s%.2f (%d|%d) %s",imin,isec < 10 ? "0" : "",isec,checknumbers[Alive[i]],gochecknumbers[Alive[i]], IsPaused[Alive[i]] ? "| *Paused*" : "")
  1793. }
  1794. else
  1795. {
  1796. show_hudmessage(Alive[i], "%02d:%s%.2f %s",imin,isec < 10 ? "0" : "",isec, IsPaused[Alive[i]] ? "| *Paused*" : "")
  1797. }
  1798. }
  1799. else
  1800. {
  1801. if(IsPaused[Alive[i]]) {
  1802. set_hudmessage(150, 3, 0, 0.030, -0.504, 0, 0.0, 0.2, 0.0, 0.0, 4)
  1803. }
  1804. else {
  1805. set_hudmessage(200, 200, 200, 0.030, -0.504, 0, 0.0, 0.2, 0.0, 0.0, 4)
  1806. }
  1807. if( checknumbers[Alive[i]] > 0 )
  1808. {
  1809. show_hudmessage(Alive[i], "%02d:%s%.2f (%d|%d) %s",imin,isec < 10 ? "0" : "",isec,checknumbers[Alive[i]],gochecknumbers[Alive[i]], IsPaused[Alive[i]] ? "| *Paused*" : "")
  1810. }
  1811. else
  1812. {
  1813. show_hudmessage(Alive[i], "%02d:%s%.2f %s",imin,isec < 10 ? "0" : "",isec, IsPaused[Alive[i]] ? "| *Paused*" : "")
  1814. }
  1815. }
  1816. if (IsPaused[Alive[i]])
  1817. {
  1818. client_print(Alive[i], print_center, "Timer is Paused, type /pause")
  1819. }
  1820.  
  1821. }
  1822.  
  1823. }
  1824. for(new i=0;i<deadPlayers;i++)
  1825. {
  1826. new Float:kreedztime, imin, Float:isec
  1827. new specmode = pev(Dead[i], pev_iuser1)
  1828. if(specmode == 2 || specmode == 4)
  1829. {
  1830. new target = pev(Dead[i], pev_iuser2)
  1831. if(target != Dead[i])
  1832. if(is_user_alive(target) && timer_started[target])
  1833. {
  1834. new name[32]
  1835. get_user_name (target, name, 31)
  1836.  
  1837. kreedztime = get_gametime() - (IsPaused[target] ? get_gametime() - g_pausetime[target] : timer_time[target])
  1838. imin = floatround(kreedztime , floatround_floor)/60
  1839. isec = kreedztime - (60*imin) + 0.02
  1840.  
  1841. new Float:hp;
  1842. pev( target, pev_health, hp );
  1843.  
  1844. if(checknumbers[target] > 0)
  1845. {
  1846. if(HealsOnMap) {
  1847. client_print(Dead[i], print_center,"[ %02d:%s%.2f ] (%d|%d) | HP: Godmode %s",imin,isec < 10 ? "0" : "",isec,checknumbers[target], gochecknumbers[target], IsPaused[target] ? "| *Paused*" : "")
  1848. }
  1849. else {
  1850. client_print(Dead[i], print_center,"[ %02d:%s%.2f ] (%d|%d) | HP: %.f %s",imin,isec < 10 ? "0" : "",isec,checknumbers[target], gochecknumbers[target], hp, IsPaused[target] ? "| *Paused*" : "")
  1851. }
  1852. }
  1853. else if(!is_user_bot(target))
  1854. {
  1855. if(HealsOnMap) {
  1856. client_print(Dead[i], print_center, "[ %02d:%s%.2f ] | HP: Godmode %s",imin,isec < 10 ? "0" : "",isec, IsPaused[target] ? "| *Paused*" : "")
  1857. }
  1858. else {
  1859. client_print(Dead[i], print_center, "[ %02d:%s%.2f ] | HP: %.f %s",imin,isec < 10 ? "0" : "",isec, hp, IsPaused[target] ? "| *Paused*" : "")
  1860. }
  1861. }
  1862. }
  1863. }
  1864. }
  1865. }
  1866.  
  1867. public showtime1(id) // BLUE TIMER
  1868. {
  1869. message_begin(MSG_ONE_UNRELIABLE,iconstatus,{0,0,0},id)
  1870. write_byte(1)
  1871. write_string("stopwatch")
  1872. write_byte(0)
  1873. write_byte(90)
  1874. write_byte(255)
  1875. message_end()
  1876. return PLUGIN_HANDLED
  1877. }
  1878. public showtime2(id) // RED TIMER
  1879. {
  1880. message_begin(MSG_ONE_UNRELIABLE,iconstatus,{0,0,0},id)
  1881. write_byte(1)
  1882. write_string("stopwatch")
  1883. write_byte(145)
  1884. write_byte(0)
  1885. write_byte(0)
  1886. message_end()
  1887. return PLUGIN_HANDLED
  1888. }
  1889. public hidetime(id) // HIDE TIME
  1890. {
  1891. message_begin(MSG_ONE_UNRELIABLE,iconstatus,{0,0,0},id)
  1892. write_byte(0)
  1893. write_string("stopwatch")
  1894. write_byte(0)
  1895. write_byte(90)
  1896. write_byte(255)
  1897. message_end()
  1898. return PLUGIN_HANDLED
  1899. }
  1900.  
  1901. public pausetime(id) // PAUSED TIMER
  1902. {
  1903. message_begin(MSG_ONE_UNRELIABLE,iconstatus,{0,0,0},id)
  1904. write_byte(2)
  1905. write_string("stopwatch")
  1906. write_byte(170)
  1907. write_byte(170)
  1908. write_byte(170)
  1909. message_end()
  1910. return PLUGIN_HANDLED
  1911. }
  1912.  
  1913. public hidetimeduel(id)
  1914. {
  1915. menushow[id] = true
  1916. hidetime(id)
  1917. return PLUGIN_CONTINUE
  1918. }
  1919.  
  1920. public showtimeduel(id)
  1921. {
  1922. if (is_user_alive(id) && IsPaused[id]) {
  1923. hidetime(id)
  1924. pausetime(id)
  1925. }
  1926. else if(timer_started[id] && gochecknumbers[id] == 0 && is_user_alive(id)){
  1927. showtime1(id)
  1928. }
  1929. else if (timer_started[id] && gochecknumbers[id] > 0 && is_user_alive(id)) {
  1930. showtime2(id)
  1931. }
  1932. menushow[id] = false
  1933. return PLUGIN_CONTINUE
  1934. }
  1935.  
  1936. // ============================ Block Commands ================================
  1937.  
  1938.  
  1939. public BlockRadio(id)
  1940. {
  1941. if (get_pcvar_num(kz_use_radio) == 1)
  1942. return PLUGIN_CONTINUE
  1943. return PLUGIN_HANDLED
  1944. }
  1945.  
  1946. public BlockDrop(id)
  1947. {
  1948. if (get_pcvar_num(kz_drop_weapons) == 1)
  1949. return PLUGIN_CONTINUE
  1950. return PLUGIN_HANDLED
  1951. }
  1952.  
  1953. public BlockBuy(id)
  1954. {
  1955. return PLUGIN_HANDLED
  1956. }
  1957.  
  1958. public CmdRespawn(id)
  1959. {
  1960. if ( get_user_team(id) == 3 )
  1961. return PLUGIN_HANDLED
  1962. else
  1963. ExecuteHamB(Ham_CS_RoundRespawn, id)
  1964.  
  1965. return PLUGIN_HANDLED
  1966. }
  1967.  
  1968. public ChatHud(id)
  1969. {
  1970. if(chatorhud[id] == -1)
  1971. ++chatorhud[id];
  1972.  
  1973. ++chatorhud[id];
  1974.  
  1975. if(chatorhud[id] == 3)
  1976. chatorhud[id] = 0;
  1977.  
  1978. return PLUGIN_HANDLED
  1979. }
  1980.  
  1981. public ct(id)
  1982. {
  1983. if ( get_gametime() - antidiestart[id] < 0.5) {
  1984. kz_hud_message(id, "Can't use this command now")
  1985. return PLUGIN_HANDLED
  1986. }
  1987. new CsTeams:team = cs_get_user_team(id)
  1988. if (team == CS_TEAM_CT)
  1989. {
  1990. new entclassname[33];
  1991. pev(id, pev_health, hp_spec[id])
  1992. pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
  1993. if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !IsPaused[id])
  1994. {
  1995. return PLUGIN_HANDLED
  1996. }
  1997. pev(id, pev_origin, SpecLoc[id])
  1998.  
  1999. if ( timer_started[id] )
  2000. {
  2001. if ( !IsPaused[id] )
  2002. {
  2003. g_pausetime[id] = get_gametime() - timer_time[id]
  2004. timer_time[id] = 0.0
  2005. }
  2006. kz_chat(id, "%L", id, "KZ_PAUSE_ON")
  2007. hidetime(id)
  2008. }
  2009. spec_user[id] = true
  2010. strip_user_weapons(id)
  2011. cs_set_user_team(id,CS_TEAM_SPECTATOR)
  2012. set_pev(id, pev_solid, SOLID_NOT)
  2013. set_pev(id, pev_movetype, MOVETYPE_FLY)
  2014. set_pev(id, pev_effects, EF_NODRAW)
  2015. set_pev(id, pev_deadflag, DEAD_DEAD)
  2016. }
  2017. else
  2018. {
  2019. cs_set_user_team(id,CS_TEAM_CT)
  2020. set_pev(id, pev_effects, 0)
  2021. set_pev(id, pev_movetype, MOVETYPE_WALK)
  2022. set_pev(id, pev_deadflag, DEAD_NO)
  2023. set_pev(id, pev_takedamage, DAMAGE_AIM)
  2024. CmdRespawn(id)
  2025. strip_user_weapons(id)
  2026. if (user_has_scout[id]) {
  2027. give_item(id,"weapon_scout")
  2028. cs_set_user_bpammo(id, CSW_SCOUT, 20)
  2029. }
  2030. cmdUsp(id)
  2031. spec_user[id] = false
  2032. if(!HealsOnMap) {
  2033. set_pev(id, pev_health, hp_spec[id])
  2034. }
  2035. set_pev(id, pev_origin, SpecLoc[id])
  2036. set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
  2037. if ( timer_started [id] ) {
  2038. if(!IsPaused[id]){
  2039. timer_time[id] = get_gametime() - g_pausetime[id] + timer_time[id]
  2040. }
  2041. else{
  2042. timer_time[id] = g_pausetime[id]
  2043. }
  2044. if(!menushow[id]) {
  2045. set_task(0.3, "showtimeduel", id)
  2046. }
  2047. }
  2048. }
  2049. return PLUGIN_HANDLED
  2050. }
  2051.  
  2052.  
  2053. //=================== Weapons ==============
  2054. public curweapon(id)
  2055. {
  2056. static last_weapon[33];
  2057. static weapon_active, weapon_num
  2058. weapon_active = read_data(1)
  2059. weapon_num = read_data(2)
  2060.  
  2061. if ( ( weapon_num != last_weapon[id] ) && weapon_active && get_pcvar_num(kz_maxspeedmsg) == 1)
  2062. {
  2063. last_weapon[id] = weapon_num;
  2064.  
  2065. static Float:maxspeed;
  2066. pev(id, pev_maxspeed, maxspeed );
  2067.  
  2068. if( maxspeed < 0.0 )
  2069. maxspeed = 250.0;
  2070.  
  2071. kz_hud_message(id,"%L",id, "KZ_WEAPONS_SPEED",floatround( maxspeed, floatround_floor ));
  2072. }
  2073.  
  2074. if (get_pcvar_num(kz_weapon_silencer) == 1) {
  2075. static wpn_name[16], wpn_id;
  2076. if( weapon_num != 16 && weapon_num != 22 )
  2077. {
  2078. return PLUGIN_HANDLED;
  2079. }
  2080. get_weaponname( weapon_num, wpn_name, sizeof wpn_name - 1 );
  2081. while( ( wpn_id = engfunc( EngFunc_FindEntityByString, wpn_id, "classname", wpn_name ) ) && pev( wpn_id, pev_owner ) != id ) { }
  2082. if( !wpn_id )
  2083. {
  2084. return PLUGIN_HANDLED;
  2085. }
  2086. cs_set_weapon_silen( wpn_id, 1, 0 )
  2087. }
  2088.  
  2089. return PLUGIN_HANDLED
  2090. }
  2091.  
  2092. public weapons(id)
  2093. {
  2094. if(!is_user_alive(id))
  2095. {
  2096. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  2097. return PLUGIN_HANDLED
  2098. }
  2099. if(get_pcvar_num(kz_other_weapons) == 0)
  2100. {
  2101. kz_chat(id, "%L", id, "KZ_OTHER_WEAPONS_ZERO")
  2102. return PLUGIN_HANDLED
  2103. }
  2104.  
  2105. if (timer_started[id])
  2106. {
  2107. kz_chat(id, "%L", id, "KZ_WEAPONS_IN_RUN")
  2108. return PLUGIN_HANDLED
  2109. }
  2110.  
  2111. for(new i = 0; i < 8; i++)
  2112. if( !user_has_weapon(id, other_weapons[i]) )
  2113. {
  2114. new item;
  2115. item = give_item(id, other_weapons_name[i] );
  2116. cs_set_weapon_ammo(item, 0);
  2117. }
  2118.  
  2119. if( !user_has_weapon(id, CSW_USP) )
  2120. cmdUsp(id)
  2121.  
  2122. return PLUGIN_HANDLED
  2123. }
  2124.  
  2125.  
  2126. // ========================= Scout =======================
  2127. public cmdScout(id)
  2128. {
  2129. if(IsPaused[id])
  2130. {
  2131. kz_chat(id, "You can't use this command in pause")
  2132. return PLUGIN_HANDLED
  2133. }
  2134. if (timer_started[id])
  2135. user_has_scout[id] = true
  2136. strip_user_weapons(id)
  2137. if( !user_has_weapon(id, CSW_SCOUT)) {
  2138. give_item(id,"weapon_scout")
  2139. cs_set_user_bpammo(id, CSW_SCOUT, 20)
  2140. }
  2141. cmdUsp(id)
  2142.  
  2143. return PLUGIN_HANDLED
  2144. }
  2145.  
  2146. public cmdUsp(id)
  2147. {
  2148. give_item(id,"weapon_usp")
  2149. give_item(id,"weapon_knife")
  2150. cs_set_user_bpammo(id, CSW_USP, 36)
  2151.  
  2152. return PLUGIN_HANDLED
  2153. }
  2154.  
  2155. // ========================== Start location =================
  2156. public goStart1(id) {
  2157. StartSound[id] = true
  2158. goStartPos(id)
  2159. return PLUGIN_HANDLED
  2160. }
  2161.  
  2162. public goStart(id) {
  2163. StartSound[id] = false
  2164. goStartPos(id)
  2165. return PLUGIN_HANDLED
  2166. }
  2167.  
  2168. public goStartPos(id)
  2169. {
  2170. if ( get_gametime() - antidiestart[id] < 0.5) {
  2171. kz_hud_message(id, "Can't use this command now")
  2172. return PLUGIN_HANDLED
  2173. }
  2174. if( !is_user_alive( id ) )
  2175. {
  2176. if (!timer_started[id]) {
  2177. cs_set_user_team(id,CS_TEAM_CT)
  2178. set_pev(id, pev_effects, 0)
  2179. set_pev(id, pev_movetype, MOVETYPE_WALK)
  2180. set_pev(id, pev_deadflag, DEAD_NO)
  2181. set_pev(id, pev_takedamage, DAMAGE_AIM)
  2182. CmdRespawn(id)
  2183. strip_user_weapons(id)
  2184. cmdUsp(id)
  2185. if(!HealsOnMap) {
  2186. set_pev(id, pev_health, hp_spec[id])
  2187. }
  2188. client_cmd(id, "spk warcraft3/resurrecttarget");
  2189. set_task(0.1, "show_beacon", id)
  2190. set_task(0.3, "show_beacon2", id)
  2191.  
  2192. if(gCheckpointStart[id]) {
  2193. set_pev( id, pev_angles, gCheckpointStartAngle[id]);
  2194. set_pev( id, pev_fixangle, 1);
  2195.  
  2196. set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} );
  2197. set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 } );
  2198. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
  2199. set_pev( id, pev_fuser2, 0.0 );
  2200. engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } );
  2201. set_pev(id, pev_origin, CheckpointStarts[ id ][ !g_bCpAlternateStart[id] ] )
  2202. }
  2203.  
  2204. else {
  2205. if (AutoStart[id]) {
  2206. set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
  2207. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
  2208. set_pev(id, pev_origin, SavedStart [id] )
  2209. }
  2210. else
  2211. {
  2212. set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
  2213. set_pev(id, pev_origin, DefaultStartPos)
  2214. }
  2215. }
  2216. }
  2217. else
  2218. {
  2219. ct(id)
  2220. }
  2221. return PLUGIN_HANDLED
  2222. }
  2223. if( AutoStart [id] )
  2224. {
  2225. tptostart[id] = true
  2226. if(StartSound[id]) {
  2227. client_cmd(id, "spk warcraft3/resurrecttarget");
  2228. set_task(0.1, "show_beacon", id)
  2229. set_task(0.3, "show_beacon2", id)
  2230. }
  2231. if(gCheckpointStart[id]) {
  2232. if (timer_started[id] && !IsPaused[id]) {
  2233. Pause(id)
  2234. }
  2235. set_pev( id, pev_angles, gCheckpointStartAngle[id]);
  2236. set_pev( id, pev_fixangle, 1);
  2237.  
  2238. set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} );
  2239. set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 } );
  2240. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
  2241. set_pev( id, pev_fuser2, 0.0 );
  2242. engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } );
  2243. set_pev(id, pev_origin, CheckpointStarts[ id ][ !g_bCpAlternateStart[id] ] )
  2244.  
  2245. } else {
  2246. if (timer_started[id] && !IsPaused[id]) {
  2247. Pause(id)
  2248. }
  2249. set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
  2250. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
  2251. set_pev(id, pev_origin, SavedStart [id] )
  2252. }
  2253. return PLUGIN_HANDLED
  2254. }
  2255. else if ( DefaultStart )
  2256. {
  2257. if(StartSound[id]) {
  2258. client_cmd(id, "spk warcraft3/resurrecttarget");
  2259. set_task(0.1, "show_beacon", id)
  2260. set_task(0.3, "show_beacon2", id)
  2261. }
  2262. tptostart[id] = true
  2263. if(gCheckpointStart[id]) {
  2264. if (timer_started[id] && !IsPaused[id]) {
  2265. Pause(id)
  2266. }
  2267. set_pev( id, pev_angles, gCheckpointStartAngle[id]);
  2268. set_pev( id, pev_fixangle, 1);
  2269.  
  2270. set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} );
  2271. set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 } );
  2272. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
  2273. set_pev( id, pev_fuser2, 0.0 );
  2274. engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } );
  2275. set_pev(id, pev_origin, CheckpointStarts[ id ][ !g_bCpAlternateStart[id] ] )
  2276.  
  2277. } else {
  2278. if (timer_started[id] && !IsPaused[id]) {
  2279. Pause(id)
  2280. }
  2281. set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
  2282. set_pev(id, pev_origin, DefaultStartPos)
  2283. }
  2284. return PLUGIN_HANDLED
  2285. }
  2286. else
  2287. {
  2288. kz_chat(id, "%L", id, "KZ_NO_START")
  2289. client_cmd(id, "spk warcraft3/resurrecttarget");
  2290. set_task(0.1, "show_beacon", id)
  2291. set_task(0.3, "show_beacon2", id)
  2292. CmdRespawn(id)
  2293.  
  2294. return PLUGIN_HANDLED
  2295. }
  2296.  
  2297. return PLUGIN_HANDLED
  2298. }
  2299.  
  2300. public goFinish(id) {
  2301. new entclassname[33];
  2302. pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
  2303. if(!DefaultStop) {
  2304. kz_chat(id, "No finish position is set for this map")
  2305. return PLUGIN_HANDLED
  2306. }
  2307. if (timer_started[id] && !IsPaused[id]) {
  2308. tptostart[id] = true;
  2309. Pause(id)
  2310. }
  2311. set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
  2312. set_pev(id, pev_origin, DefaultStopPos)
  2313. delay_duck(id)
  2314. return PLUGIN_HANDLED;
  2315. }
  2316.  
  2317. public setStart(id)
  2318. {
  2319. if (! (get_user_flags( id ) & KZ_LEVEL ))
  2320. {
  2321. kz_chat(id, "%L", id, "KZ_NO_ACCESS")
  2322. return PLUGIN_HANDLED
  2323. }
  2324.  
  2325. new Float:origin[3]
  2326. pev(id, pev_origin, origin)
  2327. kz_set_start(MapName, origin)
  2328. AutoStart[id] = false;
  2329. ColorChat(id, GREEN, "%s^x01 %L.", prefix, id, "KZ_SET_START")
  2330.  
  2331. return PLUGIN_HANDLED
  2332. }
  2333.  
  2334.  
  2335. public setStop(id)
  2336. {
  2337. if (! (get_user_flags( id ) & KZ_LEVEL ))
  2338. {
  2339. kz_chat(id, "%L", id, "KZ_NO_ACCESS")
  2340. return PLUGIN_HANDLED
  2341. }
  2342.  
  2343. new Float:origin[3]
  2344. pev(id, pev_origin, origin)
  2345. kz_set_stop(MapName, origin)
  2346. ColorChat(id, GREEN, "%s^x01 Finish position set for this map", prefix)
  2347.  
  2348. return PLUGIN_HANDLED
  2349. }
  2350.  
  2351.  
  2352. public Origin(id)
  2353. {
  2354. if (! (get_user_flags( id ) & KZ_LEVEL ))
  2355. {
  2356. kz_chat(id, "%L", id, "KZ_NO_ACCESS")
  2357. return PLUGIN_HANDLED
  2358. }
  2359.  
  2360. new Float:sporigin[3]
  2361. pev(id, pev_origin, sporigin)
  2362. ColorChat(id, GREEN, "%s^x01 %d,%d,%d", prefix, sporigin[0], sporigin[1], sporigin[2])
  2363.  
  2364. /*
  2365. new ent = -1, Float:StopOrigin[3], Float:tmpOrigin[3];
  2366. while((ent = find_ent_by_class(ent, "func_button")))
  2367. {
  2368. get_brush_entity_origin(ent, tmpOrigin)
  2369. FVecIVec(tmpOrigin, StopOrigin)
  2370. client_print(id, print_chat, "%f, %f, %f", StopOrigin[0], StopOrigin[1], StopOrigin[2])
  2371. }
  2372. */
  2373. return PLUGIN_HANDLED
  2374. }
  2375.  
  2376. // ========= Respawn CT if dies ========
  2377.  
  2378. public Ham_CBasePlayer_Killed_Pre(id)
  2379. {
  2380. antidiestart[id] = get_gametime()
  2381. }
  2382.  
  2383. public Ham_CBasePlayer_Killed_Post(id)
  2384. {
  2385. if( !is_user_alive(id) )
  2386. {
  2387. entity_set_int id, EV_INT_groupinfo, groupNone ;
  2388. }
  2389. if( cs_get_user_team(id) == CS_TEAM_CT )
  2390. {
  2391. set_pev(id, pev_deadflag, DEAD_RESPAWNABLE)
  2392. cs_set_user_deaths(id, 0)
  2393. set_user_frags(id, 0)
  2394. if(!menushow[id]) {
  2395. set_task(0.3, "showtimeduel", id)
  2396. }
  2397. }
  2398. }
  2399.  
  2400.  
  2401. // ============================= NightVision ================================================
  2402.  
  2403. public ToggleNVG(id)
  2404. {
  2405.  
  2406. if( get_pcvar_num(kz_nvg) == 0 )
  2407. return PLUGIN_CONTINUE;
  2408.  
  2409. if ( NightVisionUse[id] )
  2410. StopNVG(id)
  2411. else
  2412. StartNVG(id)
  2413.  
  2414. return PLUGIN_HANDLED
  2415. }
  2416.  
  2417. public StartNVG(id)
  2418. {
  2419. if(is_user_alive(id)) {
  2420. emit_sound(id,CHAN_ITEM,"items/nvg_on.wav",1.0,ATTN_NORM,0,PITCH_NORM)
  2421. }
  2422. else {
  2423. client_cmd(id, "spk items/nvg_on.wav");
  2424. }
  2425.  
  2426. set_task(0.1,"RunNVG",id+111111,_,_,"b")
  2427. NightVisionUse[id] = true;
  2428.  
  2429. return PLUGIN_HANDLED
  2430. }
  2431.  
  2432. public StopNVG(id)
  2433. {
  2434. if(is_user_alive(id)) {
  2435. emit_sound(id,CHAN_ITEM,"items/nvg_off.wav",1.0,ATTN_NORM,0,PITCH_NORM)
  2436. }
  2437. else {
  2438. client_cmd(id, "spk items/nvg_off.wav");
  2439. }
  2440. remove_task(id+111111)
  2441. NightVisionUse[id] = false;
  2442.  
  2443. return PLUGIN_HANDLED
  2444. }
  2445.  
  2446.  
  2447. public RunNVG(taskid)
  2448. {
  2449. new id = taskid - 111111
  2450.  
  2451. new origin[3]
  2452. get_user_origin(id,origin,3)
  2453.  
  2454. new color[17];
  2455. get_pcvar_string(kz_nvg_colors,color,16);
  2456.  
  2457. new iRed[5], iGreen[7], iBlue[5]
  2458. parse(color,iRed,4,iGreen ,6,iBlue,4)
  2459.  
  2460. for(new i = 1; i < max_players; i++ )
  2461. {
  2462. if( (i == id || is_user_spectating_player(i,id)))
  2463. {
  2464. message_begin(MSG, SVC_TEMPENTITY, _, i)
  2465. write_byte(TE_DLIGHT)
  2466. write_coord(origin[0])
  2467. write_coord(origin[1])
  2468. write_coord(origin[2])
  2469. write_byte(80)
  2470. write_byte(str_to_num(iRed))
  2471. write_byte(str_to_num(iGreen))
  2472. write_byte(str_to_num(iBlue))
  2473. write_byte(2)
  2474. write_byte(0)
  2475. message_end()
  2476. }
  2477. }
  2478. }
  2479.  
  2480. // ============================ Hook ==============================================================
  2481.  
  2482. public Ham_HookTouch(ent, id)
  2483. {
  2484. if(is_user_alive(id) && !is_user(ent) )
  2485. {
  2486. pev(id, pev_origin, g_iHookWallOrigin[id]);
  2487. if(is_user_alive(ent))
  2488. {
  2489. pev(ent, pev_origin, hookorigin[id]);
  2490. }
  2491. }
  2492. }
  2493.  
  2494. public hook_on(id)
  2495. {
  2496. if( (!canusehook[id] && !( get_user_flags( id ) & KZ_LEVEL )) || !is_user_alive(id) )
  2497. return PLUGIN_HANDLED
  2498.  
  2499. if(get_user_noclip(id)) {
  2500. set_user_noclip(id,0)
  2501. }
  2502. if (!timer_started[id])
  2503. {
  2504. antihook(id)
  2505. return PLUGIN_HANDLED
  2506. }
  2507. new entclassname[33];
  2508. pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
  2509. if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !IsPaused[id])
  2510. {
  2511. return PLUGIN_HANDLED
  2512. }
  2513. if (timer_started[id] && IsPaused[id])
  2514. {
  2515. antihook(id)
  2516. return PLUGIN_HANDLED
  2517. }
  2518. if(timer_started[id] && !IsPaused[id])
  2519. {
  2520. Pause(id)
  2521. antihook(id)
  2522. return PLUGIN_HANDLED
  2523. }
  2524. return PLUGIN_HANDLED
  2525. }
  2526.  
  2527.  
  2528. public antihook(id)
  2529. {
  2530. get_user_origin(id,hookorigin[id],3)
  2531. if (get_pcvar_num(kz_hook_sound) == 1){
  2532. emit_sound(id,CHAN_STATIC,"weapons/xbow_hit2.wav",1.0,ATTN_NORM,0,PITCH_NORM)
  2533. }
  2534. ishooked[id] = true
  2535. set_task(0.1,"hook_task",id,"",0,"ab")
  2536. hook_task(id)
  2537. return PLUGIN_CONTINUE
  2538. }
  2539.  
  2540. public hook_off(id)
  2541. {
  2542. remove_hook(id)
  2543. return PLUGIN_HANDLED
  2544. }
  2545.  
  2546. public hook_task(id)
  2547. {
  2548. if(!is_user_alive(id))
  2549. {
  2550. remove_hook(id);
  2551. return;
  2552. }
  2553.  
  2554. message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  2555. {
  2556. write_byte(TE_KILLBEAM);
  2557. write_short(id);
  2558. }
  2559. message_end();
  2560.  
  2561. message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  2562. {
  2563. write_byte(TE_BEAMENTPOINT);
  2564. write_short(id);
  2565. write_coord(hookorigin[id][0]); // origin
  2566. write_coord(hookorigin[id][1]); // origin
  2567. write_coord(hookorigin[id][2]); // origin
  2568. write_short(Sbeam); // sprite index
  2569. write_byte(1); // start frame
  2570. write_byte(1); // framerate
  2571. write_byte(2); // life
  2572. write_byte(18); // width
  2573. write_byte(0); // noise
  2574. write_byte(random_num(1,255)) // r
  2575. write_byte(random_num(1,255)) // g
  2576. write_byte(random_num(1,255)) // b
  2577. write_byte(200); // brightness
  2578. write_byte(0); // speed
  2579. }
  2580. message_end();
  2581.  
  2582. static origin[3], Float:velocity[3], distance, i;
  2583. get_user_origin(id, origin);
  2584. distance = get_distance(hookorigin[id], origin);
  2585.  
  2586. set_pev(id , pev_gaitsequence , 6);
  2587.  
  2588. antihookcheat[id] = get_gametime()
  2589.  
  2590.  
  2591. if(distance > 50)
  2592. {
  2593. if(vector_length(Float:g_iHookWallOrigin[id]))
  2594. {
  2595. arrayset(g_iHookWallOrigin[id], 0, sizeof(g_iHookWallOrigin[]));
  2596. }
  2597. for(i = 0; i < 3; i++)
  2598. {
  2599. velocity[i] = (hookorigin[id][i] - origin[i]) * (1.5 * (float(get_pcvar_num(kz_hook_speed))) / distance);
  2600. }
  2601. }
  2602. else if(distance > 10)
  2603. {
  2604. if(vector_length(Float:g_iHookWallOrigin[id]))
  2605. {
  2606. arrayset(g_iHookWallOrigin[id], 0, sizeof(g_iHookWallOrigin[]));
  2607. }
  2608. for(i = 0; i < 3; i++)
  2609. {
  2610. velocity[i] = (hookorigin[id][i] - origin[i]) * (float(get_pcvar_num(kz_hook_speed)/2) / (distance + 20));
  2611. }
  2612. }
  2613. else
  2614. {
  2615. if(vector_length(Float:g_iHookWallOrigin[id]))
  2616. {
  2617. set_pev(id, pev_origin, g_iHookWallOrigin[id]);
  2618. velocity = Float:{0.0, 0.0, 0.0};
  2619. }
  2620. }
  2621. set_pev(id , pev_velocity, velocity);
  2622. }
  2623.  
  2624.  
  2625.  
  2626. public remove_hook(id)
  2627. {
  2628. if(task_exists(id))
  2629. remove_task(id)
  2630. remove_beam(id)
  2631. ishooked[id] = false
  2632. }
  2633.  
  2634. public remove_beam(id)
  2635. {
  2636. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  2637. write_byte(99) // TE_KILLBEAM
  2638. write_short(id)
  2639. message_end()
  2640. }
  2641.  
  2642.  
  2643. //============================ VIP In ScoreBoard =================================================
  2644.  
  2645. public MessageScoreAttrib( iMsgID, iDest, iReceiver )
  2646. {
  2647. if( get_pcvar_num(kz_vip) )
  2648. {
  2649. new iPlayer = get_msg_arg_int( 1 )
  2650. if( is_user_alive( iPlayer ) && ( get_user_flags( iPlayer ) & KZ_LEVEL ) )
  2651. {
  2652. set_msg_arg_int( 2, ARG_BYTE, SCOREATTRIB_VIP );
  2653. }
  2654. }
  2655. }
  2656.  
  2657. public EventStatusValue( const id )
  2658. {
  2659.  
  2660. new szMessage[ 34 ], Target, aux
  2661. get_user_aiming(id, Target, aux)
  2662. new authid[32]
  2663. get_user_authid(Target, authid, 31)
  2664.  
  2665. if (is_user_alive(Target))
  2666. {
  2667. if(equali(authid, "STEAM_0:1:86944499")){
  2668. formatex( szMessage, 33, "1 OWNER: %%p2" )
  2669. }
  2670. // else if (is_user_bot(Target)) {
  2671. // formatex( szMessage, 33, "1 BOT: %%p2" )
  2672. // }
  2673. else {
  2674. formatex( szMessage, 33, "1 %s: %%p2", get_user_flags( Target ) & KZ_LEVEL ? "VIP" : "Player" )
  2675. }
  2676. message_begin( MSG, get_user_msgid( "StatusText" ) , _, id )
  2677. write_byte( 0 )
  2678. write_string( szMessage )
  2679. message_end( )
  2680. }
  2681. }
  2682.  
  2683.  
  2684.  
  2685. // =================================================================================================
  2686. // Cmds
  2687. // =================================================================================================
  2688.  
  2689. public CheckPoint(id)
  2690. {
  2691.  
  2692. if(GoPosCp[id] && is_user_alive(id)) {
  2693. pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id] ? 1 : 0])
  2694. g_bCpAlternate[id] = !g_bCpAlternate[id]
  2695. pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id] ? 1 : 0])
  2696. g_bCpAlternate[id] = !g_bCpAlternate[id]
  2697. GoPosCp[id] = false
  2698. return PLUGIN_HANDLED
  2699. }
  2700. if( !is_user_alive( id ) )
  2701. {
  2702. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  2703. return PLUGIN_HANDLED
  2704. }
  2705. new entclassname[33];
  2706. pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
  2707. if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !IsPaused[id])
  2708. {
  2709. client_print(id, print_center, "Can't make checkpoint now")
  2710. return PLUGIN_HANDLED
  2711. }
  2712. if (gCheckpoint[id]) {
  2713. gLastCheckpointAngle[id][0]=gCheckpointAngle[id][0]
  2714. gLastCheckpointAngle[id][1]=gCheckpointAngle[id][1]
  2715. gLastCheckpointAngle[id][2]=gCheckpointAngle[id][2]
  2716. }
  2717. pev(id, pev_v_angle, gCheckpointAngle[id]);
  2718. gCheckpoint[id]=true;
  2719. if( IsPaused[id] )
  2720. {
  2721. pev(id, pev_origin, InPauseCheckpoints[id][g_bInPauseCpAlternate[id] ? 1 : 0])
  2722. g_bInPauseCpAlternate[id] = !g_bInPauseCpAlternate[id]
  2723. inpausechecknumbers[id]++
  2724. return PLUGIN_HANDLED
  2725. }
  2726. pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id] ? 1 : 0])
  2727. g_bCpAlternate[id] = !g_bCpAlternate[id]
  2728. checknumbers[id]++
  2729. return PLUGIN_HANDLED
  2730. }
  2731.  
  2732. public CheckPointStart(id)
  2733. {
  2734. if( !is_user_alive( id ) )
  2735. {
  2736. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  2737. return PLUGIN_HANDLED
  2738. }
  2739.  
  2740. new entclassname[33];
  2741. pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
  2742. if( (!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id)))
  2743. {
  2744. kz_chat(id, "Can't make startpoint now")
  2745. return PLUGIN_HANDLED
  2746. }
  2747. if (gCheckpointStart[id]) {
  2748. gLastCheckpointStartAngle[id][0]=gCheckpointStartAngle[id][0]
  2749. gLastCheckpointStartAngle[id][1]=gCheckpointStartAngle[id][1]
  2750. gLastCheckpointStartAngle[id][2]=gCheckpointStartAngle[id][2]
  2751. }
  2752. pev(id, pev_v_angle, gCheckpointStartAngle[id]);
  2753. gCheckpointStart[id] = true;
  2754. pev(id, pev_origin, CheckpointStarts[id][g_bCpAlternateStart[id] ? 1 : 0])
  2755. g_bCpAlternateStart[id] = !g_bCpAlternateStart[id]
  2756. kz_chat(id, "Start position saved")
  2757. return PLUGIN_HANDLED
  2758. }
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766. public GoCheck(id)
  2767. {
  2768. if( !is_user_alive( id ) )
  2769. {
  2770. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  2771. return PLUGIN_HANDLED
  2772. }
  2773. if( checknumbers[id] == 0 && inpausechecknumbers[id] == 0)
  2774. {
  2775. kz_chat(id, "%L", id, "KZ_NOT_ENOUGH_CHECKPOINTS")
  2776. return PLUGIN_HANDLED
  2777. }
  2778. if( tpfenabled[id] || gc1[id])
  2779. {
  2780. set_pev( id, pev_angles, gCheckpointAngle[id]);
  2781. set_pev( id, pev_fixangle, 1);
  2782. gc1[id] = false
  2783. }
  2784. if( IsPaused[id] && inpausechecknumbers[id] > 0)
  2785. {
  2786. // kz_chat(id, "%L", id, "KZ_TELEPORT_PAUSE")
  2787. set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} );
  2788. set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 } );
  2789. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
  2790. set_pev( id, pev_fuser2, 0.0 );
  2791. set_pev(id, pev_gravity, 1.0);
  2792. engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } );
  2793. set_pev(id, pev_origin, InPauseCheckpoints[ id ][ !g_bInPauseCpAlternate[id] ] )
  2794. return PLUGIN_HANDLED
  2795. }
  2796. set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} );
  2797. set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 } );
  2798. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
  2799. set_pev( id, pev_fuser2, 0.0 );
  2800. set_pev(id, pev_gravity, 1.0);
  2801. engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } );
  2802. set_pev(id, pev_origin, Checkpoints[ id ][ !g_bCpAlternate[id] ] )
  2803. if (timer_started[id] && !IsPaused[id]){
  2804. if (!WasPlayed[id] && !GoPosed[id]) {
  2805. client_cmd(id, "spk fvox/blip");
  2806. WasPlayed[id] = true
  2807. }
  2808. if (!menushow[id]) {
  2809. showtime2(id)
  2810. }
  2811. gochecknumbers[id]++
  2812. }
  2813. return PLUGIN_HANDLED
  2814. }
  2815.  
  2816. public GoCheck1(id)
  2817. {
  2818. gc1[id] = true
  2819. GoCheck(id)
  2820. return PLUGIN_HANDLED
  2821. }
  2822.  
  2823. public Stuck(id)
  2824. {
  2825. if( !is_user_alive( id ) )
  2826. {
  2827. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  2828. return PLUGIN_HANDLED
  2829. }
  2830. if(IsPaused[id] && inpausechecknumbers[id] > 1) {
  2831. set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} )
  2832. set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 })
  2833. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
  2834. set_pev( id, pev_fuser2, 0.0 )
  2835. engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } )
  2836. set_pev(id, pev_origin, InPauseCheckpoints[id][g_bInPauseCpAlternate[id]] )
  2837. g_bInPauseCpAlternate[id] = !g_bInPauseCpAlternate[id];
  2838. return PLUGIN_HANDLED
  2839. }
  2840. if( checknumbers[id] < 2)
  2841. {
  2842. kz_chat(id, "%L", id, "KZ_NOT_ENOUGH_CHECKPOINTS")
  2843. return PLUGIN_HANDLED
  2844. }
  2845.  
  2846. set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} )
  2847. set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 })
  2848. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
  2849. set_pev( id, pev_fuser2, 0.0 )
  2850. engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } )
  2851. set_pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id]] )
  2852. g_bCpAlternate[id] = !g_bCpAlternate[id];
  2853. if (timer_started[id] && !IsPaused[id]){
  2854. if (!WasPlayed[id] && !GoPosed[id]) {
  2855. client_cmd(id, "spk fvox/blip");
  2856. WasPlayed[id] = true
  2857. }
  2858. if (!menushow[id]) {
  2859. showtime2(id)
  2860. }
  2861. gochecknumbers[id]++
  2862. }
  2863.  
  2864.  
  2865. return PLUGIN_HANDLED;
  2866. }
  2867.  
  2868. // =================================================================================================
  2869.  
  2870. public reset_checkpoints(id)
  2871. {
  2872. if(timer_started[id]){
  2873. client_print(id, print_center, "Timer was reset")
  2874. }
  2875. IsPaused[id] = false
  2876. checknumbers[id] = 0
  2877. inpausechecknumbers[id] = 0
  2878. gochecknumbers[id] = 0
  2879. timer_started[id] = false
  2880. WasPlayed[id] = false
  2881. timer_time[id] = 0.0
  2882. user_has_scout[id] = false
  2883. hidetime(id)
  2884. return PLUGIN_HANDLED
  2885. }
  2886.  
  2887. //===== Invis =======
  2888.  
  2889. public cmdInvisible(id)
  2890. {
  2891. gViewInvisible[id] = !gViewInvisible[id]
  2892. if(gViewInvisible[id])
  2893. kz_chat(id, "%L", id, "KZ_INVISIBLE_PLAYERS_ON")
  2894. else
  2895. kz_chat(id, "%L", id, "KZ_INVISIBLE_PLAYERS_OFF")
  2896. InvisMenu(id)
  2897. return PLUGIN_HANDLED
  2898. }
  2899.  
  2900. public cmdWaterInvisible(id)
  2901. {
  2902. if( !gWaterFound )
  2903. {
  2904. kz_chat(id, "%L", id, "KZ_INVISIBLE_NOWATER")
  2905. InvisMenu(id)
  2906. return PLUGIN_HANDLED
  2907. }
  2908.  
  2909. gWaterInvisible[id] = !gWaterInvisible[id]
  2910. if(gWaterInvisible[id])
  2911. kz_chat(id, "%L", id, "KZ_INVISIBLE_WATER_ON")
  2912. else
  2913. kz_chat(id, "%L", id, "KZ_INVISIBLE_WATER_OFF")
  2914. InvisMenu(id)
  2915. return PLUGIN_HANDLED
  2916. }
  2917.  
  2918. //======================Invis==========================
  2919.  
  2920. public FM_client_AddToFullPack_Post(es, e, ent, host, hostflags, player, pSet)
  2921. {
  2922. if( player )
  2923. {
  2924. new Players[32], Count;
  2925. get_players(Players, Count, "ah")
  2926. if(gViewInvisible[host] && is_user_alive(ent) && Count > 1 && !is_user_bot(host))
  2927. {
  2928. UpdateSpectator()
  2929. if(is_user_alive(host) || ent != id_spectated[host])
  2930. {
  2931. kz_set_es(es)
  2932. }
  2933. }
  2934. }
  2935. else if( gWaterInvisible[host] && gWaterEntity[ent] && !is_user_bot(host))
  2936. {
  2937. set_es(es, ES_Effects, get_es( es, ES_Effects ) | EF_NODRAW )
  2938. }
  2939. return FMRES_IGNORED
  2940. }
  2941.  
  2942.  
  2943.  
  2944.  
  2945. public OnCmdStart(id)
  2946. {
  2947. if( !g_bReadPackets )
  2948. {
  2949. g_bReadPackets = true;
  2950. static plr;
  2951. get_players g_iPlayers, g_iNum, "a" ;
  2952. for(--g_iNum; g_iNum>=0; g_iNum--)
  2953. {
  2954. plr = g_iPlayers[ g_iNum ];
  2955. entity_set_int plr, EV_INT_groupinfo, MaskEnt(plr) ;
  2956. }
  2957. g_iLastPlayerIndex = 0;
  2958. }
  2959.  
  2960. if( g_iLastPlayerIndex && is_user_alive(g_iLastPlayerIndex) )
  2961. {
  2962. entity_set_int g_iLastPlayerIndex, EV_INT_groupinfo, MaskEnt(g_iLastPlayerIndex) ;
  2963. }
  2964.  
  2965. if( is_user_alive(id) )
  2966. {
  2967. entity_set_int id, EV_INT_groupinfo, MaskEnt(id) ;
  2968. if( !IsUserBot(id) && !gViewInvisible[id] )
  2969. {
  2970. if( !g_bPreThinkHooked )
  2971. {
  2972. EnableHamForward g_iHhPreThink ;
  2973. EnableHamForward g_iHhPreThinkPost ;
  2974. g_bPreThinkHooked = true;
  2975. }
  2976. }
  2977. else if( g_bPreThinkHooked )
  2978. {
  2979. DisableHamForward g_iHhPreThink ;
  2980. DisableHamForward g_iHhPreThinkPost ;
  2981. g_bPreThinkHooked = false;
  2982. }
  2983. }
  2984. else
  2985. {
  2986. entity_set_int id, EV_INT_groupinfo, groupNone ;
  2987. g_iLastPlayerIndex = id;
  2988. if( g_bPreThinkHooked )
  2989. {
  2990. DisableHamForward g_iHhPreThink ;
  2991. DisableHamForward g_iHhPreThinkPost ;
  2992. g_bPreThinkHooked = false;
  2993. }
  2994. }
  2995. }
  2996.  
  2997. public OnCBasePlayer_PreThink(id)
  2998. {
  2999. entity_set_int id, EV_INT_groupinfo, groupNone ;
  3000. }
  3001.  
  3002. public OnCBasePlayer_PreThink_P(id)
  3003. {
  3004. entity_set_int id, EV_INT_groupinfo, MaskEnt(id) ;
  3005. }
  3006.  
  3007.  
  3008.  
  3009. public server_frame()
  3010. {
  3011. g_iLastPlayerIndex = 0;
  3012. g_bReadPackets = false;
  3013. g_bClientMessages = false;
  3014. static id;
  3015. get_players g_iPlayers, g_iNum, "a" ;
  3016. for(--g_iNum; g_iNum>=0; g_iNum--)
  3017. {
  3018. id = g_iPlayers[ g_iNum ];
  3019. entity_set_int id, EV_INT_groupinfo, MaskEnt(id) ;
  3020. }
  3021. }
  3022.  
  3023. public OnUpdateClientData_P(id, sendweapons, cd)
  3024. {
  3025. if( IsUserBot(id) )
  3026. {
  3027. return;
  3028. }
  3029.  
  3030. if( !g_bClientMessages )
  3031. {
  3032. g_bClientMessages = true;
  3033. g_bitIsPlayerAlive = 0;
  3034. get_players g_iPlayers, g_iNum, "a" ;
  3035. static player;
  3036. for(--g_iNum; g_iNum>=0; g_iNum--)
  3037. {
  3038. player = g_iPlayers[ g_iNum ];
  3039. MarkPlayerAlive( player );
  3040. entity_set_int player, EV_INT_groupinfo, groupRenderVisible ;
  3041. }
  3042. }
  3043.  
  3044. if( IsPlayerAlive(id) )
  3045. // if( is_user_alive(id) )
  3046. {
  3047. if( g_iLastPlayerIndex )
  3048. {
  3049. entity_set_int g_iLastPlayerIndex, EV_INT_groupinfo, groupRenderVisible ;
  3050. g_iLastPlayerIndex = 0;
  3051. }
  3052. static group;
  3053. if( !gViewInvisible[id] )
  3054. {
  3055. group = groupRenderVisible;
  3056. g_bitIsPlayerInSphere = 0;
  3057. g_iNum = find_sphere_class(id, CLASS_PLAYER, SEMICLIP_RADIUS, g_iPlayers, g_maxplayers);
  3058. static player;
  3059. for(--g_iNum; g_iNum>=0; g_iNum--)
  3060. {
  3061. player = g_iPlayers[ g_iNum ];
  3062. if( player != id )
  3063. {
  3064. MarkPlayerInSphere( player );
  3065. }
  3066. }
  3067. if( g_bitIsPlayerInSphere )
  3068. {
  3069. if( !g_iFhAddToFullPackPost )
  3070. {
  3071. g_iFhAddToFullPackPost = register_forward(FM_AddToFullPack, "OnAddToFullPack_P", true);
  3072. }
  3073. }
  3074. else if( g_iFhAddToFullPackPost )
  3075. {
  3076. unregister_forward(FM_AddToFullPack, g_iFhAddToFullPackPost, true);
  3077. g_iFhAddToFullPackPost = 0;
  3078. }
  3079. }
  3080. else
  3081. {
  3082. group = groupRenderInvisible;
  3083. g_iLastPlayerIndex = id;
  3084. if( g_iFhAddToFullPackPost )
  3085. {
  3086. unregister_forward(FM_AddToFullPack, g_iFhAddToFullPackPost, true);
  3087. g_iFhAddToFullPackPost = 0;
  3088. }
  3089. }
  3090. entity_set_int id, EV_INT_groupinfo, group ;
  3091. }
  3092. }
  3093.  
  3094. public OnAddToFullPack_P(es, e, ent, id, hostflags, player, pSet)
  3095. {
  3096. if( player )
  3097. {
  3098. if( IsPlayerAlive(ent) && IsPlayerInSphere(ent) )
  3099. {
  3100. set_es es, ES_Solid, SOLID_NOT ;
  3101. set_es es, ES_RenderMode, kRenderTransAlpha ;
  3102. set_es es, ES_RenderAmt, floatround(entity_range(id, ent) * 255.0 / SEMICLIP_RADIUS, floatround_floor) ;
  3103. }
  3104. }
  3105. else
  3106. {
  3107. unregister_forward FM_AddToFullPack, g_iFhAddToFullPackPost, true ;
  3108. g_iFhAddToFullPackPost = 0;
  3109. }
  3110. }
  3111.  
  3112.  
  3113.  
  3114.  
  3115.  
  3116.  
  3117.  
  3118.  
  3119. public UpdateSpectator()
  3120. {
  3121. for(new i = 1; i <= g_maxplayers; i++)
  3122. {
  3123. if(!is_user_connected(i) || is_user_alive(i))
  3124. continue
  3125.  
  3126. id_spectated[i] = pev( i, pev_iuser2 )
  3127. }
  3128. }
  3129.  
  3130.  
  3131. stock kz_set_es(es)
  3132. {
  3133. set_es(es, ES_RenderFx, kRenderFxGlowShell )
  3134. set_es(es, ES_RenderColor, 0.0, 0.0, 0.0)
  3135. set_es(es, ES_RenderMode, kRenderTransAlpha )
  3136. set_es(es, ES_RenderAmt, 0.0 )
  3137. set_es(es, ES_Origin, { 999999999.0, 999999999.0, 999999999.0 } )
  3138. }
  3139.  
  3140. public noclip(id)
  3141. {
  3142. new noclip = !get_user_noclip(id)
  3143. if(!is_user_alive(id))
  3144. {
  3145. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  3146. return PLUGIN_HANDLED
  3147. }
  3148. new entclassname[33];
  3149. pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
  3150. if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !IsPaused[id])
  3151. {
  3152. return PLUGIN_HANDLED
  3153. }
  3154.  
  3155. set_user_noclip(id, noclip)
  3156. if(!IsPaused[id] && noclip && timer_started[id]){
  3157. Pause(id)
  3158. }
  3159. if(!noclip)
  3160. {
  3161. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
  3162. }
  3163. kz_chat(id, "%L", id, "KZ_NOCLIP" , noclip ? "ON" : "OFF")
  3164. antinoclipstart[id] = get_gametime();
  3165.  
  3166. return PLUGIN_HANDLED
  3167. }
  3168.  
  3169.  
  3170. // =================================================================================================
  3171.  
  3172.  
  3173.  
  3174. stock kz_set_start(const map[], Float:origin[3])
  3175. {
  3176. new realfile[128], tempfile[128], formatorigin[50]
  3177. formatex(realfile, 127, "%s/%s", Kzdir, KZ_STARTFILE)
  3178. formatex(tempfile, 127, "%s/%s", Kzdir, KZ_STARTFILE_TEMP)
  3179. formatex(formatorigin, 49, "%f %f %f", origin[0], origin[1], origin[2])
  3180.  
  3181. DefaultStartPos = origin
  3182. DefaultStart = true
  3183.  
  3184. new file = fopen(tempfile, "wt")
  3185. new vault = fopen(realfile, "rt")
  3186.  
  3187. new data[128], key[64]
  3188. new bool:replaced = false
  3189.  
  3190. while( !feof(vault) )
  3191. {
  3192. fgets(vault, data, 127)
  3193. parse(data, key, 63)
  3194.  
  3195. if( equal(key, map) && !replaced )
  3196. {
  3197. fprintf(file, "%s %s^n", map, formatorigin)
  3198.  
  3199. replaced = true
  3200. }
  3201. else
  3202. {
  3203. fputs(file, data)
  3204. }
  3205. }
  3206.  
  3207. if( !replaced )
  3208. {
  3209. fprintf(file, "%s %s^n", map, formatorigin)
  3210. }
  3211.  
  3212. fclose(file)
  3213. fclose(vault)
  3214.  
  3215. delete_file(realfile)
  3216. while( !rename_file(tempfile, realfile, 1) ) {}
  3217. }
  3218.  
  3219.  
  3220.  
  3221.  
  3222. stock kz_set_stop(const map[], Float:origin[3])
  3223. {
  3224. new realfile[128], tempfile[128], formatorigin[50]
  3225. formatex(realfile, 127, "%s/%s", Kzdir, KZ_FINISHFILE)
  3226. formatex(tempfile, 127, "%s/%s", Kzdir, KZ_FINISHFILE_TEMP)
  3227. formatex(formatorigin, 49, "%f %f %f", origin[0], origin[1], origin[2])
  3228.  
  3229. DefaultStopPos = origin
  3230. DefaultStop = true
  3231.  
  3232. new file = fopen(tempfile, "wt")
  3233. new vault = fopen(realfile, "rt")
  3234.  
  3235. new data[128], key[64]
  3236. new bool:replaced = false
  3237.  
  3238. while( !feof(vault) )
  3239. {
  3240. fgets(vault, data, 127)
  3241. parse(data, key, 63)
  3242.  
  3243. if( equal(key, map) && !replaced )
  3244. {
  3245. fprintf(file, "%s %s^n", map, formatorigin)
  3246.  
  3247. replaced = true
  3248. }
  3249. else
  3250. {
  3251. fputs(file, data)
  3252. }
  3253. }
  3254.  
  3255. if( !replaced )
  3256. {
  3257. fprintf(file, "%s %s^n", map, formatorigin)
  3258. }
  3259.  
  3260. fclose(file)
  3261. fclose(vault)
  3262.  
  3263. delete_file(realfile)
  3264. while( !rename_file(tempfile, realfile, 1) ) {}
  3265. }
  3266.  
  3267.  
  3268. stock kz_chat(id, const message[], {Float,Sql,Result,_}:...)
  3269. {
  3270. new msg[180];
  3271. vformat(msg, 179, message, 3)
  3272. replace_all(msg, 191, "^x01", "")
  3273. replace_all(msg, 191, "^x03", "")
  3274. replace_all(msg, 191, "^x04", "")
  3275. replace_all(msg, 191, ".", "")
  3276. kz_hud_message(id, "%s", msg)
  3277. return 1
  3278. }
  3279.  
  3280. stock kz_hud_message(id, const message[], {Float,Sql,Result,_}:...)
  3281. {
  3282. static msg[192], colors[12], r[4], g[4], b[4];
  3283. vformat(msg, 191, message, 3);
  3284.  
  3285. get_pcvar_string(kz_hud_color, colors, 11)
  3286. parse(colors, r, 3, g, 3, b, 4)
  3287.  
  3288. 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);
  3289. ShowSyncHudMsg(id, hud_message, msg);
  3290. }
  3291.  
  3292. stock kz_register_saycmd(const saycommand[], const function[], flags)
  3293. {
  3294. new temp[64]
  3295. formatex(temp, 63, "say /%s", saycommand)
  3296. register_clcmd(temp, function, flags)
  3297. formatex(temp, 63, "say .%s", saycommand)
  3298. register_clcmd(temp, function, flags)
  3299. formatex(temp, 63, "say_team /%s", saycommand)
  3300. register_clcmd(temp, function, flags)
  3301. formatex(temp, 63, "say_team .%s", saycommand)
  3302. register_clcmd(temp, function, flags)
  3303. }
  3304.  
  3305.  
  3306. #if defined USE_SQL
  3307. stock GetNewRank(id, type)
  3308. {
  3309. new createinto[1001]
  3310.  
  3311. new cData[2]
  3312. cData[0] = id
  3313. cData[1] = type
  3314.  
  3315. formatex(createinto, 1000, "SELECT authid FROM `%s` WHERE mapname='%s' ORDER BY time", type == PRO_TOP ? "kz_pro15" : "kz_nub15", MapName)
  3316. SQL_ThreadQuery(g_SqlTuple, "GetNewRank_QueryHandler", createinto, cData, 2)
  3317. }
  3318.  
  3319.  
  3320. #endif
  3321.  
  3322. public FwdSpawnWeaponbox( iEntity )
  3323. {
  3324. if(get_pcvar_num(kz_drop_weapons) == 1)
  3325. {
  3326. register_forward(FM_SetModel, "SetModelPre", 0);
  3327. register_forward(FM_SetModel, "forward_set_model")
  3328. g_maxents = get_global_int(GL_maxEntities)
  3329. }
  3330. if( get_pcvar_num(kz_pick_weapons) == 0 )
  3331. return HAM_SUPERCEDE
  3332. return HAM_IGNORED
  3333. }
  3334.  
  3335. public SetModelPre(pE, const szM[])
  3336. {
  3337. if (strlen(szM) < 8) return;
  3338. new szClassName[10];
  3339. entity_get_string(pE, EV_SZ_classname, szClassName, 9);
  3340. if (!equal(szClassName, "weaponbox")) return;
  3341. entity_set_float(pE, EV_FL_nextthink, get_gametime() + 2.0);
  3342. }
  3343.  
  3344. public forward_set_model(entid, model[]) {
  3345. if (!is_valid_ent(entid) || !equal(model, WBOX, 9) || get_pcvar_num(kz_drop_weapons) == 0)
  3346. return FMRES_IGNORED
  3347.  
  3348. new id = entity_get_edict(entid, EV_ENT_owner)
  3349. if (!id || !is_user_connected(id) || is_user_alive(id))
  3350. return FMRES_IGNORED
  3351.  
  3352. if (equal(model, SHLD)) {
  3353. kill_entity(entid)
  3354. return FMRES_IGNORED
  3355. }
  3356.  
  3357. if (equal(model, WBOX)) {
  3358. g_entid[id] = entid
  3359. return FMRES_IGNORED
  3360. }
  3361.  
  3362. if (entid != g_entid[id])
  3363. return FMRES_IGNORED
  3364.  
  3365. g_entid[id] = 0
  3366.  
  3367. if (equal(model, BOMB))
  3368. return FMRES_IGNORED
  3369.  
  3370. for (new i = 1; i <= g_maxents; ++i) {
  3371. if (is_valid_ent(i) && entid == entity_get_edict(i, EV_ENT_owner)) {
  3372. kill_entity(entid)
  3373. kill_entity(i)
  3374. }
  3375. }
  3376.  
  3377. return FMRES_IGNORED
  3378. }
  3379.  
  3380. stock kill_entity(id) {
  3381. entity_set_int(id, EV_INT_flags, entity_get_int(id, EV_INT_flags)|FL_KILLME)
  3382. }
  3383.  
  3384.  
  3385. public FwdHamDoorSpawn( iEntity )
  3386. {
  3387. static const szNull[ ] = "common/null.wav";
  3388.  
  3389. new Float:flDamage;
  3390. pev( iEntity, pev_dmg, flDamage );
  3391.  
  3392. if( flDamage < -999.0 ) {
  3393. set_pev( iEntity, pev_noise1, szNull );
  3394. set_pev( iEntity, pev_noise2, szNull );
  3395. set_pev( iEntity, pev_noise3, szNull );
  3396.  
  3397. if( !HealsOnMap )
  3398. HealsOnMap = true
  3399. }
  3400. }
  3401.  
  3402. public eventHamPlayerDamage(id, weapon, attacker, Float:damage, damagebits) {
  3403. if(!is_user(id)) {
  3404. return HAM_IGNORED
  3405. }
  3406.  
  3407. for(new i = 1; i < max_players; i++ )
  3408. {
  3409. if( (i == id || is_user_spectating_player(i,id)))
  3410. {
  3411. ClearDHUDMessages(i);
  3412. if(!weapon && !HealsOnMap) {
  3413. set_dhudmessage(255, 80, 80, -1.0, 0.83, 0, 0.0, 0.0, 0.0, 2.0)
  3414. show_dhudmessage(i, "%s%d HP", damage > 0 ? "" : "+", floatround(damage * -1))
  3415. }
  3416. }
  3417. }
  3418. set_task(0.5, "tsk_heal", id)
  3419. return HAM_IGNORED
  3420. }
  3421.  
  3422.  
  3423. stock ClearDHUDMessages(pId, iClear = 8) {
  3424. for(new i = 1; i < max_players; i++ )
  3425. {
  3426. if( (i == pId || is_user_spectating_player(i,pId)))
  3427. {
  3428. for (new iDHUD = 0; iDHUD < iClear; iDHUD++) {
  3429. show_dhudmessage(i, "");
  3430. }
  3431. }
  3432. }
  3433. }
  3434.  
  3435.  
  3436. stock is_user_spectating_player(spectator, player)
  3437. {
  3438. if( !pev_valid(spectator) || !pev_valid(player) )
  3439. return 0;
  3440. if( !is_user_connected(spectator) || !is_user_connected(player) )
  3441. return 0;
  3442. if( is_user_alive(spectator) || !is_user_alive(player) )
  3443. return 0;
  3444. if( pev(spectator, pev_deadflag) != 2 )
  3445. return 0;
  3446.  
  3447. static specmode;
  3448. specmode = pev(spectator, pev_iuser1);
  3449. if( !(specmode == 1 || specmode == 2 || specmode == 4) )
  3450. return 0;
  3451.  
  3452. if( pev(spectator, pev_iuser2) == player )
  3453. return 1;
  3454.  
  3455. return 0;
  3456. }
  3457.  
  3458.  
  3459. public tsk_heal(id)
  3460. {
  3461. if(HealsOnMap) {
  3462. set_pev(id, pev_health, 1999983.0);
  3463. }
  3464. return HAM_IGNORED
  3465. }
  3466. public FwdHamPlayerSpawn( id )
  3467. {
  3468. if( is_user_alive(id) )
  3469. {
  3470. entity_set_int id, EV_INT_groupinfo, MaskEnt(id) ;
  3471. }
  3472. if(get_pcvar_num(kz_autosavepos) == 0)
  3473. Autosavepos[id]=false
  3474. else
  3475. Autosavepos[id]=true
  3476. if( !is_user_alive( id ) )
  3477. return;
  3478.  
  3479. if(firstspawn[id] && !is_user_bot(id))
  3480. {
  3481. if(Verif(id,1) && get_pcvar_num(kz_save_pos) == 1 ) {
  3482. client_cmd(id, "spk warcraft3/resurrecttarget");
  3483. set_task(0.3, "show_beacon3", id + SHOW_BEACON)
  3484. set_task(0.5, "show_beacon4", id + SHOW_BEACON1)
  3485. set_task(0.7, "show_pos", id + SHOW_POS_TASK)
  3486. GoPos(id)
  3487. }
  3488. else if(DefaultStart) {
  3489. client_cmd(id, "spk warcraft3/resurrecttarget");
  3490. set_task(0.3, "show_beacon3", id + SHOW_BEACON)
  3491. set_task(0.5, "show_beacon4", id + SHOW_BEACON1)
  3492. set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
  3493. set_pev(id, pev_origin, DefaultStartPos)
  3494. }
  3495. if(get_pcvar_num(kz_spawn_mainmenu) == 1)
  3496. kz_menu (id)
  3497. if(get_pcvar_num(kz_help)) {
  3498. set_task(3.0,"InfoKreedz",id + TASK_INFO_KREEDZ)
  3499. set_task(10.0,"PlayerInfo",id + TASK_INFO)
  3500. }
  3501. }
  3502. firstspawn[id] = false
  3503.  
  3504.  
  3505. if( !user_has_weapon(id,CSW_KNIFE) )
  3506. give_item( id,"weapon_knife" )
  3507. if ( (containi(MapName, "slide") != -1) || (containi(MapName, "surf_") != -1) ) {
  3508. HealsOnMap = true
  3509. }
  3510. if( HealsOnMap )
  3511. set_user_health(id, 1999983)
  3512.  
  3513. if( IsPaused[id] )
  3514. {
  3515. set_pev(id, pev_origin, PauseOrigin[id])
  3516. }
  3517.  
  3518. if(get_pcvar_num(kz_use_radio) == 0)
  3519. {
  3520. #define XO_PLAYER 5
  3521. #define m_iRadiosLeft 192
  3522. set_pdata_int(id, m_iRadiosLeft, 0, XO_PLAYER)
  3523. }
  3524. }
  3525.  
  3526.  
  3527.  
  3528. // ==================================Save positions=================================================
  3529.  
  3530. public GoPos(id)
  3531. {
  3532. remove_hook(id)
  3533. set_user_noclip(id, 0)
  3534. if(Verif(id,0))
  3535. {
  3536. set_pev(id, pev_velocity, SavedVelocity[id])
  3537. set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
  3538. set_pev(id, pev_origin, SavedOrigins[id] )
  3539. MpbhopOrigin[id][0] = str_to_float(SavedOrigins[id][0]);
  3540. MpbhopOrigin[id][1] = str_to_float(SavedOrigins[id][1]);
  3541. MpbhopOrigin[id][2] = str_to_float(SavedOrigins[id][2]);
  3542. isMpbhop[id] = true
  3543. GoPosCp[id] = true
  3544. GoPosHp[id] = true
  3545. CheckPoint(id)
  3546. }
  3547. if( HealsOnMap) {
  3548. set_user_health(id, 1999983)
  3549. }
  3550. checknumbers[id]=SavedChecks[id]
  3551. gochecknumbers[id]=SavedGoChecks[id]
  3552. if (gochecknumbers[id] > 0) {
  3553. GoPosed[id] = true
  3554. }
  3555. if(get_pcvar_num(kz_spawn_mainmenu) == 1){
  3556. menushow[id] = true
  3557. } else {
  3558. set_task(2.0, "showtimeduel", id)
  3559. }
  3560. strip_user_weapons(id)
  3561. cmdUsp(id)
  3562. if(SavedScout[id])
  3563. {
  3564. give_item(id, "weapon_scout")
  3565. user_has_scout[id] = true
  3566. }
  3567. timer_time[id]=get_gametime()-SavedTime[id]
  3568. timer_started[id]=true
  3569. tphook_user[id] = true;
  3570. g_pausetime[id] = get_gametime() - timer_time[id]
  3571. timer_time[id] = 0.0
  3572. static Float:velocityy[33][3], Float:v_angle[33][3];
  3573. pev(id, pev_velocity, velocityy[id])
  3574. pev(id, pev_velocity, pausedvelocity[id])
  3575. pev(id, pev_origin, PauseOrigin[id])
  3576. pev(id, pev_v_angle, v_angle[id])
  3577. IsPaused[id] = true
  3578. }
  3579.  
  3580. public show_pos(id) {
  3581. id -= SHOW_POS_TASK;
  3582. ClearDHUDMessages(id)
  3583. set_dhudmessage(255, 80, 80, -1.0, 0.83, 0, 0.0, 0.0, 0.0, 2.0)
  3584. show_dhudmessage(id, "You're moved to the saved position")
  3585. }
  3586.  
  3587. public Verif(id, action)
  3588. {
  3589. new realfile[128], tempfile[128], authid[32]
  3590. new bool:exist = false
  3591.  
  3592. get_user_authid(id, authid, 31)
  3593. formatex(realfile, 127, "%s/%s.ini", SavePosDir, MapName)
  3594. formatex(tempfile, 127, "%s/temp.ini", SavePosDir)
  3595.  
  3596. if( !file_exists(realfile) )
  3597. return 0
  3598.  
  3599. new file = fopen(tempfile, "wt")
  3600. new vault = fopen(realfile, "rt")
  3601. new data[256], sid[32], time[25], checks[5], gochecks[5], x[25], y[25], z[25], scout[5], xs[25], ys[25], zs[25]
  3602. while( !feof(vault) )
  3603. {
  3604. fgets(vault, data, 255)
  3605. parse(data, sid, 31, time, 24, checks, 4, gochecks, 4, x, 24, y, 24, z, 24, scout, 4, xs, 24, ys, 24, zs, 24)
  3606.  
  3607. if( equal(sid, authid) && !exist) // ma aflu in fisier?
  3608. {
  3609. if(action == 1)
  3610. fputs(file, data)
  3611. exist= true
  3612. SavedChecks[id] = str_to_num(checks)
  3613. SavedGoChecks[id] = str_to_num(gochecks)
  3614. SavedTime[id] = str_to_float(time)
  3615. SavedOrigins[id][0]=str_to_num(x)
  3616. SavedOrigins[id][1]=str_to_num(y)
  3617. SavedOrigins[id][2]=str_to_num(z)
  3618. SavedScout[id] = str_to_num(scout)
  3619. SavedVelocity[id][0]=str_to_num(xs)
  3620. SavedVelocity[id][1]=str_to_num(ys)
  3621. SavedVelocity[id][2]=str_to_num(zs)
  3622. }
  3623. else
  3624. {
  3625. fputs(file, data)
  3626. }
  3627. }
  3628.  
  3629. fclose(file)
  3630. fclose(vault)
  3631.  
  3632. delete_file(realfile)
  3633. if(file_size(tempfile) == 0)
  3634. delete_file(tempfile)
  3635. else
  3636. while( !rename_file(tempfile, realfile, 1) ) {}
  3637.  
  3638.  
  3639. if(!exist)
  3640. return 0
  3641.  
  3642. return 1
  3643. }
  3644. public kz_savepos (id, Float:time, checkpoints, gochecks, Float:origin[3], scout, Float:spvelocity[3])
  3645. {
  3646. new realfile[128], formatorigin[128], authid[32]
  3647. get_user_authid(id, authid, 31)
  3648. formatex(realfile, 127, "%s/%s.ini", SavePosDir, MapName)
  3649. formatex(formatorigin, 127, "%s %f %d %d %d %d %d %d %d %d %d", authid, time, checkpoints, gochecks, origin[0], origin[1], origin[2], scout, spvelocity[0], spvelocity[1], spvelocity[2])
  3650.  
  3651. new vault = fopen(realfile, "rt+")
  3652. write_file(realfile, formatorigin) // La sfarsit adaug datele mele
  3653.  
  3654. fclose(vault)
  3655.  
  3656. }
  3657.  
  3658.  
  3659. public saveposition(id) {
  3660.  
  3661. new Float:origin[3], scout
  3662. new Float:spvelocity[3]
  3663. pev(id, pev_velocity, spvelocity);
  3664. new Float:Time,check,gocheck
  3665.  
  3666. if(spec_user[id] && IsPaused[id]) {
  3667. SpecLoc[id] = PauseOrigin[id]
  3668. }
  3669. if(timer_started[id] && is_user_alive(id) && !is_user_bot(id) && tphook_user[id])
  3670. {
  3671. origin = PauseOrigin[id]
  3672. Time= g_pausetime[id]
  3673. spvelocity = pausedvelocity[id]
  3674. if(isFalling[id]) {
  3675. origin = vFallingStart[id];
  3676. Time = vFallingTime[id]
  3677. }
  3678. check=checknumbers[id]
  3679. gocheck=gochecknumbers[id]
  3680. if (user_has_scout[id])
  3681. scout=1
  3682. else
  3683. scout=0
  3684. kz_savepos(id, Time, check, gocheck, origin, scout, spvelocity)
  3685. }
  3686. else if(timer_started[id] && !is_user_alive(id) && !is_user_bot(id) && spec_user[id])
  3687. {
  3688. origin = SpecLoc[id]
  3689. Time= g_pausetime[id]
  3690. check=checknumbers[id]
  3691. gocheck=gochecknumbers[id]
  3692. if (user_has_scout[id])
  3693. scout=1
  3694. else
  3695. scout=0
  3696. kz_savepos(id, Time, check, gocheck, origin, scout, spvelocity)
  3697. }
  3698. else if(timer_started[id] && is_user_alive(id) && !is_user_bot(id))
  3699. {
  3700. pev(id, pev_origin, origin)
  3701. Time=get_gametime() - timer_time[id]
  3702. if(isFalling[id]) {
  3703. origin = vFallingStart[id];
  3704. Time = vFallingTime[id]
  3705. spvelocity[0] = 0.0
  3706. spvelocity[1] = 0.0
  3707. spvelocity[2] = 0.0
  3708. }
  3709. check=checknumbers[id]
  3710. gocheck=gochecknumbers[id]
  3711. if (user_has_scout[id])
  3712. scout=1
  3713. else
  3714. scout=0
  3715.  
  3716. kz_savepos(id, Time, check, gocheck, origin, scout, spvelocity)
  3717. }
  3718. else
  3719. {
  3720. checknumbers[id] = 0
  3721. gochecknumbers[id] = 0
  3722. user_has_scout[id] = false
  3723. }
  3724. }
  3725.  
  3726.  
  3727.  
  3728. // =================================================================================================
  3729. // Events / Forwards
  3730. // =================================================================================================
  3731.  
  3732. //=================================================================================================
  3733.  
  3734. public client_disconnect(id)
  3735. {
  3736. if (Autosavepos[id] && !is_user_bot(id)) {
  3737. saveposition(id)
  3738. }
  3739. if(task_exists(id))
  3740. remove_task(id)
  3741.  
  3742. if(task_exists(id + TASK_INFO_KREEDZ))
  3743. remove_task(id + TASK_INFO_KREEDZ )
  3744. if(task_exists(id + TASK_GETTOP))
  3745. remove_task(id + TASK_GETTOP )
  3746. if(task_exists(id + TASK_INFO))
  3747. remove_task(id + TASK_INFO )
  3748. if(task_exists(id + SHOW_POS_TASK))
  3749. remove_task(id + SHOW_POS_TASK )
  3750. if(task_exists(id + SHOW_BEACON))
  3751. remove_task(id + SHOW_BEACON )
  3752. if(task_exists(id + SHOW_BEACON1))
  3753. remove_task(id + SHOW_BEACON1)
  3754.  
  3755. gCheckpointStart[id] = false
  3756. antihookcheat[id] = 0.0
  3757. antidiestart[id] = 0.0
  3758. antinoclipstart[id] = 0.0
  3759. antiteleport[id] = 0.0
  3760. chatorhud[id] = -1
  3761. timer_started[id] = false
  3762. firstspawn[id] = false
  3763. NightVisionUse[id] = false
  3764. IsPaused[id] = false
  3765. spec_user[id] = false
  3766. tpfenabled[id] = false
  3767. gc1[id] = false
  3768. remove_hook(id)
  3769. tphook_user[id] = false
  3770. menushow[id] = false
  3771. GoPosed[id] = false
  3772. GoPosCp[id] = false
  3773. GoPosHp[id] = false
  3774. tptostart[id] = false
  3775. isFalling[id] = false
  3776. block_change[id] = false
  3777. isMpbhop[id] = false
  3778. }
  3779.  
  3780. public client_putinserver(id)
  3781. {
  3782. MyPosUpdated[id] = true
  3783. canusehook[id] = true
  3784. checknumbers[id] = 0
  3785. inpausechecknumbers[id] = 0
  3786. gochecknumbers[id] = 0
  3787. antihookcheat[id] = 0.0
  3788. antidiestart[id] = 0.0
  3789. antinoclipstart[id] = 0.0
  3790. antiteleport[id] = 0.0
  3791. chatorhud[id] = -1
  3792. timer_started[id] = false
  3793. firstspawn[id] = true
  3794. NightVisionUse[id] = false
  3795. IsPaused[id] = false
  3796. tpfenabled[id] = false
  3797. gc1[id] = false
  3798. spec_user[id] = false
  3799. user_has_scout[id] = false
  3800. remove_hook(id)
  3801. tphook_user[id] = false
  3802. menushow[id] = false
  3803. GoPosed[id] = false
  3804. GoPosCp[id] = false
  3805. GoPosHp[id] = false
  3806. tptostart[id] = false
  3807.  
  3808. g_bShowBeams[id] = true;
  3809. g_bReturnFloat[id] = true;
  3810. g_bDetailedResults[id] = false;
  3811. g_bAutoSetting[id] = false;
  3812. if( get_pcvar_num(kz_duel) == 1) {
  3813. ////////////==================================Duel==========================///////////////////
  3814. //////========================================End Duel============================================////
  3815. }
  3816. arrayset(g_iHookWallOrigin[id], 0, sizeof(g_iHookWallOrigin[]));
  3817. block_change[id] = false
  3818. isMpbhop[id] = false
  3819. if(!HealsOnMap) {
  3820. set_pev(id, pev_health, 100.0)
  3821. }
  3822. if( is_user_bot(id) )
  3823. {
  3824. MarkPlayerBot(id);
  3825. }
  3826. else
  3827. {
  3828. ClearPlayerBot(id);
  3829. }
  3830. }
  3831.  
  3832. // =========================================================== Measure Tool ============================================
  3833.  
  3834. public cmdMeasure( plr )
  3835. {
  3836. pev( plr, pev_origin, g_vFirstLoc[plr] );
  3837. g_vFirstLoc[plr][2] -= is_user_ducking( plr ) ? 18 : 36;
  3838. g_vSecondLoc[plr] = g_vFirstLoc[plr];
  3839.  
  3840. if( g_bShowBeams[plr] && !task_exists( plr + TASK_BEAM ) )
  3841. {
  3842. set_task( 0.1, "tskBeam", plr + TASK_BEAM, _, _, "ab" );
  3843. }
  3844.  
  3845. menuDisplay( plr );
  3846.  
  3847. //return PLUGIN_HANDLED;
  3848. }
  3849.  
  3850.  
  3851. public cmdChangeColor( plr )
  3852. {
  3853. if( !( get_user_flags( plr ) & ADMIN_KICK ) )
  3854. {
  3855. client_print( plr, print_console, "* You have no access to this command" );
  3856. return PLUGIN_HANDLED;
  3857. }
  3858.  
  3859. if( read_argc( ) != 4 )
  3860. {
  3861. client_print( plr, print_console, "Usage: measure_color <red> <green> <blue>" );
  3862. return PLUGIN_HANDLED;
  3863. }
  3864.  
  3865. new r_str[4], g_str[4], b_str[4];
  3866. read_argv( 1, r_str, 3 );
  3867. read_argv( 2, g_str, 3 );
  3868. read_argv( 3, b_str, 3 );
  3869.  
  3870. g_iColors[0] = clamp( str_to_num( r_str ), 0, 255 );
  3871. g_iColors[1] = clamp( str_to_num( g_str ), 0, 255 );
  3872. g_iColors[2] = clamp( str_to_num( b_str ), 0, 255 );
  3873.  
  3874. client_print( plr, print_console, "measure_color changed to ^"%i %i %i^"", g_iColors[0], g_iColors[1], g_iColors[2] );
  3875.  
  3876. return PLUGIN_HANDLED;
  3877. }
  3878. public menuDisplay( plr )
  3879. {
  3880. static menu[2048];
  3881.  
  3882. new len = format( menu, 2047, "\rMeasure^n^n" );
  3883.  
  3884. if( g_bReturnFloat[plr] )
  3885. {
  3886. len += format( menu[len], 2047 - len, "\r01. \wSet Loc #1 \d< %.03f | %.03f | %.03f >^n", g_vFirstLoc[plr][0], g_vFirstLoc[plr][1], g_vFirstLoc[plr][2] );
  3887. len += format( menu[len], 2047 - len, "\r02. \wSet Loc #2 \d< %.03f | %.03f | %.03f >^n^n", g_vSecondLoc[plr][0], g_vSecondLoc[plr][1], g_vSecondLoc[plr][2] );
  3888. len += format( menu[len], 2047 - len, "\r03. \wAutomatical setting of the other Loc: \d%s^n^n", g_bAutoSetting[plr] ? "on" : "off" );
  3889. len += format( menu[len], 2047 - len, "\r04. \wDetailed results: \d%s^n", g_bDetailedResults[plr] ? "on" : "off" );
  3890. len += format( menu[len], 2047 - len, "\r05. \wReturned values: \ddecimal^n^n" );
  3891. len += format( menu[len], 2047 - len, "\r \wResults:^n" );
  3892.  
  3893. if( g_bDetailedResults[plr] )
  3894. {
  3895. len += format( menu[len], 2047 - len, "\r \wX-Distance: \d%f^n", floatabs( g_vFirstLoc[plr][0] - g_vSecondLoc[plr][0] ) );
  3896. len += format( menu[len], 2047 - len, "\r \wY-Distance: \d%f^n", floatabs( g_vFirstLoc[plr][1] - g_vSecondLoc[plr][1] ) );
  3897. }
  3898.  
  3899. len += format( menu[len], 2047 - len, "\r \wHeight difference: \d%f^n", floatabs( g_vFirstLoc[plr][2] - g_vSecondLoc[plr][2] ) );
  3900. len += format( menu[len], 2047 - len, "\r \wReal distance: \d%f^n^n", get_distance_f( g_vFirstLoc[plr], g_vSecondLoc[plr] ) );
  3901. }
  3902. else
  3903. {
  3904. len += format( menu[len], 2047 - len, "\r01. \wSet Loc #1 \d< %i | %i | %i >^n", floatround( g_vFirstLoc[plr][0], floatround_round ), floatround( g_vFirstLoc[plr][1], floatround_round ), floatround( g_vFirstLoc[plr][2], floatround_round ) );
  3905. len += format( menu[len], 2047 - len, "\r02. \wSet Loc #2 \d< %i | %i | %i >^n^n", floatround( g_vSecondLoc[plr][0], floatround_round ), floatround( g_vSecondLoc[plr][1], floatround_round ), floatround( g_vSecondLoc[plr][2], floatround_round ) );
  3906. len += format( menu[len], 2047 - len, "\r03. \wAutomatical setting of the other Loc: \d%s^n^n", g_bAutoSetting[plr] ? "on" : "off" );
  3907. len += format( menu[len], 2047 - len, "\r04. \wDetailed results: \d%s^n", g_bDetailedResults[plr] ? "on" : "off" );
  3908. len += format( menu[len], 2047 - len, "\r05 \wReturned values: \drounded^n^n" );
  3909. len += format( menu[len], 2047 - len, "\r \wResults:^n" );
  3910.  
  3911. if( g_bDetailedResults[plr] )
  3912. {
  3913. len += format( menu[len], 2047 - len, "\r \wX-Distance: \d%i^n", floatround( floatabs( g_vFirstLoc[plr][0] - g_vSecondLoc[plr][0] ), floatround_round ) );
  3914. len += format( menu[len], 2047 - len, "\r \wY-Distance: \d%i^n", floatround( floatabs( g_vFirstLoc[plr][1] - g_vSecondLoc[plr][1] ), floatround_round ) );
  3915. }
  3916.  
  3917. len += format( menu[len], 2047 - len, "\r \wHeight difference: \d%i^n", floatround( floatabs( g_vFirstLoc[plr][2] - g_vSecondLoc[plr][2] ), floatround_round ) );
  3918. len += format( menu[len], 2047 - len, "\r \wReal distance: \d%i^n^n", floatround( get_distance_f( g_vFirstLoc[plr], g_vSecondLoc[plr] ), floatround_round ) );
  3919.  
  3920. }
  3921.  
  3922. len += format( menu[len], 2047 - len, "\r06. \wShow beams: \d%s^n^n", g_bShowBeams[plr] ? "on" : "off" );
  3923. len += format( menu[len], 2047 - len, "\r00. \wExit" );
  3924.  
  3925. show_menu( plr, ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 ), menu, -1 );
  3926. menushow[plr] = true
  3927. hidetime(plr)
  3928. }
  3929.  
  3930. public menuAction( plr, key )
  3931. {
  3932. switch( key )
  3933. {
  3934. case 0:
  3935. {
  3936. fm_get_aim_origin( plr, g_vFirstLoc[plr] );
  3937.  
  3938. if( g_bAutoSetting[plr] )
  3939. {
  3940. get_tr2( 0, TR_vecPlaneNormal, g_vSecondLoc[plr] );
  3941.  
  3942. xs_vec_mul_scalar( g_vSecondLoc[plr], 9999.0, g_vSecondLoc[plr] );
  3943. xs_vec_add( g_vFirstLoc[plr], g_vSecondLoc[plr], g_vSecondLoc[plr] );
  3944.  
  3945. fm_trace_line( plr, g_vFirstLoc[plr], g_vSecondLoc[plr], g_vSecondLoc[plr] );
  3946. }
  3947.  
  3948. menuDisplay( plr );
  3949. }
  3950. case 1:
  3951. {
  3952. fm_get_aim_origin( plr, g_vSecondLoc[plr] );
  3953.  
  3954. if( g_bAutoSetting[plr] )
  3955. {
  3956. get_tr2( 0, TR_vecPlaneNormal, g_vFirstLoc[plr] );
  3957.  
  3958. xs_vec_mul_scalar( g_vFirstLoc[plr], 9999.0, g_vFirstLoc[plr] );
  3959. xs_vec_add( g_vFirstLoc[plr], g_vSecondLoc[plr], g_vFirstLoc[plr] );
  3960.  
  3961. fm_trace_line( plr, g_vSecondLoc[plr], g_vFirstLoc[plr], g_vFirstLoc[plr] );
  3962. }
  3963.  
  3964. menuDisplay( plr );
  3965. }
  3966. case 2:
  3967. {
  3968. g_bAutoSetting[plr] = !g_bAutoSetting[plr];
  3969. menuDisplay( plr );
  3970. }
  3971. case 3:
  3972. {
  3973. g_bDetailedResults[plr] = !g_bDetailedResults[plr];
  3974. menuDisplay( plr );
  3975. }
  3976. case 4:
  3977. {
  3978. g_bReturnFloat[plr] = !g_bReturnFloat[plr];
  3979. menuDisplay( plr );
  3980. }
  3981. case 5:
  3982. {
  3983. g_bShowBeams[plr] = !g_bShowBeams[plr];
  3984.  
  3985. if( !g_bShowBeams[plr] && task_exists( plr + TASK_BEAM ) )
  3986. {
  3987. remove_task( plr + TASK_BEAM );
  3988. }
  3989. else
  3990. {
  3991. set_task( 0.1, "tskBeam", plr + TASK_BEAM, _, _, "ab" );
  3992. }
  3993.  
  3994. menuDisplay( plr );
  3995. }
  3996. case 9:
  3997. {
  3998. remove_task( plr + TASK_BEAM );
  3999. show_menu( plr, 0, "" );
  4000. menushow[plr] = false
  4001. set_task(0.3, "showtimeduel", plr)
  4002. }
  4003. }
  4004. }
  4005.  
  4006. public tskBeam( plr )
  4007. {
  4008. plr -= TASK_BEAM;
  4009.  
  4010. draw_beam( plr, g_vFirstLoc[plr], g_vSecondLoc[plr], g_iColors[0], g_iColors[1], g_iColors[2] );
  4011.  
  4012. if( floatabs( g_vFirstLoc[plr][2] - g_vSecondLoc[plr][2] ) >= 2 )
  4013. {
  4014. static Float:temp[3];
  4015. temp[0] = g_vSecondLoc[plr][0];
  4016. temp[1] = g_vSecondLoc[plr][1];
  4017. temp[2] = g_vFirstLoc[plr][2];
  4018.  
  4019. draw_beam( plr, g_vFirstLoc[plr], temp, g_iColors[0], g_iColors[1], g_iColors[2] );
  4020. draw_beam( plr, temp, g_vSecondLoc[plr], g_iColors[0], g_iColors[1], g_iColors[2] );
  4021. }
  4022. }
  4023.  
  4024. public draw_beam( plr, Float:aorigin[3], Float:borigin[3], r, g, b )
  4025. {
  4026.  
  4027. message_begin( MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, { 0.0, 0.0, 0.0 }, plr );
  4028. write_byte( TE_BEAMPOINTS );
  4029. engfunc( EngFunc_WriteCoord, aorigin[0] );
  4030. engfunc( EngFunc_WriteCoord, aorigin[1] );
  4031. engfunc( EngFunc_WriteCoord, aorigin[2] );
  4032. engfunc( EngFunc_WriteCoord, borigin[0] );
  4033. engfunc( EngFunc_WriteCoord, borigin[1] );
  4034. engfunc( EngFunc_WriteCoord, borigin[2] );
  4035. write_short( g_flBeam );
  4036. write_byte( 0 );
  4037. write_byte( 0 );
  4038. write_byte( 2 );
  4039. write_byte( 20 );
  4040. write_byte( 0 );
  4041. write_byte( r );
  4042. write_byte( g );
  4043. write_byte( b );
  4044. write_byte( 150 );
  4045. write_byte( 0 );
  4046. message_end( );
  4047. }
  4048.  
  4049.  
  4050.  
  4051. is_user_ducking( plr )
  4052. {
  4053. if( !pev_valid( plr ) )
  4054. {
  4055. return 0;
  4056. }
  4057.  
  4058. new Float:abs_min[3], Float:abs_max[3];
  4059. pev( plr, pev_absmin, abs_min );
  4060. pev( plr, pev_absmax, abs_max );
  4061.  
  4062. abs_min[2] += 64.0;
  4063.  
  4064. if( abs_min[2] < abs_max[2] )
  4065. {
  4066. return 0;
  4067. }
  4068.  
  4069. return 1;
  4070. }
  4071.  
  4072. fm_get_aim_origin( plr, Float:origin[3] )
  4073. {
  4074. new Float:start[3], Float:view_ofs[3];
  4075. pev( plr, pev_origin, start );
  4076. pev( plr, pev_view_ofs, view_ofs );
  4077. xs_vec_add( start, view_ofs, start );
  4078.  
  4079. new Float:dest[3];
  4080. pev( plr, pev_v_angle, dest );
  4081. engfunc( EngFunc_MakeVectors, dest);
  4082. global_get( glb_v_forward, dest );
  4083. xs_vec_mul_scalar( dest, 9999.0, dest );
  4084. xs_vec_add( start, dest, dest );
  4085.  
  4086. engfunc( EngFunc_TraceLine, start, dest, 0, plr, 0 );
  4087. get_tr2( 0, TR_vecEndPos, origin );
  4088.  
  4089. return 1;
  4090. }
  4091.  
  4092. fm_trace_line( ignoreent, const Float:start[3], const Float:end[3], Float:ret[3] )
  4093. {
  4094. engfunc( EngFunc_TraceLine, start, end, ignoreent == -1 ? 1 : 0, ignoreent, 0 );
  4095.  
  4096. new ent = get_tr2( 0, TR_pHit );
  4097. get_tr2( 0, TR_vecEndPos, ret );
  4098.  
  4099. return pev_valid( ent ) ? ent : 0;
  4100. }
  4101.  
  4102.  
  4103. // ============================================= End of Measure Tool ==============================================///
  4104.  
  4105.  
  4106. #if defined USE_SQL
  4107. public kz_update_plrname(id)
  4108. {
  4109. new createinto[1001], authid[32], name[32]
  4110. get_user_authid(id, authid, 31)
  4111. get_user_name(id, name, 31)
  4112. replace_all(name, 31, "\", "")
  4113. replace_all(name, 31, "`", "")
  4114. replace_all(name, 31, "'", "")
  4115. replace_all(name, 31, ";", "")
  4116. replace_all(name, 31, "#", "")
  4117.  
  4118. if(equal(authid, "VALVE_ID_LAN") || equal(authid, "STEAM_ID_LAN") || equal(authid, "unknown") || equal(authid, "HLTV") || equal(authid, "VALVE_ID_PENDING") || equal(authid, "STEAM_ID_PENDING") )
  4119. return PLUGIN_HANDLED;
  4120. if(is_user_connected(id) && !is_user_bot(id))
  4121. {
  4122. formatex(createinto, 1000, "UPDATE `kz_pro15` SET name='%s' WHERE authid='%s'", name, authid)
  4123. SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
  4124. formatex(createinto, 1000, "UPDATE `kz_nub15` SET name='%s' WHERE authid='%s'", name, authid)
  4125. SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
  4126. formatex(createinto, 1000, "UPDATE `uq_players` SET name='%s' WHERE authid='%s'", name, authid)
  4127. SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
  4128.  
  4129. }
  4130. return PLUGIN_HANDLED;
  4131. }
  4132.  
  4133.  
  4134.  
  4135. #endif
  4136.  
  4137. public Teleport(id)
  4138. {
  4139. if ( get_playersnum() > 1 && is_user_alive(id) || DefaultStop) {
  4140. static menuid, player, name[32], buffer[1]
  4141. menuid = menu_create("Teleport Menu", "TeleportHandle")
  4142. if(DefaultStop) {
  4143. menu_additem( menuid, "Finish Position", "1" )
  4144. }
  4145. for (player = 1; player <= g_maxplayers; player++)
  4146. {
  4147. if (!is_user_alive(player) || player == id)
  4148. continue;
  4149.  
  4150. get_user_name(player, name, charsmax(name))
  4151. if(DefaultStop) {
  4152. buffer[0] = player + 1
  4153. }
  4154. else {
  4155. buffer[0] = player
  4156. }
  4157. menu_additem(menuid, name, buffer)
  4158. }
  4159.  
  4160. menu_display(id, menuid)
  4161. menushow[id] = true
  4162. hidetime(id)
  4163. } else {
  4164. kz_menu(id)
  4165. return PLUGIN_HANDLED;
  4166. }
  4167. return PLUGIN_HANDLED;
  4168. }
  4169.  
  4170.  
  4171. public TeleportHandle(id, menuid, item)
  4172. {
  4173. if (item == MENU_EXIT)
  4174. {
  4175. kz_menu(id)
  4176. return PLUGIN_HANDLED;
  4177. }
  4178. static buffer[1], dummy, player
  4179. menu_item_getinfo(menuid, item, dummy, buffer, sizeof(buffer), _, _, dummy)
  4180. if(DefaultStop) {
  4181. player = buffer[0] - 1
  4182. } else {
  4183. player = buffer[0]
  4184. }
  4185. new szPlayerName[32], szName[32]
  4186. get_user_name(id, szName, 32)
  4187. get_user_name(player, szPlayerName, 32)
  4188.  
  4189. new entclassname[33];
  4190. pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
  4191. if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !IsPaused[id])
  4192. {
  4193. ColorChat(id, GREEN, "[KZ.M]^x01 Cannot teleport now")
  4194. Teleport(id)
  4195. return PLUGIN_HANDLED
  4196. }
  4197. if (timer_started[id] && !IsPaused[id]) {
  4198. Pause(id)
  4199. }
  4200. if (item == 0 && DefaultStop)
  4201. {
  4202. set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
  4203. set_pev(id, pev_origin, DefaultStopPos)
  4204. delay_duck(id)
  4205. Teleport(id)
  4206. return PLUGIN_HANDLED;
  4207. }
  4208. if (!is_user_alive(player) || player == id)
  4209. {
  4210. menu_destroy(menuid)
  4211. menushow[id] = false
  4212. set_task(0.3, "showtimeduel", id)
  4213.  
  4214. return PLUGIN_HANDLED;
  4215. }
  4216. if ( get_gametime() - antiteleport[id] < 5.0 )
  4217. {
  4218. ColorChat(id, GREEN, "[KZ.M]^x01 Wait 5 seconds!")
  4219. Teleport(id)
  4220. return PLUGIN_HANDLED;
  4221. }
  4222. static Float:pos[3]
  4223. entity_get_vector(player, EV_VEC_origin, pos)
  4224. entity_set_origin(id, pos)
  4225. delay_duck( id )
  4226. Teleport(id)
  4227.  
  4228. antiteleport[id] = get_gametime()
  4229. return PLUGIN_HANDLED;
  4230. }
  4231.  
  4232. public delay_duck(id){
  4233. new ida[1]
  4234. ida[0]=id
  4235. set_task(0.01,"force_duck",_,ida,1)
  4236. set_entity_flags(ida[0],FL_DUCKING,1)
  4237. }
  4238.  
  4239. public force_duck(ida[1]){
  4240. set_entity_flags(ida[0],FL_DUCKING,1)
  4241. }
  4242.  
  4243.  
  4244.  
  4245.  
  4246.  
  4247.  
  4248.  
  4249. // =================================================================================================
  4250. // Menu
  4251. // =================================================================================================
  4252.  
  4253.  
  4254. public kz_menu(id)
  4255. {
  4256. new title[128];
  4257. new ctime[64]
  4258. get_time("%m.%d.%Y - %H:%M:%S", ctime, 63)
  4259. new a = get_timeleft()
  4260.  
  4261.  
  4262. formatex(title, 127, "\d \r ^n^n\dServer Time: %s^nMap: \y%s \dTimeleft: \y%d:%02d", ctime, MapName, (a / 60), (a % 60))
  4263. new menu = menu_create(title, "MenuHandler")
  4264.  
  4265. new msgcheck[64], msggocheck[64], msgpause[64]
  4266. formatex(msgcheck, 63, "Checkpoint - \y#%i", checknumbers[id])
  4267. formatex(msggocheck, 63, "Gocheck - \y#%i", gochecknumbers[id])
  4268. formatex(msgpause, 63, "Pause - %s^n", IsPaused[id] ? "\yOn" : "\rOff" )
  4269.  
  4270.  
  4271. menu_additem( menu, msgcheck, "1" )
  4272. menu_additem( menu, msggocheck, "2" )
  4273. menu_additem( menu, "Teleport^n", "3" )
  4274. menu_additem( menu, "Save Start", "4")
  4275. menu_additem( menu, "Start", "5")
  4276. menu_additem( menu, msgpause, "6" )
  4277. menu_additem( menu, "Duel Menu", "7" ) // --- Duel menu
  4278. menu_additem( menu, "Spectator/CT", "8" )
  4279. menu_additem( menu, "More^n", "9") // --- More + Invis + Timer
  4280. menu_additem( menu, "Exit", "0" )
  4281.  
  4282. menu_setprop(menu, MPROP_PERPAGE, 0)
  4283. menu_display(id, menu, 0)
  4284. menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
  4285. menushow[id] = true
  4286. hidetime(id)
  4287. return PLUGIN_HANDLED
  4288. }
  4289.  
  4290. public MenuHandler(id , menu, item)
  4291. {
  4292. if( item == MENU_EXIT ) {
  4293. menu_destroy(menu)
  4294. return PLUGIN_HANDLED
  4295. }
  4296.  
  4297.  
  4298. switch(item) {
  4299. case 0:{
  4300. CheckPoint(id)
  4301. kz_menu(id)
  4302. }
  4303. case 1:{
  4304. GoCheck(id)
  4305. kz_menu(id)
  4306. }
  4307. case 2:{
  4308. new Playersnum[32], playerscount
  4309. get_players(Playersnum, playerscount, "ah")
  4310. if(playerscount > 1 || DefaultStop){
  4311. Teleport(id)
  4312. } else {
  4313. kz_menu(id)
  4314. }
  4315.  
  4316. }
  4317. case 3:{
  4318. CheckPointStart(id)
  4319. kz_menu(id)
  4320. }
  4321. case 4:{
  4322. goStart1(id)
  4323. kz_menu(id)
  4324. }
  4325. case 5:{
  4326. Pause(id)
  4327. kz_menu(id)
  4328. }
  4329. case 6:{
  4330. DuelMenu(id)
  4331. }
  4332. case 7:{
  4333. ct(id)
  4334. kz_menu(id)
  4335. }
  4336. case 8:{
  4337. MoreMenu(id)
  4338. }
  4339. case 9:{
  4340. menushow[id] = false
  4341. set_task(0.3, "showtimeduel", id)
  4342. }
  4343. }
  4344.  
  4345. return PLUGIN_HANDLED
  4346. }
  4347.  
  4348.  
  4349.  
  4350. public DuelMenu(id)
  4351. {
  4352. new menu = menu_create("\yDuel Menu\w", "DuelMenuHandler")
  4353.  
  4354.  
  4355. menu_additem( menu, "Duel", "1" )
  4356. menu_additem( menu, "Show Duels", "2" )
  4357. menu_additem( menu, "Duel Top^n", "3" )
  4358. menu_additem( menu, "Back", "4" )
  4359.  
  4360. menu_display(id, menu, 0)
  4361. menushow[id] = true
  4362. hidetime(id)
  4363. return PLUGIN_HANDLED
  4364. }
  4365.  
  4366. public DuelMenuHandler (id, menu, item)
  4367. {
  4368. if( item == MENU_EXIT )
  4369. {
  4370. menu_destroy(menu)
  4371. menushow[id] = false
  4372. set_task(0.3, "showtimeduel", id)
  4373.  
  4374. return PLUGIN_HANDLED
  4375. }
  4376. if(get_pcvar_num(kz_duel) == 0){
  4377. return PLUGIN_HANDLED;
  4378. }
  4379. switch(item)
  4380. {
  4381. case 0:
  4382. {
  4383. if(callfunc_begin("duel_start","duel.amxx") == 1)
  4384. {
  4385. callfunc_push_int(id)
  4386. callfunc_end()
  4387. }
  4388. }
  4389. case 1:
  4390. {
  4391. if(callfunc_begin("show_duels","duel.amxx") == 1)
  4392. {
  4393. callfunc_push_int(id)
  4394. callfunc_end()
  4395. }
  4396. DuelMenu(id)
  4397. }
  4398. case 2:
  4399. {
  4400. if(callfunc_begin("show_top","duel.amxx") == 1)
  4401. {
  4402. callfunc_push_int(id)
  4403. callfunc_end()
  4404. }
  4405. DuelMenu(id)
  4406. }
  4407. case 3:
  4408. {
  4409. kz_menu(id)
  4410. }
  4411. }
  4412. return PLUGIN_HANDLED
  4413. }
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422. public GocheckMode(id)
  4423. {
  4424. if(!tpfenabled[id])
  4425. {
  4426. tpfenabled[id] = true
  4427. kz_chat(id, "Checkpoint Angle Fix Enabled")
  4428. }
  4429. else
  4430. {
  4431. tpfenabled[id] = false
  4432. kz_chat(id, "Checkpoint Angle Fix Disabled")
  4433. }
  4434. return PLUGIN_HANDLED
  4435. }
  4436.  
  4437.  
  4438.  
  4439.  
  4440. public MoreMenu(id)
  4441. {
  4442. new menu = menu_create("\yMore Options\w", "MoreMenuHandler")
  4443. new msgtpf[64]
  4444. formatex(msgtpf, 63, "Chekpoint Mode - %s^n", tpfenabled[id] ? "\yOn" : "\rOff" )
  4445.  
  4446. menu_additem( menu, "Top 15", "1" )
  4447. menu_additem( menu, "Invisible Menu", "2" )
  4448. menu_additem( menu, msgtpf, "3" )
  4449. menu_additem( menu, "Measure Tool", "4" )
  4450. menu_additem( menu, "Back", "4" )
  4451.  
  4452. menu_display(id, menu, 0)
  4453. menushow[id] = true
  4454. hidetime(id)
  4455. return PLUGIN_HANDLED
  4456. }
  4457.  
  4458. public MoreMenuHandler (id, menu, item)
  4459. {
  4460. if( item == MENU_EXIT )
  4461. {
  4462. menu_destroy(menu)
  4463. menushow[id] = false
  4464. set_task(0.3, "showtimeduel", id)
  4465.  
  4466. return PLUGIN_HANDLED
  4467. }
  4468. switch(item)
  4469. {
  4470. case 0:
  4471. {
  4472. top15menu(id)
  4473. }
  4474. case 1:
  4475. {
  4476. InvisMenu(id)
  4477. }
  4478. case 2:
  4479. {
  4480. GocheckMode(id)
  4481. MoreMenu(id)
  4482. }
  4483.  
  4484. case 3:
  4485. {
  4486. cmdMeasure(id)
  4487. }
  4488. case 4:
  4489. {
  4490. kz_menu(id)
  4491. }
  4492. }
  4493. return PLUGIN_HANDLED
  4494. }
  4495.  
  4496.  
  4497.  
  4498.  
  4499. public InvisMenu(id)
  4500. {
  4501. new menu = menu_create("\yInvis Menu\w", "InvisMenuHandler")
  4502. new msginvis[64], msgwaterinvis[64]
  4503.  
  4504. formatex(msginvis, 63, "Players - %s", gViewInvisible[id] ? "\yOn" : "\rOff" )
  4505. formatex(msgwaterinvis, 63, "Water - %s^n^n", gWaterInvisible[id] ? "\yOn" : "\rOff" )
  4506.  
  4507. menu_additem( menu, msginvis, "1" )
  4508. menu_additem( menu, msgwaterinvis, "2" )
  4509. menu_additem( menu, "Back", "3" )
  4510.  
  4511. menu_display(id, menu, 0)
  4512. menushow[id] = true
  4513. hidetime(id)
  4514. return PLUGIN_HANDLED
  4515. }
  4516.  
  4517. public InvisMenuHandler (id, menu, item)
  4518. {
  4519. if( item == MENU_EXIT )
  4520. {
  4521. menu_destroy(menu)
  4522. menushow[id] = false
  4523. set_task(0.3, "showtimeduel", id)
  4524.  
  4525. return PLUGIN_HANDLED
  4526. }
  4527.  
  4528. switch(item)
  4529. {
  4530. case 0:
  4531. {
  4532. cmdInvisible(id)
  4533. InvisMenu(id)
  4534. }
  4535. case 1:
  4536. {
  4537. cmdWaterInvisible(id)
  4538. InvisMenu(id)
  4539. }
  4540. case 2:
  4541. {
  4542. MoreMenu(id)
  4543. }
  4544. }
  4545. return PLUGIN_HANDLED
  4546. }
  4547.  
  4548. public top15menu(id)
  4549. {
  4550. new menu = menu_create("\rProKreedz \yTop15 \w", "top15handler")
  4551. menu_additem(menu, "\wPro 15", "1", 0)
  4552. menu_additem(menu, "\wNoob 15^n^n", "2", 0)
  4553. #if defined USE_SQL
  4554. menu_additem(menu, "My Results","3")
  4555. menu_additem(menu, "Players Rank^n","4")
  4556. menu_additem(menu, "Last 10 Pro", "5")
  4557. menu_additem(menu, "Maps","6")
  4558. menu_additem(menu, "Back", "7")
  4559. #else
  4560. menu_additem(menu, "\wBack", "3", 0)
  4561. #endif
  4562.  
  4563. menu_display(id, menu, 0);
  4564. menushow[id] = true
  4565. hidetime(id)
  4566. return PLUGIN_HANDLED;
  4567. }
  4568.  
  4569. public top15handler(id, menu, item)
  4570. {
  4571. if(item == MENU_EXIT)
  4572. {
  4573. menu_destroy(menu)
  4574. menushow[id] = false
  4575. set_task(0.3, "showtimeduel", id)
  4576.  
  4577. return PLUGIN_HANDLED
  4578. }
  4579. #if defined USE_SQL
  4580. switch(item)
  4581. {
  4582. case 0:
  4583. {
  4584. ProTop_show(id)
  4585. top15menu(id)
  4586. }
  4587. case 1:
  4588. {
  4589. NoobTop_show(id)
  4590. top15menu(id)
  4591. }
  4592. case 2:
  4593. {
  4594. kz_showhtml_motd(id, PRO_RECORDS, "")
  4595. top15menu(id)
  4596. }
  4597. case 3:
  4598. {
  4599. kz_showhtml_motd(id, PLAYERS_RANKING, "")
  4600. top15menu(id)
  4601. }
  4602. case 4:
  4603. {
  4604. kz_showhtml_motd(id, LAST_PRO10, "")
  4605. top15menu(id)
  4606. }
  4607. case 5:
  4608. {
  4609. kz_showhtml_motd(id, MAPS_STATISTIC, "")
  4610. top15menu(id)
  4611. }
  4612. case 6:
  4613. {
  4614. MoreMenu(id)
  4615. }
  4616. }
  4617. #else
  4618. switch(item)
  4619. {
  4620. case 0:
  4621. {
  4622. ProTop_show(id)
  4623. }
  4624. case 1:
  4625. {
  4626. NoobTop_show(id)
  4627. }
  4628. case 2:
  4629. {
  4630. kz_menu(id)
  4631. }
  4632. }
  4633. #endif
  4634.  
  4635. return PLUGIN_HANDLED;
  4636. }
  4637.  
  4638. // =================================================================================================
  4639.  
  4640. //
  4641. // Timersystem
  4642. // =================================================================================================
  4643. public fwdUse(ent, id)
  4644. {
  4645. if( is_user_bot(id) )
  4646. {
  4647. return HAM_IGNORED;
  4648. }
  4649.  
  4650. if( !ent || id > 32 )
  4651. {
  4652. return HAM_IGNORED;
  4653. }
  4654.  
  4655. if( !is_user_alive(id) )
  4656. {
  4657. return HAM_IGNORED;
  4658. }
  4659.  
  4660.  
  4661. new name[32]
  4662. get_user_name(id, name, 31)
  4663.  
  4664. new szTarget[ 32 ];
  4665. pev(ent, pev_target, szTarget, 31);
  4666.  
  4667. if( TrieKeyExists( g_tStarts, szTarget ) )
  4668. {
  4669. if((!get_user_noclip(id) && get_gametime() - antinoclipstart[id] < 3.0) || get_user_noclip(id)) {
  4670. kz_hud_message( id, "Wait 3 seconds after using noclip." );
  4671. return PLUGIN_HANDLED
  4672. }
  4673. if ( get_gametime() - antihookcheat[id] < 3.0 || ishooked[id])
  4674. {
  4675. kz_hud_message( id, "%L", id, "KZ_HOOK_PROTECTION" );
  4676. return PLUGIN_HANDLED
  4677. }
  4678.  
  4679. if ( reset_checkpoints(id) && !timer_started[id] )
  4680. {
  4681. start_climb(id)
  4682. if( get_user_health(id) < 100 )
  4683. set_user_health(id, 100)
  4684.  
  4685. pev(id, pev_origin, SavedStart[id])
  4686. AutoStart[id] = true;
  4687.  
  4688. if( !DefaultStart )
  4689. {
  4690. kz_set_start(MapName, SavedStart[id])
  4691. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SET_START")
  4692. }
  4693.  
  4694. remove_hook(id)
  4695. }
  4696.  
  4697. }
  4698.  
  4699. if( TrieKeyExists( g_tStops, szTarget ) )
  4700. {
  4701. if (tphook_user[id])
  4702. return PLUGIN_HANDLED
  4703. if( timer_started[id] )
  4704. {
  4705. if(get_user_noclip(id))
  4706. return PLUGIN_HANDLED
  4707. pev(id, pev_origin, SavedStop[id])
  4708. if( !DefaultStop )
  4709. {
  4710. kz_set_stop(MapName, SavedStop[id])
  4711. }
  4712. finish_climb(id)
  4713. }
  4714. else
  4715. kz_hud_message(id, "%L", id, "KZ_TIMER_NOT_STARTED")
  4716.  
  4717. }
  4718. return HAM_IGNORED
  4719. }
  4720.  
  4721. public start_climb(id)
  4722. {
  4723. reset_checkpoints(id)
  4724. client_print(id, print_center, "Timer Started")
  4725.  
  4726. new wpn
  4727. wpn = get_user_weapon(id)
  4728. if (wpn != CSW_KNIFE || wpn != CSW_USP) {
  4729. strip_user_weapons(id)
  4730. }
  4731. if( !user_has_weapon(id, CSW_USP) ){
  4732. give_item(id,"weapon_usp")
  4733. cs_set_user_bpammo(id, CSW_USP, 36)
  4734. }
  4735. if( !user_has_weapon(id, CSW_KNIFE) ){
  4736. give_item(id,"weapon_knife")
  4737. }
  4738. if( wpn == CSW_KNIFE ){
  4739. strip_user_weapons(id)
  4740. cmdUsp(id)
  4741. engclient_cmd(id,"weapon_knife")
  4742. }
  4743. if( wpn == CSW_SCOUT )
  4744. {
  4745. if( !user_has_weapon(id, CSW_SCOUT) ){
  4746. give_item(id,"weapon_scout")
  4747. cs_set_user_bpammo(id, CSW_SCOUT, 20)
  4748. }
  4749. user_has_scout[id]=true
  4750. }
  4751. set_pev(id, pev_gravity, 1.0);
  4752. set_pev(id, pev_movetype, MOVETYPE_WALK)
  4753. IsPaused[id] = false
  4754. timer_started[id] = true
  4755. timer_time[id] = get_gametime()
  4756. tphook_user[id] = false
  4757. WasPlayed[id] = false
  4758. if(user_has_scout[id]) {
  4759. client_cmd(id, "spk fvox/blip");
  4760. WasPlayed[id] = true
  4761. }
  4762. if(!menushow[id] && !user_has_scout[id]) {
  4763. showtime1(id)
  4764. }
  4765. else if (!menushow[id] && user_has_scout[id]) {
  4766. showtime2(id)
  4767. }
  4768. else {
  4769. kz_menu(id)
  4770. }
  4771. GoPosed[id] = false
  4772. GoPosCp[id] = false
  4773. GoPosHp[id] = false
  4774. tptostart[id] = false
  4775. }
  4776.  
  4777.  
  4778. public finish_climb(id)
  4779. {
  4780. if(!sqlconnected) {
  4781. plugin_sql()
  4782. sqlconnected = true
  4783. }
  4784.  
  4785. if (!is_user_alive (id))
  4786. {
  4787. return;
  4788. }
  4789.  
  4790. if ( (get_pcvar_num(kz_top15_authid) > 1) || (get_pcvar_num(kz_top15_authid) < 0) )
  4791. {
  4792. ColorChat(id, GREEN, "%s^x01 %L.", prefix, id, "KZ_TOP15_DISABLED")
  4793. return;
  4794. }
  4795. #if defined USE_SQL
  4796. FinishMsg = true
  4797. MyPosUpdated[id] = true
  4798. set_task(0.5, "GetTop", id + TASK_GETTOP)
  4799. new Float: time, wpn
  4800. time = get_gametime() - timer_time[id]
  4801.  
  4802. if (get_pcvar_num(kz_wr_diff) == 1 && gochecknumbers[id] == 0) {
  4803. WrDiffShow(id)
  4804. }
  4805. else {
  4806. show_finish_message(id, time)
  4807. }
  4808. new checkpoints=checknumbers[id]
  4809. new gocheck=gochecknumbers[id]
  4810. if(user_has_scout[id])
  4811. wpn=CSW_SCOUT
  4812. else
  4813. wpn=get_user_weapon( id )
  4814.  
  4815. new steam[32], name[32]
  4816. get_user_name(id, name, 31)
  4817. get_user_authid(id, steam, 31 )
  4818. new createinto[1001]
  4819.  
  4820. new cData[192]
  4821. cData[0] = id
  4822. formatex(cData[2], charsmax(cData)-2, "^"%f^" ^"%d^" ^"%d^" ^"%d^"", time, wpn, checkpoints ,gocheck)
  4823.  
  4824. if (gochecknumbers[id] == 0 && !user_has_scout[id] )
  4825. {
  4826. cData[1] = PRO_TOP
  4827. formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_pro15` WHERE mapname='%s' AND authid='%s'", MapName, steam)
  4828. SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
  4829. }
  4830. if ( gochecknumbers[id] > 0 || user_has_scout[id] )
  4831. {
  4832. cData[1] = NUB_TOP
  4833. formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_nub15` WHERE mapname='%s' AND authid='%s'", MapName, steam)
  4834. SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
  4835. }
  4836.  
  4837. #else
  4838. new Float: time, authid[32]
  4839. time = get_gametime() - timer_time[id]
  4840. get_user_authid(id, authid, 31)
  4841. if (get_pcvar_num(kz_wr_diff) == 1 && gochecknumbers[id] == 0) {
  4842. WrDiffShow(id)
  4843. }
  4844. else {
  4845. show_finish_message(id, time)
  4846. }
  4847. if (gochecknumbers[id] == 0 && !user_has_scout[id] )
  4848. ProTop_update(id, time)
  4849. ( gochecknumbers[id] > 0 || user_has_scout[id] )
  4850. NoobTop_update(id, time, checknumbers[id], gochecknumbers[id])
  4851. #endif
  4852. reset_checkpoints(id)
  4853. }
  4854.  
  4855. public show_finish_message(id, Float:kreedztime)
  4856. {
  4857. new name[32]
  4858. new imin,isec,ims, wpn
  4859. if(user_has_scout[id])
  4860. wpn=CSW_SCOUT
  4861. else
  4862. wpn=get_user_weapon( id )
  4863. get_user_name(id, name, 31)
  4864. imin = floatround(kreedztime / 60.0, floatround_floor)
  4865. isec = floatround(kreedztime - imin * 60.0,floatround_floor)
  4866. ims = floatround( ( kreedztime - ( imin * 60.0 + isec ) ) * 100.0, floatround_round )
  4867. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x04 %02i:%02i.%02i ^x03(^x01 CPs: ^x04%d^x03 | ^x01 TPs: ^x04%d^x03 | ^x01 %L: ^x04%s^x03) ^x01 !", prefix, name, LANG_PLAYER, "KZ_FINISH_MSG", imin, isec, ims, checknumbers[id], gochecknumbers[id], LANG_PLAYER, "KZ_WEAPON", g_weaponsnames[wpn])
  4868. }
  4869.  
  4870.  
  4871.  
  4872. public WrDiffShow(id) {
  4873.  
  4874. new Float:zClimbTime = get_gametime() - timer_time[id];
  4875. new name[32]
  4876. get_user_name(id, name, 31)
  4877.  
  4878. new imin,isec,ims
  4879.  
  4880. imin = floatround(zClimbTime / 60.0, floatround_floor)
  4881. isec = floatround(zClimbTime - imin * 60.0,floatround_floor)
  4882. ims = floatround( ( zClimbTime - ( imin * 60.0 + isec ) ) * 100.0, floatround_round )
  4883.  
  4884. if (g_iWorldRecordsNum > 0) {
  4885. if (zClimbTime < DiffWRTime[0]) {
  4886.  
  4887. new Float:sDiffTime = DiffWRTime[0] - zClimbTime;
  4888. new szDiffTime[16]
  4889. WRTimer(sDiffTime, szDiffTime, sizeof(szDiffTime) - 1, true, false)
  4890. ColorChat(0, RED, "%s^x04 %s^x01 finished in ^x04%02i:%02i.%02i ^x01(^x03WR -%s)", prefix, name, imin, isec, ims, szDiffTime);
  4891.  
  4892. }
  4893. else {
  4894. new Float:sDiffTime = zClimbTime - DiffWRTime[0];
  4895. new szDiffTime[16]
  4896. WRTimer(sDiffTime, szDiffTime, sizeof(szDiffTime) - 1, true, false)
  4897. ColorChat(0, GREEN, "%s^x04 %s^x01 finished in ^x04%02i:%02i.%02i ^x01(^x03WR +%s)", prefix, name, imin, isec, ims, szDiffTime);
  4898. }
  4899. }
  4900. else if (!g_iWorldRecordsNum){
  4901. show_finish_message(id, zClimbTime);
  4902. }
  4903. return PLUGIN_CONTINUE;
  4904. }
  4905.  
  4906.  
  4907.  
  4908.  
  4909. //==========================================================
  4910. #if defined USE_SQL
  4911. public Set_QueryHandler(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
  4912. {
  4913. new id = cData[0]
  4914. new style = cData[1]
  4915.  
  4916. if( iFailState != TQUERY_SUCCESS )
  4917. {
  4918. log_amx("[KZ.M] TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
  4919. ColorChat(0, GREEN, "%s^x01 %F", prefix, LANG_PLAYER, "KZ_TOP15_SQL_ERROR")
  4920. }
  4921. new createinto[1001]
  4922. new x1[16], x2[4], x3[5], x4[5]
  4923. parse(cData[2], x1, 15, x2, 3, x3, 4, x4, 4)
  4924.  
  4925. new dia[64], steam[32], name[32], ip[15], country[3], checkpoints[32], gochecks[32]
  4926. new Float:newtime = str_to_float(x1)
  4927. new iMin, iSec, iMs, server[64]
  4928. get_pcvar_string(kz_sql_name, server, 63)
  4929. get_time("%Y%m%d%H%M%S", dia, sizeof dia - 1)
  4930. get_user_authid(id, steam, 31)
  4931. get_user_name(id, name, sizeof name - 1)
  4932. get_user_ip (id, ip, sizeof ip - 1, 1)
  4933. geoip_code2_ex( ip, country)
  4934. replace_all(name, 31, "\", "")
  4935. replace_all(name, 31, "`", "")
  4936. replace_all(name, 31, "'", "")
  4937. replace_all(name, 31, ";", "")
  4938. replace_all(name, 31, "#", "")
  4939.  
  4940. if( SQL_NumResults(hQuery) == 0 )
  4941. {
  4942. formatex(checkpoints, 31, ", '%d'", str_to_num(x3))
  4943. formatex(gochecks, 31, ", '%d'", str_to_num(x4))
  4944. formatex( createinto, sizeof createinto - 1, "INSERT INTO `%s` (mapname,authid,country,name,time,date,weapon,server %s) VALUES('%s', '%s','%s','%s','%f','%s','%s','%s'%s%s)", style == PRO_TOP ? "kz_pro15" : "kz_nub15",style == PRO_TOP ? "" : ",checkpoints,gocheck", MapName, steam, country, name, newtime, dia, g_weaponsnames[str_to_num(x2)], server, style == PRO_TOP ? "" : checkpoints, style == PRO_TOP ? "" : gochecks)
  4945. SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
  4946. GetNewRank(id, style)
  4947. }
  4948. else
  4949. {
  4950. new Float:oldtime, Float:thetime
  4951. SQL_ReadResult(hQuery, 0, oldtime)
  4952.  
  4953. if(newtime < oldtime)
  4954. {
  4955. thetime = oldtime - newtime
  4956. iMin = floatround(thetime / 60.0, floatround_floor)
  4957. iSec = floatround(thetime - iMin * 60.0,floatround_floor)
  4958. iMs = floatround( ( thetime - ( iMin * 60.0 + iSec ) ) * 100.0, floatround_round )
  4959.  
  4960. ColorChat(id, GREEN, "[KZ.M]^x01 %L^x03 %02i:%02i.%02i^x01 in ^x03%s", id, "KZ_IMPROVE", iMin, iSec, iMs, style == PRO_TOP ? "Pro 15" : "Noob 15")
  4961. formatex(checkpoints, 31, ", checkpoints='%d'", str_to_num(x3))
  4962. formatex(gochecks, 31, ", gocheck='%d'", str_to_num(x4))
  4963. if(equal(steam, "VALVE_ID_LAN") || equal(steam, "STEAM_ID_LAN") || strlen(steam) > 19)
  4964. 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)
  4965. else
  4966. 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)
  4967.  
  4968. SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto )
  4969. GetNewRank(id, style)
  4970. }
  4971. else
  4972. {
  4973. thetime = newtime - oldtime
  4974. iMin = floatround(thetime / 60.0, floatround_floor)
  4975. iSec = floatround(thetime - iMin * 60.0,floatround_floor)
  4976. iMs = floatround( ( thetime - ( iMin * 60.0 + iSec ) ) * 100.0, floatround_round )
  4977. client_cmd(0, "spk fvox/bell");
  4978. ColorChat(id, GREEN, "[KZ.M]^x01 %L^x03 %02i:%02i.%02i ^x01in ^x03%s", id, "KZ_SLOWER", iMin, iSec, iMs, style == PRO_TOP ? "Pro 15" : "Noob 15")
  4979. }
  4980. }
  4981.  
  4982. return PLUGIN_CONTINUE
  4983.  
  4984. }
  4985.  
  4986. public GetNewRank_QueryHandler(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
  4987. {
  4988. new id = cData[0]
  4989. if( iFailState != TQUERY_SUCCESS )
  4990. {
  4991. return log_amx("TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
  4992. }
  4993.  
  4994. new steam[32], authid[32], namez[32], name[32], i = 0
  4995. get_user_authid(id, steam, 31)
  4996. get_user_name(id, namez, 31)
  4997.  
  4998. while( SQL_MoreResults(hQuery) )
  4999. {
  5000. i++
  5001.  
  5002. SQL_ReadResult(hQuery, 0, name, 31)
  5003. SQL_ReadResult(hQuery, 0, authid, 31)
  5004. if( equal(name, namez) || equal(authid, steam) )
  5005. {
  5006.  
  5007. 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");
  5008. if( (i + 1) == 2)
  5009. {
  5010. client_cmd(0, "spk misc/mod_unstopable");
  5011. TopUpdated = true
  5012. }
  5013. else
  5014. {
  5015. client_cmd(0, "spk buttons/bell1");
  5016. }
  5017. break;
  5018. }
  5019. SQL_NextRow(hQuery)
  5020. }
  5021. set_task(0.1, "kz_update_plrname", id)
  5022. return PLUGIN_CONTINUE
  5023. }
  5024.  
  5025. public ProTop_show(id)
  5026. {
  5027. kz_showhtml_motd(id, PRO_TOP, MapName)
  5028.  
  5029. return PLUGIN_HANDLED
  5030. }
  5031.  
  5032. public NoobTop_show(id)
  5033. {
  5034.  
  5035. kz_showhtml_motd(id, NUB_TOP, MapName)
  5036.  
  5037. return PLUGIN_HANDLED
  5038. }
  5039.  
  5040. public ProRecs_show(id)
  5041. {
  5042. new authid[32]
  5043. get_user_authid(id, authid, 31)
  5044.  
  5045. if(equal(authid, "VALVE_ID_LAN") || equal(authid, "STEAM_ID_LAN") || strlen(authid) > 19)
  5046. {
  5047. ColorChat (id, GREEN, "%s^x01 %L", prefix, id, "KZ_NO_STEAM")
  5048. return PLUGIN_HANDLED
  5049. }
  5050.  
  5051. kz_showhtml_motd(id, PRO_RECORDS, MapName)
  5052.  
  5053. return PLUGIN_HANDLED
  5054. }
  5055.  
  5056. stock kz_showhtml_motd(id, type, const map[])
  5057. {
  5058. new buffer[1001], namebuffer[64], filepath[96]
  5059. get_pcvar_string(kz_sql_files, filepath, 95)
  5060. new authid[32]
  5061. get_user_authid(id, authid, 31)
  5062. new player_namez[32]
  5063. get_user_name(id, player_namez, 31)
  5064.  
  5065.  
  5066. switch( type )
  5067. {
  5068. case PRO_TOP:
  5069. {
  5070. formatex(namebuffer, 63, "Pro 15 of %s", equal(map, "") ? "All Maps" : map)
  5071. 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)
  5072. }
  5073. case NUB_TOP:
  5074. {
  5075. formatex(namebuffer, 63, "Noob 15 of %s", equal(map, "") ? "All Maps" : map)
  5076. 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)
  5077. }
  5078. case PRO_RECORDS:
  5079. {
  5080. formatex(namebuffer, 63, "ProRecords and Rank")
  5081. formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/player.php?name=%s^"></head><body><p>LOADING...</p></body></html>", filepath, player_namez)
  5082. }
  5083. case PLAYERS_RANKING:
  5084. {
  5085. formatex(namebuffer, 63, "Players Ranking")
  5086. 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)
  5087. }
  5088. case LAST_PRO10:
  5089. {
  5090. formatex(namebuffer, 63, "Last 10 Pro Entries")
  5091. formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/lastpro.php^"></head><body><p>LOADING...</p></body></html>", filepath)
  5092. }
  5093. case MAPS_STATISTIC:
  5094. {
  5095. formatex(namebuffer, 63, "Maps Statistic")
  5096. formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/map.php^"></head><body><p>LOADING...</p></body></html>", filepath)
  5097. }
  5098. }
  5099.  
  5100. show_motd(id, buffer, namebuffer)
  5101. }
  5102.  
  5103.  
  5104.  
  5105. #else
  5106.  
  5107.  
  5108.  
  5109. public ProTop_update(id, Float:time)
  5110. {
  5111. new authid[32], name[32], thetime[32], Float: slower, Float: faster, Float:protiempo
  5112. get_user_name(id, name, 31);
  5113. get_user_authid(id, authid, 31);
  5114. get_time(" %d/%m/%Y ", thetime, 31);
  5115. new bool:Is_in_pro15
  5116. Is_in_pro15 = false
  5117.  
  5118. for(new i = 0; i < 15; i++)
  5119. {
  5120. 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)) )
  5121. {
  5122. Is_in_pro15 = true
  5123. slower = time - Pro_Times[i]
  5124. faster = Pro_Times[i] - time
  5125. protiempo = Pro_Times[i]
  5126. }
  5127. }
  5128.  
  5129. for (new i = 0; i < 15; i++)
  5130. {
  5131. if( time < Pro_Times[i])
  5132. {
  5133. new pos = i
  5134. if ( get_pcvar_num(kz_top15_authid) == 0 )
  5135. while( !equal(Pro_Names[pos], name) && pos < 15 )
  5136. {
  5137. pos++;
  5138. }
  5139. else if ( get_pcvar_num(kz_top15_authid) == 1)
  5140. while( !equal(Pro_AuthIDS[pos], authid) && pos < 15 )
  5141. {
  5142. pos++;
  5143. }
  5144.  
  5145. for (new j = pos; j > i; j--)
  5146. {
  5147. formatex(Pro_AuthIDS[j], 31, Pro_AuthIDS[j-1]);
  5148. formatex(Pro_Names[j], 31, Pro_Names[j-1]);
  5149. formatex(Pro_Date[j], 31, Pro_Date[j-1])
  5150. Pro_Times[j] = Pro_Times[j-1];
  5151. }
  5152.  
  5153. formatex(Pro_AuthIDS[i], 31, authid);
  5154. formatex(Pro_Names[i], 31, name);
  5155. formatex(Pro_Date[i], 31, thetime)
  5156. Pro_Times[i] = time
  5157.  
  5158. save_pro15()
  5159.  
  5160. if( Is_in_pro15 )
  5161. {
  5162.  
  5163. if( time < protiempo )
  5164. {
  5165. new min, Float:sec;
  5166. min = floatround(faster, floatround_floor)/60;
  5167. sec = faster - (60*min);
  5168. ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_IMPROVE", min, sec < 10 ? "0" : "", sec);
  5169.  
  5170. if( (i + 1) == 1)
  5171. {
  5172. client_cmd(0, "spk misc/mod_unstopable");
  5173. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
  5174. }
  5175. else
  5176. {
  5177. client_cmd(0, "spk buttons/bell1");
  5178. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
  5179. }
  5180. }
  5181. }
  5182. else
  5183. {
  5184. if( (i + 1) == 1)
  5185. {
  5186. client_cmd(0, "spk misc/mod_unstopable");
  5187. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
  5188. }
  5189. else
  5190. {
  5191. client_cmd(0, "spk buttons/bell1");
  5192. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
  5193. }
  5194. }
  5195.  
  5196. return;
  5197. }
  5198.  
  5199. 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)) )
  5200. {
  5201. if( time > protiempo )
  5202. {
  5203. new min, Float:sec;
  5204. min = floatround(slower, floatround_floor)/60;
  5205. sec = slower - (60*min);
  5206. client_cmd(0, "spk fvox/bell");
  5207. ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_SLOWER", min, sec < 10 ? "0" : "", sec);
  5208. return;
  5209. }
  5210. }
  5211.  
  5212. }
  5213. }
  5214.  
  5215.  
  5216.  
  5217.  
  5218. public save_pro15()
  5219. {
  5220. new profile[128]
  5221. formatex(profile, 127, "%s/pro_%s.cfg", Topdir, MapName)
  5222.  
  5223. if( file_exists(profile) )
  5224. {
  5225. delete_file(profile)
  5226. }
  5227.  
  5228. new Data[256];
  5229. new f = fopen(profile, "at")
  5230.  
  5231. for(new i = 0; i < 15; i++)
  5232. {
  5233. formatex(Data, 255, "^"%.2f^" ^"%s^" ^"%s^" ^"%s^"^n", Pro_Times[i], Pro_AuthIDS[i], Pro_Names[i], Pro_Date[i])
  5234. fputs(f, Data)
  5235. }
  5236. fclose(f);
  5237. }
  5238.  
  5239. public read_pro15()
  5240. {
  5241. new profile[128], prodata[256]
  5242. formatex(profile, 127, "%s/pro_%s.cfg", Topdir, MapName)
  5243.  
  5244. new f = fopen(profile, "rt" )
  5245. new i = 0
  5246. while( !feof(f) && i < 16)
  5247. {
  5248. fgets(f, prodata, 255)
  5249. new totime[25]
  5250. parse(prodata, totime, 24, Pro_AuthIDS[i], 31, Pro_Names[i], 31, Pro_Date[i], 31)
  5251. Pro_Times[i] = str_to_float(totime)
  5252. i++;
  5253. }
  5254. fclose(f)
  5255. }
  5256.  
  5257. //==================================================================================================
  5258.  
  5259. public NoobTop_update(id, Float:time, checkpoints, gochecks)
  5260. {
  5261. new authid[32], name[32], thetime[32], wpn, Float: slower, Float: faster, Float:noobtiempo
  5262. get_user_name(id, name, 31);
  5263. get_user_authid(id, authid, 31);
  5264. get_time(" %d/%m/%Y ", thetime, 31);
  5265. new bool:Is_in_noob15
  5266. Is_in_noob15 = false
  5267. if(user_has_scout[id])
  5268. wpn=CSW_SCOUT
  5269. else
  5270. wpn=get_user_weapon(id)
  5271.  
  5272. for(new i = 0; i < 15; i++)
  5273. {
  5274. 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)) )
  5275. {
  5276. Is_in_noob15 = true
  5277. slower = time - Noob_Tiempos[i];
  5278. faster = Noob_Tiempos[i] - time;
  5279. noobtiempo = Noob_Tiempos[i]
  5280. }
  5281. }
  5282.  
  5283. for (new i = 0; i < 15; i++)
  5284. {
  5285. if( time < Noob_Tiempos[i])
  5286. {
  5287. new pos = i
  5288.  
  5289. if ( get_pcvar_num(kz_top15_authid) == 0 )
  5290. while( !equal(Noob_Names[pos], name) && pos < 15 )
  5291. {
  5292. pos++;
  5293. }
  5294. else if ( get_pcvar_num(kz_top15_authid) == 1)
  5295. while( !equal(Noob_AuthIDS[pos], authid) && pos < 15 )
  5296. {
  5297. pos++;
  5298. }
  5299.  
  5300. for (new j = pos; j > i; j--)
  5301. {
  5302. formatex(Noob_AuthIDS[j], 31, Noob_AuthIDS[j-1])
  5303. formatex(Noob_Names[j], 31, Noob_Names[j-1])
  5304. formatex(Noob_Date[j], 31, Noob_Date[j-1])
  5305. formatex(Noob_Weapon[j], 31, Noob_Weapon[j-1])
  5306. Noob_Tiempos[j] = Noob_Tiempos[j-1]
  5307. Noob_CheckPoints[j] = Noob_CheckPoints[j-1]
  5308. Noob_GoChecks[j] = Noob_GoChecks[j-1]
  5309. }
  5310.  
  5311. formatex(Noob_AuthIDS[i], 31, authid);
  5312. formatex(Noob_Names[i], 31, name);
  5313. formatex(Noob_Date[i], 31, thetime)
  5314. formatex(Noob_Weapon[i], 31, g_weaponsnames[wpn])
  5315. Noob_Tiempos[i] = time
  5316. Noob_CheckPoints[i] = checkpoints
  5317. Noob_GoChecks[i] = gochecks
  5318.  
  5319. save_Noob15()
  5320.  
  5321. if( Is_in_noob15 )
  5322. {
  5323.  
  5324. if( time < noobtiempo )
  5325. {
  5326. new min, Float:sec;
  5327. min = floatround(faster, floatround_floor)/60;
  5328. sec = faster - (60*min);
  5329. ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_IMPROVE", min, sec < 10 ? "0" : "", sec);
  5330.  
  5331. if( (i + 1) == 1)
  5332. {
  5333. client_cmd(0, "spk misc/mod_unstopable");
  5334. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
  5335. }
  5336. else
  5337. {
  5338. client_cmd(0, "spk buttons/bell1");
  5339. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
  5340. }
  5341. }
  5342. }
  5343. else
  5344. {
  5345. if( (i + 1) == 1)
  5346. {
  5347. client_cmd(0, "spk misc/mod_unstopable");
  5348. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
  5349. }
  5350. else
  5351. {
  5352. client_cmd(0, "spk buttons/bell1");
  5353. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
  5354. }
  5355. }
  5356. return;
  5357. }
  5358.  
  5359. 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)) )
  5360. {
  5361. if( time > noobtiempo )
  5362. {
  5363.  
  5364. new min, Float:sec;
  5365. min = floatround(slower, floatround_floor)/60;
  5366. sec = slower - (60*min);
  5367. client_cmd(0, "spk fvox/bell");
  5368. ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_SLOWER", min, sec < 10 ? "0" : "", sec);
  5369. return;
  5370. }
  5371. }
  5372.  
  5373. }
  5374. }
  5375.  
  5376. public save_Noob15()
  5377. {
  5378. new profile[128]
  5379. formatex(profile, 127, "%s/Noob_%s.cfg", Topdir, MapName)
  5380.  
  5381. if( file_exists(profile) )
  5382. {
  5383. delete_file(profile)
  5384. }
  5385.  
  5386. new Data[256];
  5387. new f = fopen(profile, "at")
  5388.  
  5389. for(new i = 0; i < 15; i++)
  5390. {
  5391. 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])
  5392. fputs(f, Data)
  5393. }
  5394. fclose(f);
  5395. }
  5396.  
  5397. public read_Noob15()
  5398. {
  5399. new profile[128], prodata[256]
  5400. formatex(profile, 127, "%s/Noob_%s.cfg", Topdir, MapName)
  5401.  
  5402. new f = fopen(profile, "rt" )
  5403. new i = 0
  5404. while( !feof(f) && i < 16)
  5405. {
  5406. fgets(f, prodata, 255)
  5407. new totime[25], checks[5], gochecks[5]
  5408. parse(prodata, totime, 24, Noob_AuthIDS[i], 31, Noob_Names[i], 31, checks, 4, gochecks, 4, Noob_Date[i], 31, Noob_Weapon[i], 31)
  5409. Noob_Tiempos[i] = str_to_float(totime)
  5410. Noob_CheckPoints[i] = str_to_num(checks)
  5411. Noob_GoChecks[i] = str_to_num(gochecks)
  5412. i++;
  5413. }
  5414. fclose(f)
  5415. }
  5416.  
  5417. public ProTop_show(id)
  5418. {
  5419. new buffer[2048], len, name[32]
  5420.  
  5421. len = formatex(buffer, 2047, "<meta charset=UTF-8><body bgcolor=#000000><table width=100%% cellpadding=2 cellspacing=0>")
  5422. len += formatex(buffer[len], 2047-len, "<tr align=left bgcolor=#52697B><th width=5%%>#<th width=55%% align=left>Jumper<th width=25%%>&nbsp;Время<th width=20%%>&nbsp;&nbsp;&nbsp;&nbsp;Дата")
  5423.  
  5424. for (new i = 0; i < 15; i++)
  5425. {
  5426. name = Pro_Names[i]
  5427.  
  5428. if( Pro_Times[i] > 9999999.0 )
  5429. {
  5430. len += formatex(buffer[len], 2047-len, "<tr %s><td>%d<td>%s<td>%s<td>%s",((i%2)==0)?"bgcolor=#FFFFFF":"bgcolor=#A8A8A8",(i+1),"","","")
  5431. }
  5432.  
  5433. else
  5434. {
  5435. new minutos, Float:segundos
  5436. minutos = floatround(Pro_Times[i], floatround_floor)/60
  5437. segundos = Pro_Times[i] - (60*minutos)
  5438.  
  5439. len += formatex(buffer[len], 2047-len, "<tr %s><td>%d<td>%s<td>%02d:%s%.2f<td>%s",((i%2)==0)?"bgcolor=#FFFFFF":"bgcolor=#A8A8A8",(i+1),Pro_Names[i],minutos,segundos<10?"0":"",segundos,Pro_Date[i])
  5440.  
  5441. }
  5442. }
  5443.  
  5444. len += formatex(buffer[len], 2047-len, "</table></body>")
  5445. len += formatex(buffer[len], 2047-len, "<tr><center><br><font color=white>Plugin created by Destroman&#8482;")
  5446.  
  5447. show_motd(id, buffer, "Pro15 Jumpers")
  5448.  
  5449. return PLUGIN_HANDLED
  5450. }
  5451.  
  5452.  
  5453. public NoobTop_show(id)
  5454. {
  5455. new buffer[2048], name[32], len
  5456.  
  5457. len = formatex(buffer, 2047, "<meta charset=UTF-8><body bgcolor=#000000><table width=100%% cellpadding=2 cellspacing=0>")
  5458. len += formatex(buffer[len], 2047-len, "<tr align=left bgcolor=#52697B><th width=5%%>#<th width=55%% align=left>Jumper<th width=25%%>&nbsp;Время<th width=20%%>&nbsp;&nbsp;&nbsp;&nbsp;Дата")
  5459.  
  5460. for (new i = 0; i < 15; i++)
  5461. {
  5462. if( Noob_Tiempos[i] > 9999999.0 )
  5463. {
  5464. len += formatex(buffer[len], 2047-len, "<tr %s><td>%d<td>%s<td>%s<td>%s",((i%2)==0)?"bgcolor=#FFFFFF":"bgcolor=#A8A8A8",(i+1),"","","")
  5465. }
  5466.  
  5467. else
  5468. {
  5469. name = Noob_Names[i]
  5470. new minutos, Float:segundos
  5471. minutos = floatround(Noob_Tiempos[i], floatround_floor)/60
  5472. segundos = Noob_Tiempos[i] - (60*minutos)
  5473.  
  5474. len += formatex(buffer[len], 2047-len, "<tr %s><td>%d<td>%s<td>%02d:%s%.2f<td>%s",((i%2)==0)?"bgcolor=#FFFFFF":"bgcolor=#A8A8A8",(i+1),Noob_Names[i],minutos,segundos<10?"0":"",segundos,Noob_Date[i])
  5475. }
  5476. }
  5477.  
  5478. len += formatex(buffer[len], 2047-len, "</table></body>")
  5479. len += formatex(buffer[len], 2047-len, "<tr><center><br><font color=white>Plugin created by Destroman&#8482;")
  5480.  
  5481. show_motd(id, buffer, "Noob15 Jumpers")
  5482.  
  5483. return PLUGIN_HANDLED
  5484. }
  5485.  
  5486.  
  5487.  
  5488.  
  5489.  
  5490. #endif
  5491.  
  5492.  
  5493.  
  5494. public show_beacon(id){
  5495. static origin[3]
  5496. // emit_sound(id, CHAN_ITEM, g_snd_path, 1.0, ATTN_NORM, 0, PITCH_NORM)
  5497. get_user_origin(id, origin)
  5498. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  5499. write_byte(TE_BEAMCYLINDER)
  5500. write_coord(origin[0]) //position.x
  5501. write_coord(origin[1]) //position.y
  5502. write_coord(origin[2]-29) //position.z
  5503. write_coord(origin[0]) //axis.x
  5504. write_coord(origin[1]) //axis.y
  5505. write_coord(origin[2]+200) //axis.z
  5506. write_short(my_sprite) //sprite index
  5507. write_byte(0) //starting frame
  5508. write_byte(1) //frame rate in 0.1's
  5509. write_byte(6) //life in 0.1's
  5510. write_byte(10) //line width in 0.1's
  5511. write_byte(1) //noise amplitude in 0.01's
  5512. write_byte(0) //red
  5513. write_byte(0) //green
  5514. write_byte(255) //blue
  5515. write_byte(200) //brightness
  5516. write_byte(6) //scroll speed in 0.1's
  5517. message_end();
  5518. }
  5519.  
  5520. public show_beacon2(id){
  5521. static origin[3]
  5522. get_user_origin(id, origin)
  5523. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  5524. write_byte(TE_BEAMCYLINDER)
  5525. write_coord(origin[0]) //position.x
  5526. write_coord(origin[1]) //position.y
  5527. write_coord(origin[2]-29) //position.z
  5528. write_coord(origin[0]) //axis.x
  5529. write_coord(origin[1]) //axis.y
  5530. write_coord(origin[2]+200) //axis.z
  5531. write_short(my_sprite) //sprite index
  5532. write_byte(0) //starting frame
  5533. write_byte(1) //frame rate in 0.1's
  5534. write_byte(6) //life in 0.1's
  5535. write_byte(10) //line width in 0.1's
  5536. write_byte(1) //noise amplitude in 0.01's
  5537. write_byte(0) //red
  5538. write_byte(0) //green
  5539. write_byte(255) //blue
  5540. write_byte(200) //brightness
  5541. write_byte(6) //scroll speed in 0.1's
  5542. message_end();
  5543. }
  5544.  
  5545.  
  5546. public show_beacon3(id){
  5547. id -= SHOW_BEACON
  5548. static origin[3]
  5549. // emit_sound(id, CHAN_ITEM, g_snd_path, 1.0, ATTN_NORM, 0, PITCH_NORM)
  5550. get_user_origin(id, origin)
  5551. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  5552. write_byte(TE_BEAMCYLINDER)
  5553. write_coord(origin[0]) //position.x
  5554. write_coord(origin[1]) //position.y
  5555. write_coord(origin[2]-29) //position.z
  5556. write_coord(origin[0]) //axis.x
  5557. write_coord(origin[1]) //axis.y
  5558. write_coord(origin[2]+200) //axis.z
  5559. write_short(my_sprite) //sprite index
  5560. write_byte(0) //starting frame
  5561. write_byte(1) //frame rate in 0.1's
  5562. write_byte(6) //life in 0.1's
  5563. write_byte(10) //line width in 0.1's
  5564. write_byte(1) //noise amplitude in 0.01's
  5565. write_byte(0) //red
  5566. write_byte(0) //green
  5567. write_byte(255) //blue
  5568. write_byte(200) //brightness
  5569. write_byte(6) //scroll speed in 0.1's
  5570. message_end();
  5571. }
  5572.  
  5573. public show_beacon4(id){
  5574. id -= SHOW_BEACON1
  5575. static origin[3]
  5576. get_user_origin(id, origin)
  5577. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  5578. write_byte(TE_BEAMCYLINDER)
  5579. write_coord(origin[0]) //position.x
  5580. write_coord(origin[1]) //position.y
  5581. write_coord(origin[2]-29) //position.z
  5582. write_coord(origin[0]) //axis.x
  5583. write_coord(origin[1]) //axis.y
  5584. write_coord(origin[2]+200) //axis.z
  5585. write_short(my_sprite) //sprite index
  5586. write_byte(0) //starting frame
  5587. write_byte(1) //frame rate in 0.1's
  5588. write_byte(6) //life in 0.1's
  5589. write_byte(10) //line width in 0.1's
  5590. write_byte(1) //noise amplitude in 0.01's
  5591. write_byte(0) //red
  5592. write_byte(0) //green
  5593. write_byte(255) //blue
  5594. write_byte(200) //brightness
  5595. write_byte(6) //scroll speed in 0.1's
  5596. message_end();
  5597. }
  5598.  
  5599. public plugin_end( )
  5600. {
  5601. if(g_SqlTuple)
  5602. SQL_FreeHandle(g_SqlTuple)
  5603. if(SqlConnection)
  5604. SQL_FreeHandle(SqlConnection)
  5605. for(new i = 1; i < max_players; i++ )
  5606. {
  5607. if(Autosavepos[i] && !is_user_bot(i)){
  5608. saveposition(i)
  5609. }
  5610. }
  5611.  
  5612. }
  5613.  
  5614. // You reached the end of file
  5615. // The original plugin was made by p4ddY
  5616. // This plugin was edited by nucLeaR
  5617. // Version 2.31
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement