Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 76.79 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")
  241. register_clcmd("-hook","hook_off")
  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] || !is_user_alive(id) )
  1024. return PLUGIN_HANDLED
  1025.  
  1026. detect_cheat(id,"Hook")
  1027. get_user_origin(id,hookorigin[id],3)
  1028. ishooked[id] = true
  1029. antihookcheat[id] = get_gametime()
  1030.  
  1031. if (get_pcvar_num(kz_hook_sound) == 1)
  1032. emit_sound(id,CHAN_STATIC,"weapons/xbow_hit2.wav",1.0,ATTN_NORM,0,PITCH_NORM)
  1033.  
  1034. set_task(0.1,"hook_task",id,"",0,"ab")
  1035. hook_task(id)
  1036.  
  1037. return PLUGIN_HANDLED
  1038. }
  1039.  
  1040. public hook_off(id)
  1041. {
  1042. remove_hook(id)
  1043.  
  1044. return PLUGIN_HANDLED
  1045. }
  1046.  
  1047. public hook_task(id)
  1048. {
  1049. if(!is_user_connected(id) || !is_user_alive(id))
  1050. remove_hook(id)
  1051.  
  1052. remove_beam(id)
  1053. draw_hook(id)
  1054.  
  1055. new origin[3], Float:velocity[3]
  1056. get_user_origin(id,origin)
  1057. new distance = get_distance(hookorigin[id],origin)
  1058. velocity[0] = (hookorigin[id][0] - origin[0]) * (2.0 * get_pcvar_num(kz_hook_speed) / distance)
  1059. velocity[1] = (hookorigin[id][1] - origin[1]) * (2.0 * get_pcvar_num(kz_hook_speed) / distance)
  1060. velocity[2] = (hookorigin[id][2] - origin[2]) * (2.0 * get_pcvar_num(kz_hook_speed) / distance)
  1061.  
  1062. set_pev(id,pev_velocity,velocity)
  1063. }
  1064.  
  1065. public draw_hook(id)
  1066. {
  1067. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  1068. write_byte(1) // TE_BEAMENTPOINT
  1069. write_short(id) // entid
  1070. write_coord(hookorigin[id][0]) // origin
  1071. write_coord(hookorigin[id][1]) // origin
  1072. write_coord(hookorigin[id][2]) // origin
  1073. write_short(Sbeam) // sprite index
  1074. write_byte(0) // start frame
  1075. write_byte(0) // framerate
  1076. write_byte(random_num(1,100)) // life
  1077. write_byte(random_num(1,20)) // width
  1078. write_byte(random_num(1,0)) // noise
  1079. write_byte(random_num(1,255)) // r
  1080. write_byte(random_num(1,255)) // g
  1081. write_byte(random_num(1,255)) // b
  1082. write_byte(random_num(1,500)) // brightness
  1083. write_byte(random_num(1,200)) // speed
  1084. message_end()
  1085. }
  1086.  
  1087. public remove_hook(id)
  1088. {
  1089. if(task_exists(id))
  1090. remove_task(id)
  1091. remove_beam(id)
  1092. ishooked[id] = false
  1093. }
  1094.  
  1095. public remove_beam(id)
  1096. {
  1097. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  1098. write_byte(99) // TE_KILLBEAM
  1099. write_short(id)
  1100. message_end()
  1101. }
  1102.  
  1103.  
  1104. //============================ VIP In ScoreBoard =================================================
  1105.  
  1106. public MessageScoreAttrib( iMsgID, iDest, iReceiver )
  1107. {
  1108. if( get_pcvar_num(kz_vip) )
  1109. {
  1110. new iPlayer = get_msg_arg_int( 1 )
  1111. if( is_user_alive( iPlayer ) && ( get_user_flags( iPlayer ) & KZ_LEVEL ) )
  1112. {
  1113. set_msg_arg_int( 2, ARG_BYTE, SCOREATTRIB_VIP );
  1114. }
  1115. }
  1116. }
  1117.  
  1118. public EventStatusValue( const id )
  1119. {
  1120.  
  1121. new szMessage[ 34 ], Target, aux
  1122. get_user_aiming(id, Target, aux)
  1123. if (is_user_alive(Target))
  1124. {
  1125. formatex( szMessage, 33, "1 %s: %%p2", get_user_flags( Target ) & KZ_LEVEL ? "VIP" : "Player" )
  1126. message_begin( MSG, get_user_msgid( "StatusText" ) , _, id )
  1127. write_byte( 0 )
  1128. write_string( szMessage )
  1129. message_end( )
  1130. }
  1131. }
  1132.  
  1133. public detect_cheat(id,reason[])
  1134. {
  1135. if(timer_started[id] && get_pcvar_num(kz_cheatdetect) == 1)
  1136. {
  1137. timer_started[id] = false
  1138. if(IsPaused[id])
  1139. {
  1140. set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
  1141. IsPaused[id] = false
  1142. }
  1143. if (get_pcvar_num(kz_show_timer) > 0 && ShowTime[id] == 2)
  1144. kz_showtime_roundtime(id, 0)
  1145. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_CHEAT_DETECT", reason)
  1146. }
  1147. }
  1148.  
  1149. // =================================================================================================
  1150. // Cmds
  1151. // =================================================================================================
  1152.  
  1153. public CheckPoint(id)
  1154. {
  1155.  
  1156. if( !is_user_alive( id ) )
  1157. {
  1158. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  1159. return PLUGIN_HANDLED
  1160. }
  1161.  
  1162. if(get_pcvar_num(kz_checkpoints) == 0)
  1163. {
  1164. kz_chat(id, "%L", id, "KZ_CHECKPOINT_OFF")
  1165. return PLUGIN_HANDLED
  1166. }
  1167.  
  1168. if( !( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id))
  1169. {
  1170. kz_chat(id, "%L", id, "KZ_CHECKPOINT_AIR")
  1171. return PLUGIN_HANDLED
  1172. }
  1173.  
  1174. if( IsPaused[id] )
  1175. {
  1176. kz_chat(id, "%L", id, "KZ_CHECKPOINT_PAUSE")
  1177. return PLUGIN_HANDLED
  1178. }
  1179.  
  1180. pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id] ? 1 : 0])
  1181. g_bCpAlternate[id] = !g_bCpAlternate[id]
  1182. checknumbers[id]++
  1183.  
  1184. kz_chat(id, "%L", id, "KZ_CHECKPOINT", checknumbers[id])
  1185.  
  1186. return PLUGIN_HANDLED
  1187. }
  1188.  
  1189. public GoCheck(id)
  1190. {
  1191. if( !is_user_alive( id ) )
  1192. {
  1193. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  1194. return PLUGIN_HANDLED
  1195. }
  1196.  
  1197. if( checknumbers[id] == 0 )
  1198. {
  1199. kz_chat(id, "%L", id, "KZ_NOT_ENOUGH_CHECKPOINTS")
  1200. return PLUGIN_HANDLED
  1201. }
  1202.  
  1203. if( IsPaused[id] )
  1204. {
  1205. kz_chat(id, "%L", id, "KZ_TELEPORT_PAUSE")
  1206. return PLUGIN_HANDLED
  1207. }
  1208.  
  1209. set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} );
  1210. set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 } );
  1211. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
  1212. set_pev( id, pev_fuser2, 0.0 );
  1213. engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } );
  1214. set_pev(id, pev_origin, Checkpoints[ id ][ !g_bCpAlternate[id] ] )
  1215. gochecknumbers[id]++
  1216.  
  1217. kz_chat(id, "%L", id, "KZ_GOCHECK", gochecknumbers[id])
  1218.  
  1219. return PLUGIN_HANDLED
  1220. }
  1221.  
  1222. public Stuck(id)
  1223. {
  1224. if( !is_user_alive( id ) )
  1225. {
  1226. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  1227. return PLUGIN_HANDLED
  1228. }
  1229.  
  1230. if( checknumbers[id] < 2 )
  1231. {
  1232. kz_chat(id, "%L", id, "KZ_NOT_ENOUGH_CHECKPOINTS")
  1233. return PLUGIN_HANDLED
  1234. }
  1235.  
  1236. set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} )
  1237. set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 })
  1238. set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
  1239. set_pev( id, pev_fuser2, 0.0 )
  1240. engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } )
  1241. set_pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id]] )
  1242. g_bCpAlternate[id] = !g_bCpAlternate[id];
  1243. gochecknumbers[id]++
  1244.  
  1245. kz_chat(id, "%L", id, "KZ_GOCHECK", gochecknumbers[id])
  1246.  
  1247. return PLUGIN_HANDLED;
  1248. }
  1249.  
  1250. // =================================================================================================
  1251.  
  1252. public reset_checkpoints(id)
  1253. {
  1254. checknumbers[id] = 0
  1255. gochecknumbers[id] = 0
  1256. timer_started[id] = false
  1257. timer_time[id] = 0.0
  1258. user_has_scout[id] = false
  1259. if(IsPaused[id])
  1260. {
  1261. set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
  1262. IsPaused[id] = false
  1263. }
  1264. if (get_pcvar_num(kz_show_timer) > 0 && ShowTime[id] == 2)
  1265. kz_showtime_roundtime(id, 0)
  1266.  
  1267. return PLUGIN_HANDLED
  1268. }
  1269.  
  1270. //===== Invis =======
  1271.  
  1272. public cmdInvisible(id)
  1273. {
  1274.  
  1275. gViewInvisible[id] = !gViewInvisible[id]
  1276. if(gViewInvisible[id])
  1277. kz_chat(id, "%L", id, "KZ_INVISIBLE_PLAYERS_ON")
  1278. else
  1279. kz_chat(id, "%L", id, "KZ_INVISIBLE_PLAYERS_OFF")
  1280.  
  1281. return PLUGIN_HANDLED
  1282. }
  1283.  
  1284. public cmdWaterInvisible(id)
  1285. {
  1286. if( !gWaterFound )
  1287. {
  1288. kz_chat(id, "%L", id, "KZ_INVISIBLE_NOWATER")
  1289. return PLUGIN_HANDLED
  1290. }
  1291.  
  1292. gWaterInvisible[id] = !gWaterInvisible[id]
  1293. if(gWaterInvisible[id])
  1294. kz_chat(id, "%L", id, "KZ_INVISIBLE_WATER_ON")
  1295. else
  1296. kz_chat(id, "%L", id, "KZ_INVISIBLE_WATER_OFF")
  1297.  
  1298. return PLUGIN_HANDLED
  1299. }
  1300.  
  1301. //======================Semiclip / Invis==========================
  1302.  
  1303. public FM_client_AddToFullPack_Post(es, e, ent, host, hostflags, player, pSet)
  1304. {
  1305. if( player )
  1306. {
  1307. if (get_pcvar_num(kz_semiclip) == 1)
  1308. {
  1309. if ( host != ent && get_orig_retval() && is_user_alive(host) )
  1310. {
  1311. set_es(es, ES_Solid, SOLID_NOT)
  1312. set_es(es, ES_RenderMode, kRenderTransAlpha)
  1313. set_es(es, ES_RenderAmt, get_pcvar_num(kz_semiclip_transparency))
  1314. }
  1315. }
  1316. if(gMarkedInvisible[ent] && gViewInvisible[host])
  1317. {
  1318. set_es(es, ES_RenderMode, kRenderTransTexture)
  1319. set_es(es, ES_RenderAmt, 0)
  1320. set_es(es, ES_Origin, { 999999999.0, 999999999.0, 999999999.0 } )
  1321. }
  1322. }
  1323. else if( gWaterInvisible[host] && gWaterEntity[ent] )
  1324. {
  1325. set_es(es, ES_Effects, get_es( es, ES_Effects ) | EF_NODRAW )
  1326. }
  1327.  
  1328. return FMRES_IGNORED
  1329. }
  1330.  
  1331. public Ham_CBasePlayer_PreThink_Post(id)
  1332. {
  1333. if( !is_user_alive(id) )
  1334. {
  1335. return
  1336. }
  1337.  
  1338. RefreshPlayersList()
  1339.  
  1340. if (get_pcvar_num(kz_semiclip) == 1)
  1341. {
  1342. for(new i = 0; i<g_iNum; i++)
  1343. {
  1344. g_iPlayer = g_iPlayers[i]
  1345. if( id != g_iPlayer )
  1346. {
  1347. set_pev(g_iPlayer, pev_solid, SOLID_NOT)
  1348. }
  1349. }
  1350. }
  1351. }
  1352.  
  1353. public client_PostThink(id)
  1354. {
  1355. if( !is_user_alive(id) )
  1356. return
  1357.  
  1358. RefreshPlayersList()
  1359.  
  1360. if (get_pcvar_num(kz_semiclip) == 1)
  1361. for(new i = 0; i<g_iNum; i++)
  1362. {
  1363. g_iPlayer = g_iPlayers[i]
  1364. if( g_iPlayer != id )
  1365. set_pev(g_iPlayer, pev_solid, SOLID_SLIDEBOX)
  1366. }
  1367. }
  1368.  
  1369. public noclip(id)
  1370. {
  1371. if(!is_user_alive(id))
  1372. {
  1373. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  1374. return PLUGIN_HANDLED
  1375. }
  1376. new noclip = !get_user_noclip(id)
  1377. set_user_noclip(id, noclip)
  1378. if(IsPaused[id] && (get_pcvar_num(kz_noclip_pause) == 1))
  1379. {
  1380. if(noclip)
  1381. {
  1382. pev(id, pev_origin, NoclipPos[id])
  1383. set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
  1384. }
  1385. else
  1386. {
  1387. set_pev(id, pev_origin, NoclipPos[id])
  1388. set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN)
  1389. }
  1390. }
  1391. else if(noclip)
  1392. detect_cheat(id,"Noclip")
  1393. kz_chat(id, "%L", id, "KZ_NOCLIP" , noclip ? "ON" : "OFF")
  1394.  
  1395. return PLUGIN_HANDLED
  1396. }
  1397.  
  1398. public GodMode(id)
  1399. {
  1400. if(!is_user_alive(id))
  1401. {
  1402. kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
  1403. return PLUGIN_HANDLED
  1404. }
  1405.  
  1406. new godmode = !get_user_godmode(id)
  1407. set_user_godmode(id, godmode)
  1408. if(godmode)
  1409. detect_cheat(id,"God Mode")
  1410. kz_chat(id, "%L", id, "KZ_GODMODE" , godmode ? "ON" : "OFF")
  1411.  
  1412. return PLUGIN_HANDLED
  1413. }
  1414.  
  1415. // =================================================================================================
  1416.  
  1417. stock kz_set_start(const map[], Float:origin[3])
  1418. {
  1419. new realfile[128], tempfile[128], formatorigin[50]
  1420. formatex(realfile, 127, "%s/%s", Kzdir, KZ_STARTFILE)
  1421. formatex(tempfile, 127, "%s/%s", Kzdir, KZ_STARTFILE_TEMP)
  1422. formatex(formatorigin, 49, "%f %f %f", origin[0], origin[1], origin[2])
  1423.  
  1424. DefaultStartPos = origin
  1425. DefaultStart = true
  1426.  
  1427. new file = fopen(tempfile, "wt")
  1428. new vault = fopen(realfile, "rt")
  1429.  
  1430. new data[128], key[64]
  1431. new bool:replaced = false
  1432.  
  1433. while( !feof(vault) )
  1434. {
  1435. fgets(vault, data, 127)
  1436. parse(data, key, 63)
  1437.  
  1438. if( equal(key, map) && !replaced )
  1439. {
  1440. fprintf(file, "%s %s^n", map, formatorigin)
  1441.  
  1442. replaced = true
  1443. }
  1444. else
  1445. {
  1446. fputs(file, data)
  1447. }
  1448. }
  1449.  
  1450. if( !replaced )
  1451. {
  1452. fprintf(file, "%s %s^n", map, formatorigin)
  1453. }
  1454.  
  1455. fclose(file)
  1456. fclose(vault)
  1457.  
  1458. delete_file(realfile)
  1459. while( !rename_file(tempfile, realfile, 1) ) {}
  1460. }
  1461.  
  1462. stock kz_showtime_roundtime(id, time)
  1463. {
  1464. if( is_user_connected(id) )
  1465. {
  1466. message_begin(MSG, get_user_msgid( "RoundTime" ), _, id);
  1467. write_short(time + 1);
  1468. message_end();
  1469. }
  1470. }
  1471.  
  1472. stock kz_chat(id, const message[], {Float,Sql,Result,_}:...)
  1473. {
  1474. new cvar = get_pcvar_num(kz_chatorhud)
  1475. if(cvar == 0)
  1476. return PLUGIN_HANDLED
  1477.  
  1478. new msg[180], final[192]
  1479. if (cvar == 1 && chatorhud[id] == -1 || chatorhud[id] == 1)
  1480. {
  1481. vformat(msg, 179, message, 3)
  1482. formatex(final, 191, "%s^x01 %s", prefix, msg)
  1483. kz_remplace_colors(final, 191)
  1484. ColorChat(id, GREEN, "%s", final)
  1485. }
  1486. else if( cvar == 2 && chatorhud[id] == -1 || chatorhud[id] == 2)
  1487. {
  1488. vformat(msg, 179, message, 3)
  1489. replace_all(msg, 191, "^x01", "")
  1490. replace_all(msg, 191, "^x03", "")
  1491. replace_all(msg, 191, "^x04", "")
  1492. replace_all(msg, 191, ".", "")
  1493. kz_hud_message(id, "%s", msg)
  1494. }
  1495.  
  1496. return 1
  1497. }
  1498.  
  1499. stock kz_print_config(id, const msg[])
  1500. {
  1501. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, id);
  1502. write_byte(id);
  1503. write_string(msg);
  1504. message_end();
  1505. }
  1506.  
  1507. stock kz_remplace_colors(message[], len)
  1508. {
  1509. replace_all(message, len, "!g", "^x04")
  1510. replace_all(message, len, "!t", "^x03")
  1511. replace_all(message, len, "!y", "^x01")
  1512. }
  1513.  
  1514. stock kz_hud_message(id, const message[], {Float,Sql,Result,_}:...)
  1515. {
  1516. static msg[192], colors[12], r[4], g[4], b[4];
  1517. vformat(msg, 191, message, 3);
  1518.  
  1519. get_pcvar_string(kz_hud_color, colors, 11)
  1520. parse(colors, r, 3, g, 3, b, 4)
  1521.  
  1522. 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);
  1523. ShowSyncHudMsg(id, hud_message, msg);
  1524. }
  1525.  
  1526. stock kz_register_saycmd(const saycommand[], const function[], flags)
  1527. {
  1528. new temp[64]
  1529. formatex(temp, 63, "say /%s", saycommand)
  1530. register_clcmd(temp, function, flags)
  1531. formatex(temp, 63, "say .%s", saycommand)
  1532. register_clcmd(temp, function, flags)
  1533. formatex(temp, 63, "say_team /%s", saycommand)
  1534. register_clcmd(temp, function, flags)
  1535. formatex(temp, 63, "say_team .%s", saycommand)
  1536. register_clcmd(temp, function, flags)
  1537. }
  1538.  
  1539. stock get_configsdir(name[],len)
  1540. {
  1541. return get_localinfo("amxx_configsdir",name,len);
  1542. }
  1543.  
  1544. #if defined USE_SQL
  1545. stock GetNewRank(id, type)
  1546. {
  1547. new createinto[1001]
  1548.  
  1549. new cData[2]
  1550. cData[0] = id
  1551. cData[1] = type
  1552.  
  1553. formatex(createinto, 1000, "SELECT authid FROM `%s` WHERE mapname='%s' ORDER BY time LIMIT 15", type == PRO_TOP ? "kz_pro15" : "kz_nub15", MapName)
  1554. SQL_ThreadQuery(g_SqlTuple, "GetNewRank_QueryHandler", createinto, cData, 2)
  1555. }
  1556.  
  1557. stock kz_update_plrname(id)
  1558. {
  1559. new createinto[1001], authid[32], name[32]
  1560. get_user_authid(id, authid, 31)
  1561. get_user_name(id, name, 31)
  1562.  
  1563. replace_all(name, 31, "\", "")
  1564. replace_all(name, 31, "`", "")
  1565. replace_all(name, 31, "'", "")
  1566.  
  1567. if(equal(authid, "VALVE_ID_LAN") || equal(authid, "STEAM_ID_LAN") || strlen(authid) > 18)
  1568. return 0;
  1569. else
  1570. {
  1571. formatex(createinto, 1000, "UPDATE `kz_pro15` SET name='%s' WHERE authid='%s'", name, authid)
  1572. SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
  1573. formatex(createinto, 1000, "UPDATE `kz_nub15` SET name='%s' WHERE authid='%s'", name, authid)
  1574. SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
  1575. }
  1576. return 1
  1577. }
  1578. #endif
  1579.  
  1580. public FwdSpawnWeaponbox( iEntity )
  1581. {
  1582. if(get_pcvar_num(kz_remove_drops) == 1)
  1583. {
  1584. set_pev( iEntity, pev_flags, FL_KILLME )
  1585. dllfunc( DLLFunc_Think, iEntity )
  1586. }
  1587.  
  1588. return HAM_IGNORED
  1589. }
  1590.  
  1591. public FwdHamDoorSpawn( iEntity )
  1592. {
  1593. static const szNull[ ] = "common/null.wav";
  1594.  
  1595. new Float:flDamage;
  1596. pev( iEntity, pev_dmg, flDamage );
  1597.  
  1598. if( flDamage < -999.0 ) {
  1599. set_pev( iEntity, pev_noise1, szNull );
  1600. set_pev( iEntity, pev_noise2, szNull );
  1601. set_pev( iEntity, pev_noise3, szNull );
  1602.  
  1603. if( !HealsOnMap )
  1604. HealsOnMap = true
  1605. }
  1606. }
  1607.  
  1608. public FwdHamPlayerSpawn( id )
  1609. {
  1610.  
  1611. if( !is_user_alive( id ) )
  1612. return;
  1613.  
  1614. if(firstspawn[id])
  1615. {
  1616. ColorChat(id, GREEN, "%s^x01 Welcome to ^x03nucLeaR's Server ^x01", prefix)
  1617. ColorChat(id, GREEN, "%s^x01 Visit ^x03www.google.com ^x01", prefix)
  1618.  
  1619. if(get_pcvar_num(kz_checkpoints) == 0)
  1620. ColorChat(id, GREEN, "%s^x01 %L", id, "KZ_CHECKPOINT_OFF", prefix)
  1621.  
  1622.  
  1623. if(Verif(id,1) && get_pcvar_num(kz_save_pos) == 1)
  1624. savepos_menu(id)
  1625. else if(get_pcvar_num(kz_spawn_mainmenu) == 1)
  1626. kz_menu (id)
  1627. }
  1628. firstspawn[id] = false
  1629.  
  1630.  
  1631. if( !user_has_weapon(id,CSW_KNIFE) )
  1632. give_item( id,"weapon_knife" )
  1633.  
  1634. if( HealsOnMap )
  1635. set_user_health(id, 50175)
  1636.  
  1637. if( IsPaused[id] )
  1638. {
  1639. set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN)
  1640. set_pev(id, pev_origin, PauseOrigin[id])
  1641. }
  1642.  
  1643. if(get_pcvar_num(kz_use_radio) == 0)
  1644. {
  1645. #define XO_PLAYER 5
  1646. #define m_iRadiosLeft 192
  1647. set_pdata_int(id, m_iRadiosLeft, 0, XO_PLAYER)
  1648. }
  1649. }
  1650.  
  1651. public GroundWeapon_Touch(iWeapon, id)
  1652. {
  1653. if( is_user_alive(id) && timer_started[id] && get_pcvar_num(kz_pick_weapons) == 0 )
  1654. return HAM_SUPERCEDE
  1655.  
  1656. return HAM_IGNORED
  1657. }
  1658.  
  1659.  
  1660.  
  1661. // ==================================Save positions=================================================
  1662.  
  1663. public SavePos(id)
  1664. {
  1665.  
  1666. new authid[33];
  1667. get_user_authid(id, authid, 32)
  1668. if(get_pcvar_num(kz_save_pos) == 0)
  1669. {
  1670. kz_chat(id, "%L", id, "KZ_SAVEPOS_DISABLED")
  1671. return PLUGIN_HANDLED
  1672. }
  1673.  
  1674. if(equal(authid, "VALVE_ID_LAN") || equal(authid, "STEAM_ID_LAN") || strlen(authid) > 18)
  1675. {
  1676. ColorChat (id, GREEN, "%s^x01 %L", prefix, id, "KZ_NO_STEAM")
  1677.  
  1678. return PLUGIN_HANDLED
  1679. }
  1680.  
  1681. if( !( pev( id, pev_flags ) & FL_ONGROUND2 ) )
  1682. {
  1683. kz_chat(id, "%L", id, "KZ_NOT_ON_GROUND")
  1684.  
  1685. return PLUGIN_HANDLED
  1686. }
  1687.  
  1688. if(!timer_started[id])
  1689. {
  1690. kz_chat(id, "%L", id, "KZ_TIMER_NOT_STARTED")
  1691. return PLUGIN_HANDLED
  1692. }
  1693.  
  1694. if(Verif(id,1))
  1695. {
  1696. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SAVEPOS_ALREADY")
  1697. savepos_menu(id)
  1698. return PLUGIN_HANDLED
  1699. }
  1700.  
  1701. if(get_user_noclip(id))
  1702. {
  1703. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SAVEPOS_NOCLIP")
  1704. return PLUGIN_HANDLED
  1705. }
  1706.  
  1707. new Float:origin[3], scout
  1708. pev(id, pev_origin, origin)
  1709. new Float:Time,check,gocheck
  1710. if(IsPaused[id])
  1711. {
  1712. Time = g_pausetime[id]
  1713. Pause(id)
  1714. }
  1715. else
  1716. Time=get_gametime() - timer_time[id]
  1717. check=checknumbers[id]
  1718. gocheck=gochecknumbers[id]
  1719. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SAVEPOS")
  1720. if (user_has_scout[id])
  1721. scout=1
  1722. else
  1723. scout=0
  1724. kz_savepos(id, Time, check, gocheck, origin, scout)
  1725. reset_checkpoints(id)
  1726.  
  1727. return PLUGIN_HANDLED
  1728. }
  1729.  
  1730. public GoPos(id)
  1731. {
  1732. remove_hook(id)
  1733. set_user_godmode(id, 0)
  1734. set_user_noclip(id, 0)
  1735. if(Verif(id,0))
  1736. {
  1737. set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
  1738. set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
  1739. set_pev(id, pev_origin, SavedOrigins[id] )
  1740. }
  1741.  
  1742. checknumbers[id]=SavedChecks[id]
  1743. if( SavedGoChecks[ id ] > 0 )
  1744. gochecknumbers[id]=SavedGoChecks[id]+((get_pcvar_num(kz_save_pos_gochecks)>0) ? 1 : 0)
  1745. else
  1746. gochecknumbers[id] = 0
  1747.  
  1748. CheckPoint(id)
  1749. CheckPoint(id)
  1750. strip_user_weapons(id)
  1751. give_item(id,"weapon_usp")
  1752. give_item(id,"weapon_knife")
  1753. if(SavedScout[id])
  1754. {
  1755. give_item(id, "weapon_scout")
  1756. user_has_scout[id] = true
  1757. }
  1758. timer_time[id]=get_gametime()-SavedTime[id]
  1759. timer_started[id]=true
  1760. Pause(id)
  1761.  
  1762. }
  1763.  
  1764. public Verif(id, action)
  1765. {
  1766. new realfile[128], tempfile[128], authid[32], map[64]
  1767. new bool:exist = false
  1768. get_mapname(map, 63)
  1769. get_user_authid(id, authid, 31)
  1770. formatex(realfile, 127, "%s/%s.ini", SavePosDir, map)
  1771. formatex(tempfile, 127, "%s/temp.ini", SavePosDir)
  1772.  
  1773. if( !file_exists(realfile) )
  1774. return 0
  1775.  
  1776. new file = fopen(tempfile, "wt")
  1777. new vault = fopen(realfile, "rt")
  1778. new data[150], sid[32], time[25], checks[5], gochecks[5], x[25], y[25], z[25], scout[5]
  1779. while( !feof(vault) )
  1780. {
  1781. fgets(vault, data, 149)
  1782. parse(data, sid, 31, time, 24, checks, 4, gochecks, 4, x, 24, y, 24, z, 24, scout, 4)
  1783.  
  1784. if( equal(sid, authid) && !exist) // ma aflu in fisier?
  1785. {
  1786. if(action == 1)
  1787. fputs(file, data)
  1788. exist= true
  1789. SavedChecks[id] = str_to_num(checks)
  1790. SavedGoChecks[id] = str_to_num(gochecks)
  1791. SavedTime[id] = str_to_float(time)
  1792. SavedOrigins[id][0]=str_to_num(x)
  1793. SavedOrigins[id][1]=str_to_num(y)
  1794. SavedOrigins[id][2]=str_to_num(z)
  1795. SavedScout[id] = str_to_num(scout)
  1796. }
  1797. else
  1798. {
  1799. fputs(file, data)
  1800. }
  1801. }
  1802.  
  1803. fclose(file)
  1804. fclose(vault)
  1805.  
  1806. delete_file(realfile)
  1807. if(file_size(tempfile) == 0)
  1808. delete_file(tempfile)
  1809. else
  1810. while( !rename_file(tempfile, realfile, 1) ) {}
  1811.  
  1812.  
  1813. if(!exist)
  1814. return 0
  1815.  
  1816. return 1
  1817. }
  1818. public kz_savepos (id, Float:time, checkpoints, gochecks, Float:origin[3], scout)
  1819. {
  1820. new realfile[128], formatorigin[128], map[64], authid[32]
  1821. get_mapname(map, 63)
  1822. get_user_authid(id, authid, 31)
  1823. formatex(realfile, 127, "%s/%s.ini", SavePosDir, map)
  1824. formatex(formatorigin, 127, "%s %f %d %d %d %d %d %d", authid, time, checkpoints, gochecks, origin[0], origin[1], origin[2], scout)
  1825.  
  1826. new vault = fopen(realfile, "rt+")
  1827. write_file(realfile, formatorigin) // La sfarsit adaug datele mele
  1828.  
  1829. fclose(vault)
  1830.  
  1831. }
  1832.  
  1833. // =================================================================================================
  1834. // Events / Forwards
  1835. // =================================================================================================
  1836.  
  1837. //=================================================================================================
  1838.  
  1839. public client_disconnect(id)
  1840. {
  1841. checknumbers[id] = 0
  1842. gochecknumbers[id] = 0
  1843. antihookcheat[id] = 0.0
  1844. chatorhud[id] = -1
  1845. timer_started[id] = false
  1846. ShowTime[id] = get_pcvar_num(kz_show_timer)
  1847. firstspawn[id] = true
  1848. NightVisionUse[id] = false
  1849. IsPaused[id] = false
  1850. WasPaused[id] = false
  1851. user_has_scout[id] = false
  1852. remove_hook(id)
  1853. }
  1854.  
  1855. public client_putinserver(id)
  1856. {
  1857. checknumbers[id] = 0
  1858. gochecknumbers[id] = 0
  1859. antihookcheat[id] = 0.0
  1860. chatorhud[id] = -1
  1861. timer_started[id] = false
  1862. ShowTime[id] = get_pcvar_num(kz_show_timer)
  1863. firstspawn[id] = true
  1864. NightVisionUse[id] = false
  1865. IsPaused[id] = false
  1866. WasPaused[id] = false
  1867. user_has_scout[id] = false
  1868. remove_hook(id)
  1869. }
  1870.  
  1871. // =================================================================================================
  1872. // Menu
  1873. // =================================================================================================
  1874.  
  1875.  
  1876. public kz_menu(id)
  1877. {
  1878. new title[64];
  1879. formatex(title, 63, "\yProKreedz %s Menu\w", VERSION)
  1880. new menu = menu_create(title, "MenuHandler")
  1881.  
  1882. new msgcheck[64], msggocheck[64], msgpause[64]
  1883. formatex(msgcheck, 63, "Checkpoint - \y#%i", checknumbers[id])
  1884. formatex(msggocheck, 63, "Gocheck - \y#%i", gochecknumbers[id])
  1885. formatex(msgpause, 63, "Pause - %s^n", IsPaused[id] ? "\yON" : "\rOFF" )
  1886.  
  1887. menu_additem( menu, msgcheck, "1" )
  1888. menu_additem( menu, msggocheck, "2" )
  1889. menu_additem( menu, "Top 15^n", "3")
  1890. menu_additem( menu, "Start", "4")
  1891. menu_additem( menu, "Timer Menu", "5" )
  1892. menu_additem( menu, msgpause, "6" )
  1893. menu_additem( menu, "Invisible Menu", "7" )
  1894. menu_additem( menu, "Spectator/CT", "8" )
  1895. menu_additem( menu, "Reset Time^n", "9")
  1896. menu_additem( menu, "Exit", "MENU_EXIT" )
  1897.  
  1898. menu_setprop(menu, MPROP_PERPAGE, 0)
  1899. menu_display(id, menu, 0)
  1900. return PLUGIN_HANDLED
  1901. }
  1902.  
  1903. public MenuHandler(id , menu, item)
  1904. {
  1905. if( item == MENU_EXIT ) {
  1906. menu_destroy(menu)
  1907. return PLUGIN_HANDLED
  1908. }
  1909.  
  1910.  
  1911. switch(item) {
  1912. case 0:{
  1913. CheckPoint(id)
  1914. kz_menu(id)
  1915. }
  1916. case 1:{
  1917. GoCheck(id)
  1918. kz_menu(id)
  1919. }
  1920. case 2:{
  1921. top15menu(id)
  1922. }
  1923. case 3:{
  1924. goStart(id)
  1925. kz_menu(id)
  1926. }
  1927. case 4:{
  1928. ShowTimer_Menu(id)
  1929. }
  1930. case 5:{
  1931. Pause(id)
  1932. kz_menu(id)
  1933. }
  1934. case 6:{
  1935. InvisMenu(id)
  1936. }
  1937. case 7:{
  1938. ct(id)
  1939. }
  1940. case 8:{
  1941. reset_checkpoints(id)
  1942. kz_menu(id)
  1943. }
  1944. }
  1945.  
  1946. return PLUGIN_HANDLED
  1947. }
  1948.  
  1949. public InvisMenu(id)
  1950. {
  1951. new menu = menu_create("\yInvis Menu\w", "InvisMenuHandler")
  1952. new msginvis[64], msgwaterinvis[64]
  1953.  
  1954. formatex(msginvis, 63, "Players - %s", gViewInvisible[id] ? "\yON" : "\rOFF" )
  1955. formatex(msgwaterinvis, 63, "Water - %s^n^n", gWaterInvisible[id] ? "\yON" : "\rOFF" )
  1956.  
  1957. menu_additem( menu, msginvis, "1" )
  1958. menu_additem( menu, msgwaterinvis, "2" )
  1959. menu_additem( menu, "Main Menu", "3" )
  1960.  
  1961. menu_display(id, menu, 0)
  1962. return PLUGIN_HANDLED
  1963. }
  1964.  
  1965. public InvisMenuHandler (id, menu, item)
  1966. {
  1967. if( item == MENU_EXIT )
  1968. {
  1969. menu_destroy(menu)
  1970. return PLUGIN_HANDLED
  1971. }
  1972.  
  1973. switch(item)
  1974. {
  1975. case 0:
  1976. {
  1977. cmdInvisible(id)
  1978. InvisMenu(id)
  1979. }
  1980. case 1:
  1981. {
  1982. cmdWaterInvisible(id)
  1983. InvisMenu(id)
  1984. }
  1985. case 2:
  1986. {
  1987. kz_menu(id)
  1988. }
  1989. }
  1990. return PLUGIN_HANDLED
  1991. }
  1992.  
  1993. public ShowTimer_Menu(id)
  1994. {
  1995. if (get_pcvar_num(kz_show_timer) == 0 )
  1996. {
  1997. kz_chat(id, "%L", id, "KZ_TIMER_DISABLED")
  1998. return PLUGIN_HANDLED
  1999. }
  2000. else
  2001. {
  2002. new menu = menu_create("\yTimer Menu\w", "TimerHandler")
  2003.  
  2004. new roundtimer[64], hudtimer[64], notimer[64];
  2005.  
  2006. formatex(roundtimer, 63, "Round Timer %s", ShowTime[id] == 2 ? "\y x" : "" )
  2007. formatex(hudtimer, 63, "HUD Timer %s", ShowTime[id] == 1 ? "\y x" : "" )
  2008. formatex(notimer, 63, "No Timer %s^n", ShowTime[id] == 0 ? "\y x" : "" )
  2009.  
  2010. menu_additem( menu, roundtimer, "1" )
  2011. menu_additem( menu, hudtimer, "2" )
  2012. menu_additem( menu, notimer, "3" )
  2013. menu_additem( menu, "Main Menu", "4" )
  2014.  
  2015. menu_display(id, menu, 0)
  2016. return PLUGIN_HANDLED
  2017. }
  2018.  
  2019. return PLUGIN_HANDLED
  2020. }
  2021.  
  2022. public TimerHandler (id, menu, item)
  2023. {
  2024. if( item == MENU_EXIT )
  2025. {
  2026. menu_destroy(menu)
  2027. return PLUGIN_HANDLED
  2028. }
  2029.  
  2030. switch(item)
  2031. {
  2032.  
  2033. case 0:
  2034. {
  2035. ShowTime[id]= 2
  2036. ShowTimer_Menu(id)
  2037. }
  2038. case 1:
  2039. {
  2040. ShowTime[id]= 1
  2041. ShowTimer_Menu(id)
  2042. if (timer_started[id])
  2043. kz_showtime_roundtime(id, 0)
  2044. }
  2045. case 2:
  2046. {
  2047. ShowTime[id]= 0
  2048. ShowTimer_Menu(id)
  2049. if (timer_started[id])
  2050. kz_showtime_roundtime(id, 0)
  2051. }
  2052. case 3:
  2053. {
  2054. kz_menu(id)
  2055. }
  2056. }
  2057. return PLUGIN_HANDLED
  2058. }
  2059.  
  2060. public savepos_menu(id)
  2061. {
  2062. new menu = menu_create("SavePos Menu", "SavePosHandler")
  2063.  
  2064. menu_additem( menu, "Reload previous run", "1" )
  2065. menu_additem( menu, "Start a new run", "2" )
  2066.  
  2067. menu_display(id, menu, 0)
  2068. return PLUGIN_HANDLED
  2069. }
  2070.  
  2071. public SavePosHandler(id, menu, item)
  2072. {
  2073.  
  2074. switch(item)
  2075. {
  2076. case 0:
  2077. {
  2078. GoPos(id)
  2079. }
  2080. case 1:
  2081. {
  2082. Verif(id,0)
  2083. }
  2084. }
  2085. return PLUGIN_HANDLED
  2086. }
  2087.  
  2088. public top15menu(id)
  2089. {
  2090. new menu = menu_create("\rProKreedz \yTop15 \w", "top15handler")
  2091. menu_additem(menu, "\wPro 15", "1", 0)
  2092. menu_additem(menu, "\wNoob 15^n^n", "2", 0)
  2093. #if defined USE_SQL
  2094. menu_additem(menu, "Pro Records","3")
  2095. menu_additem(menu, "Players Rankings^n","4")
  2096. menu_additem(menu, "Last 10 Pro Entries", "5")
  2097. menu_additem(menu, "Maps Statistic","6")
  2098. menu_additem(menu, "Main Menu", "7")
  2099. #else
  2100. menu_additem(menu, "\wMain Menu", "3", 0)
  2101. #endif
  2102.  
  2103. menu_display(id, menu, 0);
  2104.  
  2105. return PLUGIN_HANDLED;
  2106. }
  2107.  
  2108. public top15handler(id, menu, item)
  2109. {
  2110. if(item == MENU_EXIT)
  2111. {
  2112. menu_destroy(menu)
  2113. return PLUGIN_HANDLED
  2114. }
  2115. #if defined USE_SQL
  2116. switch(item)
  2117. {
  2118. case 0:
  2119. {
  2120. ProTop_show(id)
  2121. }
  2122. case 1:
  2123. {
  2124. NoobTop_show(id)
  2125. }
  2126. case 2:
  2127. {
  2128. kz_showhtml_motd(id, PRO_RECORDS, "")
  2129. }
  2130. case 3:
  2131. {
  2132. kz_showhtml_motd(id, PLAYERS_RANKING, "")
  2133. }
  2134. case 4:
  2135. {
  2136. kz_showhtml_motd(id, LAST_PRO10, "")
  2137. }
  2138. case 5:
  2139. {
  2140. kz_showhtml_motd(id, MAPS_STATISTIC, "")
  2141. }
  2142. case 6:
  2143. {
  2144. kz_menu(id)
  2145. }
  2146. }
  2147. #else
  2148. switch(item)
  2149. {
  2150. case 0:
  2151. {
  2152. ProTop_show(id)
  2153. }
  2154. case 1:
  2155. {
  2156. NoobTop_show(id)
  2157. }
  2158. case 2:
  2159. {
  2160. kz_menu(id)
  2161. }
  2162. }
  2163. #endif
  2164.  
  2165. return PLUGIN_HANDLED;
  2166. }
  2167.  
  2168. // =================================================================================================
  2169.  
  2170. //
  2171. // Timersystem
  2172. // =================================================================================================
  2173. public fwdUse(ent, id)
  2174. {
  2175. if( !ent || id > 32 )
  2176. {
  2177. return HAM_IGNORED;
  2178. }
  2179.  
  2180. if( !is_user_alive(id) )
  2181. {
  2182. return HAM_IGNORED;
  2183. }
  2184.  
  2185.  
  2186. new name[32]
  2187. get_user_name(id, name, 31)
  2188.  
  2189. new szTarget[ 32 ];
  2190. pev(ent, pev_target, szTarget, 31);
  2191. canusehook[id] = true
  2192. if( TrieKeyExists( g_tStarts, szTarget ) )
  2193. {
  2194.  
  2195. if ( get_gametime() - antihookcheat[id] < 3.0 )
  2196. {
  2197. kz_hud_message( id, "%L", id, "KZ_HOOK_PROTECTION" );
  2198. return PLUGIN_HANDLED
  2199. }
  2200.  
  2201. if(Verif(id,1))
  2202. {
  2203. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SAVEPOS_SAVED")
  2204. savepos_menu(id)
  2205. return HAM_IGNORED
  2206. }
  2207.  
  2208. if ( reset_checkpoints(id) && !timer_started[id] )
  2209. {
  2210. start_climb(id)
  2211. new wpn=get_user_weapon(id)
  2212. for(new i = 0; i < 8; i++)
  2213. if( user_has_weapon(id, other_weapons[i]) )
  2214. {
  2215. strip_user_weapons(id)
  2216. give_item(id,"weapon_knife")
  2217. give_item(id,"weapon_usp")
  2218. set_pdata_int(id, 382, 24, 5)
  2219. if(wpn==CSW_SCOUT)
  2220. {
  2221. user_has_scout[id]=true
  2222. give_item(id,"weapon_scout")
  2223. }
  2224. else
  2225. user_has_scout[id]=false
  2226. }
  2227.  
  2228. if( get_user_health(id) < 100 )
  2229. set_user_health(id, 100)
  2230.  
  2231. pev(id, pev_origin, SavedStart[id])
  2232. if(get_pcvar_num(kz_save_autostart) == 1)
  2233. AutoStart[id] = true;
  2234.  
  2235. if( !DefaultStart )
  2236. {
  2237. kz_set_start(MapName, SavedStart[id])
  2238. ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SET_START")
  2239. }
  2240.  
  2241. remove_hook(id)
  2242. }
  2243.  
  2244. }
  2245.  
  2246. if( TrieKeyExists( g_tStops, szTarget ) )
  2247. {
  2248. if( timer_started[id] )
  2249. {
  2250. if(get_user_noclip(id))
  2251. return PLUGIN_HANDLED
  2252.  
  2253. finish_climb(id)
  2254.  
  2255. /*if(get_pcvar_num(kz_hook_prize) == 1 && !canusehook[id])
  2256. {
  2257. canusehook[id] = true
  2258. ColorChat(id, GREEN, "%s^x01 %L.", prefix, id, "KZ_HOOK")
  2259. }*/
  2260. }
  2261. else
  2262. kz_hud_message(id, "%L", id, "KZ_TIMER_NOT_STARTED")
  2263.  
  2264. }
  2265. return HAM_IGNORED
  2266. }
  2267.  
  2268. public start_climb(id)
  2269. {
  2270. kz_chat(id, "%L", id, "KZ_START_CLIMB")
  2271.  
  2272. if (get_pcvar_num(kz_reload_weapons) == 1)
  2273. {
  2274. strip_user_weapons(id)
  2275. give_item(id,"weapon_knife")
  2276. give_item(id,"weapon_usp")
  2277. }
  2278.  
  2279. if (ShowTime[id] == 2)
  2280. kz_showtime_roundtime(id, 0)
  2281. set_pev(id, pev_gravity, 1.0);
  2282. set_pev(id, pev_movetype, MOVETYPE_WALK)
  2283. set_user_godmode(id, 0)
  2284. reset_checkpoints(id)
  2285. IsPaused[id] = false
  2286. timer_started[id] = true
  2287. timer_time[id] = get_gametime()
  2288. }
  2289.  
  2290. public finish_climb(id)
  2291. {
  2292. if (!is_user_alive (id))
  2293. {
  2294. return;
  2295. }
  2296.  
  2297. if ( (get_pcvar_num(kz_top15_authid) > 1) || (get_pcvar_num(kz_top15_authid) < 0) )
  2298. {
  2299. ColorChat(id, GREEN, "%s^x01 %L.", prefix, id, "KZ_TOP15_DISABLED")
  2300. return;
  2301. }
  2302.  
  2303. #if defined USE_SQL
  2304. new Float: time, wpn
  2305. time = get_gametime() - timer_time[id]
  2306. show_finish_message(id, time)
  2307. timer_started[id] = false
  2308. if (get_pcvar_num(kz_show_timer) > 0 && ShowTime[id] == 2)
  2309. kz_showtime_roundtime(id, 0)
  2310. new checkpoints=checknumbers[id]
  2311. new gocheck=gochecknumbers[id]
  2312. if(user_has_scout[id])
  2313. wpn=CSW_SCOUT
  2314. else
  2315. wpn=get_user_weapon( id )
  2316.  
  2317. new steam[32], name[32]
  2318. get_user_name(id, name, 31)
  2319. get_user_authid(id, steam, 31 )
  2320. client_cmd(0, "spk buttons/bell1")
  2321. new createinto[1001]
  2322.  
  2323. new cData[192]
  2324. cData[0] = id
  2325. formatex(cData[2], charsmax(cData)-2, "^"%f^" ^"%d^" ^"%d^" ^"%d^"", time, wpn, checkpoints ,gocheck)
  2326.  
  2327.  
  2328. if(equal(steam, "VALVE_ID_LAN") || equal(steam, "STEAM_ID_LAN") || strlen(steam) > 18)
  2329. {
  2330. if (gochecknumbers[id] == 0 && !user_has_scout[id] )
  2331. {
  2332. cData[1] = PRO_TOP
  2333. formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_pro15` WHERE mapname='%s' AND name='%s'", MapName, name)
  2334. SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
  2335. }
  2336. if (gochecknumbers[id] > 0 || user_has_scout[id] )
  2337. {
  2338. cData[1] = NUB_TOP
  2339. formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_nub15` WHERE mapname='%s' AND name='%s'", MapName, name)
  2340. SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
  2341. }
  2342. } else
  2343. {
  2344.  
  2345. if (gochecknumbers[id] == 0 && !user_has_scout[id] )
  2346. {
  2347. cData[1] = PRO_TOP
  2348. formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_pro15` WHERE mapname='%s' AND authid='%s'", MapName, steam)
  2349. SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
  2350. }
  2351. if (gochecknumbers[id] > 0 || user_has_scout[id] )
  2352. {
  2353. cData[1] = NUB_TOP
  2354. formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_nub15` WHERE mapname='%s' AND authid='%s'", MapName, steam)
  2355. SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
  2356. }
  2357. }
  2358. #else
  2359. new Float: time, authid[32]
  2360. time = get_gametime() - timer_time[id]
  2361. get_user_authid(id, authid, 31)
  2362. show_finish_message(id, time)
  2363. timer_started[id] = false
  2364. if (get_pcvar_num(kz_show_timer) > 0 && ShowTime[id] == 2)
  2365. kz_showtime_roundtime(id, 0)
  2366.  
  2367. if (gochecknumbers[id] == 0 && !user_has_scout[id] )
  2368. ProTop_update(id, time)
  2369. if (gochecknumbers[id] > 0 || user_has_scout[id] )
  2370. NoobTop_update(id, time, checknumbers[id], gochecknumbers[id])
  2371. #endif
  2372. user_has_scout[id] = false
  2373.  
  2374. }
  2375.  
  2376. public show_finish_message(id, Float:kreedztime)
  2377. {
  2378. new name[32]
  2379. new imin,isec,ims, wpn
  2380. if(user_has_scout[id])
  2381. wpn=CSW_SCOUT
  2382. else
  2383. wpn=get_user_weapon( id )
  2384. get_user_name(id, name, 31)
  2385. imin = floatround(kreedztime / 60.0, floatround_floor)
  2386. isec = floatround(kreedztime - imin * 60.0,floatround_floor)
  2387. ims = floatround( ( kreedztime - ( imin * 60.0 + isec ) ) * 100.0, floatround_floor )
  2388.  
  2389. 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])
  2390. }
  2391.  
  2392. //==========================================================
  2393. #if defined USE_SQL
  2394. public Set_QueryHandler(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
  2395. {
  2396. new id = cData[0]
  2397. new style = cData[1]
  2398. if( iFailState != TQUERY_SUCCESS )
  2399. {
  2400. log_amx("[KZ] TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
  2401. ColorChat(0, GREEN, "%s^x01 %F", prefix, LANG_PLAYER, "KZ_TOP15_SQL_ERROR")
  2402. }
  2403.  
  2404. server_print("[KZ] Server Geting Info of SQL Server")
  2405.  
  2406. new createinto[1001]
  2407. new x1[16], x2[4], x3[5], x4[5]
  2408. parse(cData[2], x1, 15, x2, 3, x3, 4, x4, 4)
  2409.  
  2410. new dia[64], steam[32], name[32], ip[15], country[3], checkpoints[32], gochecks[32]
  2411. new Float:newtime = str_to_float(x1)
  2412. new iMin, iSec, iMs, server[64]
  2413. get_pcvar_string(kz_sql_name, server, 63)
  2414. get_time("%Y%m%d%H%M%S", dia, sizeof dia - 1)
  2415. get_user_authid(id, steam, 31)
  2416. get_user_name(id, name, sizeof name - 1)
  2417. get_user_ip (id, ip, sizeof ip - 1, 1)
  2418. geoip_code2_ex( ip, country)
  2419.  
  2420. replace_all(name, 31, "\", "")
  2421. replace_all(name, 31, "`", "")
  2422. replace_all(name, 31, "'", "")
  2423.  
  2424.  
  2425. if( SQL_NumResults(hQuery) == 0 )
  2426. {
  2427. formatex(checkpoints, 31, ", '%d'", str_to_num(x3))
  2428. formatex(gochecks, 31, ", '%d'", str_to_num(x4))
  2429. 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)
  2430. SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
  2431. GetNewRank(id, style)
  2432. }
  2433. else
  2434. {
  2435. new Float:oldtime, Float:thetime
  2436. SQL_ReadResult(hQuery, 0, oldtime)
  2437.  
  2438. if(newtime < oldtime)
  2439. {
  2440. thetime = oldtime - newtime
  2441. iMin = floatround(thetime / 60.0, floatround_floor)
  2442. iSec = floatround(thetime - iMin * 60.0,floatround_floor)
  2443. iMs = floatround( ( thetime - ( iMin * 60.0 + iSec ) ) * 100.0, floatround_floor )
  2444. 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")
  2445. formatex(checkpoints, 31, ", checkpoints='%d'", str_to_num(x3))
  2446. formatex(gochecks, 31, ", gocheck='%d'", str_to_num(x4))
  2447. if(equal(steam, "VALVE_ID_LAN") || equal(steam, "STEAM_ID_LAN") || strlen(steam) > 18)
  2448. 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)
  2449. else
  2450. 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)
  2451.  
  2452. SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto )
  2453. GetNewRank(id, style)
  2454. }
  2455. else
  2456. {
  2457. thetime = newtime - oldtime
  2458. iMin = floatround(thetime / 60.0, floatround_floor)
  2459. iSec = floatround(thetime - iMin * 60.0,floatround_floor)
  2460. iMs = floatround( ( thetime - ( iMin * 60.0 + iSec ) ) * 100.0, floatround_floor )
  2461. 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")
  2462. }
  2463. }
  2464.  
  2465. return PLUGIN_CONTINUE
  2466.  
  2467. }
  2468.  
  2469. public GetNewRank_QueryHandler(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
  2470. {
  2471. new id = cData[0]
  2472. if( iFailState != TQUERY_SUCCESS )
  2473. {
  2474. return log_amx("TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
  2475. }
  2476.  
  2477. new steam[32], authid[32], namez[32], name[32], i = 0
  2478. get_user_authid(id, steam, 31)
  2479. get_user_name(id, namez, 31)
  2480.  
  2481. while( SQL_MoreResults(hQuery) )
  2482. {
  2483. i++
  2484. if(equal(steam, "VALVE_ID_LAN") || equal(steam, "STEAM_ID_LAN") || strlen(steam) > 18)
  2485. {
  2486. SQL_ReadResult(hQuery, 0, name, 31)
  2487. if( equal(name, namez) )
  2488. {
  2489. 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");
  2490. break;
  2491. }
  2492. }
  2493. else
  2494. {
  2495. SQL_ReadResult(hQuery, 0, authid, 31)
  2496. if( equal(authid, steam) )
  2497. {
  2498. 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");
  2499. break;
  2500. }
  2501. }
  2502. SQL_NextRow(hQuery)
  2503. }
  2504.  
  2505. return PLUGIN_CONTINUE
  2506. }
  2507.  
  2508. public ProTop_show(id)
  2509. {
  2510. kz_showhtml_motd(id, PRO_TOP, MapName)
  2511.  
  2512. return PLUGIN_HANDLED
  2513. }
  2514.  
  2515. public NoobTop_show(id)
  2516. {
  2517.  
  2518. kz_showhtml_motd(id, NUB_TOP, MapName)
  2519.  
  2520. return PLUGIN_HANDLED
  2521. }
  2522.  
  2523. public ProRecs_show(id)
  2524. {
  2525. new authid[32]
  2526. get_user_authid(id, authid, 31)
  2527.  
  2528. if(equal(authid, "VALVE_ID_LAN") || equal(authid, "STEAM_ID_LAN") || strlen(authid) > 18)
  2529. {
  2530. ColorChat (id, GREEN, "%s^x01 %L", prefix, id, "KZ_NO_STEAM")
  2531. return PLUGIN_HANDLED
  2532. }
  2533.  
  2534. kz_showhtml_motd(id, PRO_RECORDS, MapName)
  2535.  
  2536. return PLUGIN_HANDLED
  2537. }
  2538.  
  2539. stock kz_showhtml_motd(id, type, const map[])
  2540. {
  2541. new buffer[1001], namebuffer[64], filepath[96]
  2542. get_pcvar_string(kz_sql_files, filepath, 95)
  2543. new authid[32]
  2544. get_user_authid(id, authid, 31)
  2545.  
  2546. switch( type )
  2547. {
  2548. case PRO_TOP:
  2549. {
  2550. formatex(namebuffer, 63, "Pro 15 of %s", equal(map, "") ? "All Maps" : map)
  2551. 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)
  2552. }
  2553. case NUB_TOP:
  2554. {
  2555. formatex(namebuffer, 63, "Noob 15 of %s", equal(map, "") ? "All Maps" : map)
  2556. 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)
  2557. }
  2558. case PRO_RECORDS:
  2559. {
  2560. formatex(namebuffer, 63, "ProRecords and Rank")
  2561. 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)
  2562. }
  2563. case PLAYERS_RANKING:
  2564. {
  2565. formatex(namebuffer, 63, "Players Ranking")
  2566. 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)
  2567. }
  2568. case LAST_PRO10:
  2569. {
  2570. formatex(namebuffer, 63, "Last 10 Pro Entries")
  2571. formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/lastpro.php^"></head><body><p>LOADING...</p></body></html>", filepath)
  2572. }
  2573. case MAPS_STATISTIC:
  2574. {
  2575. formatex(namebuffer, 63, "Maps Statistic")
  2576. formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/map.php^"></head><body><p>LOADING...</p></body></html>", filepath)
  2577. }
  2578. }
  2579.  
  2580. show_motd(id, buffer, namebuffer)
  2581. }
  2582. #else
  2583. public ProTop_update(id, Float:time)
  2584. {
  2585. new authid[32], name[32], thetime[32], Float: slower, Float: faster, Float:protiempo
  2586. get_user_name(id, name, 31);
  2587. get_user_authid(id, authid, 31);
  2588. get_time(" %d/%m/%Y ", thetime, 31);
  2589. new bool:Is_in_pro15
  2590. Is_in_pro15 = false
  2591.  
  2592. for(new i = 0; i < 15; i++)
  2593. {
  2594. 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)) )
  2595. {
  2596. Is_in_pro15 = true
  2597. slower = time - Pro_Times[i]
  2598. faster = Pro_Times[i] - time
  2599. protiempo = Pro_Times[i]
  2600. }
  2601. }
  2602.  
  2603. for (new i = 0; i < 15; i++)
  2604. {
  2605. if( time < Pro_Times[i])
  2606. {
  2607. new pos = i
  2608. if ( get_pcvar_num(kz_top15_authid) == 0 )
  2609. while( !equal(Pro_Names[pos], name) && pos < 15 )
  2610. {
  2611. pos++;
  2612. }
  2613. else if ( get_pcvar_num(kz_top15_authid) == 1)
  2614. while( !equal(Pro_AuthIDS[pos], authid) && pos < 15 )
  2615. {
  2616. pos++;
  2617. }
  2618.  
  2619. for (new j = pos; j > i; j--)
  2620. {
  2621. formatex(Pro_AuthIDS[j], 31, Pro_AuthIDS[j-1]);
  2622. formatex(Pro_Names[j], 31, Pro_Names[j-1]);
  2623. formatex(Pro_Date[j], 31, Pro_Date[j-1])
  2624. Pro_Times[j] = Pro_Times[j-1];
  2625. }
  2626.  
  2627. formatex(Pro_AuthIDS[i], 31, authid);
  2628. formatex(Pro_Names[i], 31, name);
  2629. formatex(Pro_Date[i], 31, thetime)
  2630. Pro_Times[i] = time
  2631.  
  2632. save_pro15()
  2633.  
  2634. if( Is_in_pro15 )
  2635. {
  2636.  
  2637. if( time < protiempo )
  2638. {
  2639. new min, Float:sec;
  2640. min = floatround(faster, floatround_floor)/60;
  2641. sec = faster - (60*min);
  2642. ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_IMPROVE", min, sec < 10 ? "0" : "", sec);
  2643.  
  2644. if( (i + 1) == 1)
  2645. {
  2646. client_cmd(0, "spk woop");
  2647. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
  2648. }
  2649. else
  2650. {
  2651. client_cmd(0, "spk buttons/bell1");
  2652. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
  2653. }
  2654. }
  2655. }
  2656. else
  2657. {
  2658. if( (i + 1) == 1)
  2659. {
  2660. client_cmd(0, "spk woop");
  2661. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
  2662. }
  2663. else
  2664. {
  2665. client_cmd(0, "spk buttons/bell1");
  2666. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
  2667. }
  2668. }
  2669.  
  2670. return;
  2671. }
  2672.  
  2673. 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)) )
  2674. {
  2675. if( time > protiempo )
  2676. {
  2677. new min, Float:sec;
  2678. min = floatround(slower, floatround_floor)/60;
  2679. sec = slower - (60*min);
  2680. ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_SLOWER", min, sec < 10 ? "0" : "", sec);
  2681. return;
  2682. }
  2683. }
  2684.  
  2685. }
  2686. }
  2687.  
  2688. public save_pro15()
  2689. {
  2690. new profile[128]
  2691. formatex(profile, 127, "%s/pro_%s.cfg", Topdir, MapName)
  2692.  
  2693. if( file_exists(profile) )
  2694. {
  2695. delete_file(profile)
  2696. }
  2697.  
  2698. new Data[256];
  2699. new f = fopen(profile, "at")
  2700.  
  2701. for(new i = 0; i < 15; i++)
  2702. {
  2703. formatex(Data, 255, "^"%.2f^" ^"%s^" ^"%s^" ^"%s^"^n", Pro_Times[i], Pro_AuthIDS[i], Pro_Names[i], Pro_Date[i])
  2704. fputs(f, Data)
  2705. }
  2706. fclose(f);
  2707. }
  2708.  
  2709. public read_pro15()
  2710. {
  2711. new profile[128], prodata[256]
  2712. formatex(profile, 127, "%s/pro_%s.cfg", Topdir, MapName)
  2713.  
  2714. new f = fopen(profile, "rt" )
  2715. new i = 0
  2716. while( !feof(f) && i < 16)
  2717. {
  2718. fgets(f, prodata, 255)
  2719. new totime[25]
  2720. parse(prodata, totime, 24, Pro_AuthIDS[i], 31, Pro_Names[i], 31, Pro_Date[i], 31)
  2721. Pro_Times[i] = str_to_float(totime)
  2722. i++;
  2723. }
  2724. fclose(f)
  2725. }
  2726.  
  2727. //==================================================================================================
  2728.  
  2729. public NoobTop_update(id, Float:time, checkpoints, gochecks)
  2730. {
  2731. new authid[32], name[32], thetime[32], wpn, Float: slower, Float: faster, Float:noobtiempo
  2732. get_user_name(id, name, 31);
  2733. get_user_authid(id, authid, 31);
  2734. get_time(" %d/%m/%Y ", thetime, 31);
  2735. new bool:Is_in_noob15
  2736. Is_in_noob15 = false
  2737. if(user_has_scout[id])
  2738. wpn=CSW_SCOUT
  2739. else
  2740. wpn=get_user_weapon(id)
  2741.  
  2742. for(new i = 0; i < 15; i++)
  2743. {
  2744. 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)) )
  2745. {
  2746. Is_in_noob15 = true
  2747. slower = time - Noob_Tiempos[i];
  2748. faster = Noob_Tiempos[i] - time;
  2749. noobtiempo = Noob_Tiempos[i]
  2750. }
  2751. }
  2752.  
  2753. for (new i = 0; i < 15; i++)
  2754. {
  2755. if( time < Noob_Tiempos[i])
  2756. {
  2757. new pos = i
  2758.  
  2759. if ( get_pcvar_num(kz_top15_authid) == 0 )
  2760. while( !equal(Noob_Names[pos], name) && pos < 15 )
  2761. {
  2762. pos++;
  2763. }
  2764. else if ( get_pcvar_num(kz_top15_authid) == 1)
  2765. while( !equal(Noob_AuthIDS[pos], authid) && pos < 15 )
  2766. {
  2767. pos++;
  2768. }
  2769.  
  2770. for (new j = pos; j > i; j--)
  2771. {
  2772. formatex(Noob_AuthIDS[j], 31, Noob_AuthIDS[j-1])
  2773. formatex(Noob_Names[j], 31, Noob_Names[j-1])
  2774. formatex(Noob_Date[j], 31, Noob_Date[j-1])
  2775. formatex(Noob_Weapon[j], 31, Noob_Weapon[j-1])
  2776. Noob_Tiempos[j] = Noob_Tiempos[j-1]
  2777. Noob_CheckPoints[j] = Noob_CheckPoints[j-1]
  2778. Noob_GoChecks[j] = Noob_GoChecks[j-1]
  2779. }
  2780.  
  2781. formatex(Noob_AuthIDS[i], 31, authid);
  2782. formatex(Noob_Names[i], 31, name);
  2783. formatex(Noob_Date[i], 31, thetime)
  2784. formatex(Noob_Weapon[i], 31, g_weaponsnames[wpn])
  2785. Noob_Tiempos[i] = time
  2786. Noob_CheckPoints[i] = checkpoints
  2787. Noob_GoChecks[i] = gochecks
  2788.  
  2789. save_Noob15()
  2790.  
  2791. if( Is_in_noob15 )
  2792. {
  2793.  
  2794. if( time < noobtiempo )
  2795. {
  2796. new min, Float:sec;
  2797. min = floatround(faster, floatround_floor)/60;
  2798. sec = faster - (60*min);
  2799. ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_IMPROVE", min, sec < 10 ? "0" : "", sec);
  2800.  
  2801. if( (i + 1) == 1)
  2802. {
  2803. client_cmd(0, "spk woop");
  2804. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
  2805. }
  2806. else
  2807. {
  2808. client_cmd(0, "spk buttons/bell1");
  2809. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
  2810. }
  2811. }
  2812. }
  2813. else
  2814. {
  2815. if( (i + 1) == 1)
  2816. {
  2817. client_cmd(0, "spk woop");
  2818. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
  2819. }
  2820. else
  2821. {
  2822. client_cmd(0, "spk buttons/bell1");
  2823. ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
  2824. }
  2825. }
  2826. return;
  2827. }
  2828.  
  2829. 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)) )
  2830. {
  2831. if( time > noobtiempo )
  2832. {
  2833.  
  2834. new min, Float:sec;
  2835. min = floatround(slower, floatround_floor)/60;
  2836. sec = slower - (60*min);
  2837. ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_SLOWER", min, sec < 10 ? "0" : "", sec);
  2838. return;
  2839. }
  2840. }
  2841.  
  2842. }
  2843. }
  2844.  
  2845. public save_Noob15()
  2846. {
  2847. new profile[128]
  2848. formatex(profile, 127, "%s/Noob_%s.cfg", Topdir, MapName)
  2849.  
  2850. if( file_exists(profile) )
  2851. {
  2852. delete_file(profile)
  2853. }
  2854.  
  2855. new Data[256];
  2856. new f = fopen(profile, "at")
  2857.  
  2858. for(new i = 0; i < 15; i++)
  2859. {
  2860. 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])
  2861. fputs(f, Data)
  2862. }
  2863. fclose(f);
  2864. }
  2865.  
  2866. public read_Noob15()
  2867. {
  2868. new profile[128], prodata[256]
  2869. formatex(profile, 127, "%s/Noob_%s.cfg", Topdir, MapName)
  2870.  
  2871. new f = fopen(profile, "rt" )
  2872. new i = 0
  2873. while( !feof(f) && i < 16)
  2874. {
  2875. fgets(f, prodata, 255)
  2876. new totime[25], checks[5], gochecks[5]
  2877. parse(prodata, totime, 24, Noob_AuthIDS[i], 31, Noob_Names[i], 31, checks, 4, gochecks, 4, Noob_Date[i], 31, Noob_Weapon[i], 31)
  2878. Noob_Tiempos[i] = str_to_float(totime)
  2879. Noob_CheckPoints[i] = str_to_num(checks)
  2880. Noob_GoChecks[i] = str_to_num(gochecks)
  2881. i++;
  2882. }
  2883. fclose(f)
  2884. }
  2885.  
  2886. public ProTop_show(id)
  2887. {
  2888. new buffer[2048], len, name[32]
  2889.  
  2890. 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;}")
  2891. //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 ")
  2892. 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 >" )
  2893. len += formatex(buffer[len], 2047-len, "<thead><tr height=40px ><th width=80% colspan=4>Pro Top - %s</thead>", MapName)
  2894. //
  2895. for (new i = 0; i < 10; i++)
  2896. {
  2897. name = Pro_Names[i]
  2898.  
  2899. if( Pro_Times[i] > 9999999.0 )
  2900. {
  2901. //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), "", "", "")
  2902. //len += formatex(buffer[len], 2047-len, "" )
  2903. }
  2904.  
  2905. else
  2906. {
  2907. new minutos, Float:segundos
  2908. minutos = floatround(Pro_Times[i], floatround_floor)/60
  2909. segundos = Pro_Times[i] - (60*minutos)
  2910.  
  2911. //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])
  2912. 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])
  2913.  
  2914. }
  2915. }
  2916.  
  2917. len += formatex(buffer[len], 2047-len, "</table></body>")
  2918. //len += formatex(buffer[len], 2047-len, "<Center><b><BR>Plugin created by nucLeaR")
  2919.  
  2920. show_motd(id, buffer, "Pro10 Climbers")
  2921.  
  2922. return PLUGIN_HANDLED
  2923. }
  2924.  
  2925. public NoobTop_show(id)
  2926. {
  2927. new buffer[2048], name[32], len
  2928.  
  2929. len = formatex(buffer, 2047, "<body bgcolor=#3399FF><table width=100%% cellpadding=2 cellspacing=0 border=0>")
  2930. 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")
  2931.  
  2932. for (new i = 0; i < 10; i++)
  2933. {
  2934. if( Noob_Tiempos[i] > 9999999.0 )
  2935. {
  2936. 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), "", "", "", "", "")
  2937. }
  2938.  
  2939. else
  2940. {
  2941. name = Noob_Names[i]
  2942. new minutos, Float:segundos
  2943. minutos = floatround(Noob_Tiempos[i], floatround_floor)/60
  2944. segundos = Noob_Tiempos[i] - (60*minutos)
  2945.  
  2946. 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])
  2947. }
  2948. }
  2949.  
  2950. len += formatex(buffer[len], 2047-len, "</table></body>")
  2951. len += formatex(buffer[len], 2047-len, "<tr><Center><b><BR>Plugin created by nucLeaR")
  2952.  
  2953. show_motd(id, buffer, "Noob10 Climbers")
  2954.  
  2955. return PLUGIN_HANDLED
  2956. }
  2957. #endif
  2958. public otvori_meni(id)
  2959. {
  2960. kz_menu(id)
  2961. return PLUGIN_HANDLED
  2962. }
  2963. // You reached the end of file
  2964. // The original plugin was made by p4ddY
  2965. // This plugin was edited by nucLeaR
  2966. // Version 2.31
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement