Advertisement
Guest User

Untitled

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