hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.03.28. 11:05



Jelenlévő felhasználók

Jelenleg 257 felhasználó van jelen :: 0 regisztrált, 0 rejtett és 257 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: nincs regisztrált felhasználó az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 2 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: kz top15 local name
HozzászólásElküldve: 2015.12.01. 08:06 
Offline
Nagyúr
Avatar

Csatlakozott: 2013.09.14. 08:21
Hozzászólások: 547
Megköszönt másnak: 95 alkalommal
Megköszönték neki: 71 alkalommal
Üdv. Akinek lessz ideje megköszönném! :)
SMA Forráskód: [ Mindet kijelol ]
  1. /*==================================================================================================
  2.  
  3. ==================================
  4. = Kz-Arg Mod By ReymonARG =
  5. ==================================
  6.  
  7.  
  8. = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  9. Copyright © 2008, ReymonARG
  10. This file is provided as is (no warranties)
  11.  
  12. Kz-Arg Mod is free software;
  13. you can redistribute it and/or modify it under the terms of the
  14. GNU General Public License as published by the Free Software Foundation.
  15.  
  16. This program is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. GNU General Public License for more details.
  20.  
  21. You should have received a copy of the GNU General Public License
  22. along with Kz-Arg Mod; if not, write to the
  23. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  24. Boston, MA 02111-1307, USA.
  25.  
  26. = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  27.  
  28. // Creadits
  29. * Teame06
  30. * Kz-Arg Server
  31. * KzM Servers that I get the Model of de PHP for Top15:D
  32. * Xtreme-Jumps.eu
  33. * All persons that help in AMX Mod X > Scripting
  34. arkshine, Emp`, danielkza, anakin_cstrike, Exolent[jNr], connorr,
  35. |PJ| Shorty, stupok, SchlumPF, etc..
  36.  
  37.  
  38. // Friends <!-- s:D --><img src=\"{SMILIES_PATH}/icon_e_biggrin.gif\" alt=\":D\" title=\"nagyon boldog\" /><!-- s:D -->
  39. * Ckx ( Argentina ) Kz Player
  40. * ChaosAD ( Argentina ) Kz Player
  41. * Kunqui ( Argentina ) Kz Player
  42. * RTK ( Argentina ) Kz Player
  43. * BLT ( Argentina ) Kz Player
  44. * Juann ( Argentina ) Scripter
  45. * Juanchox ( ? ) Kz Player
  46. * Pajaro^ ( Argentina ) Kz Player
  47. * Limado ( Argentina ) Kz Player
  48. * Pepo ( Argentina ) Kz Player
  49. * Kuliaa ( Argentina ) Kz Player
  50. * Mucholote ( Ecuador ) Kz Player
  51. * Creative SXJ ( Spain ) Request me the Plugin, So I did <!-- s:D --><img src=\"{SMILIES_PATH}/icon_e_biggrin.gif\" alt=\":D\" title=\"nagyon boldog\" /><!-- s:D -->
  52. ===============================================================================R=E=Y=M=O=N==A=R=G=*/
  53. #include <amxmodx>
  54. #include <geoip>
  55. #include <kzarg>
  56.  
  57. #define TOP_VERSION "1.0"
  58.  
  59. new const KZ_TOP15_DIR[] = "addons/amxmodx/configs/kz/top15"
  60.  
  61. new g_saytext
  62. new g_maxplayers
  63. new g_item
  64.  
  65. new Float:Pro_Tiempos[24]
  66. new Pro_AuthIDS[24][32]
  67. new Pro_Names[24][32]
  68. new Pro_Weapons[24][32]
  69. new Pro_Date[24][32]
  70. new Pro_Country[24][3]
  71.  
  72. new Float:Nub_Tiempos[24]
  73. new Nub_AuthIDS[24][32]
  74. new Nub_Names[24][32]
  75. new Nub_Weapons[24][32]
  76. new Nub_Date[24][32]
  77. new Nub_Country[24][3]
  78. new Nub_GoChecks[24]
  79.  
  80. //==================================================================================================
  81.  
  82. new const g_weaponsnames[][] =
  83. {
  84. "", // NULL
  85. "p228", "shield", "scout", "hegrenade", "xm1014", "c4",
  86. "mac10", "aug", "smokegrenade", "elite", "fiveseven",
  87. "ump45", "sg550", "galil", "famas", "usp", "glock18",
  88. "awp", "mp5navy", "m249", "m3", "m4a1", "tmp", "g3sg1",
  89. "flashbang", "deagle", "sg552", "ak47", "knife", "p90"
  90. };
  91.  
  92. //==================================================================================================
  93.  
  94. public plugin_init()
  95. {
  96. register_plugin("Kz-Arg Local Top15", TOP_VERSION, "ReymonARG");
  97.  
  98. kz_register_saycmd("top15", "top15menu", -1, "")
  99. kz_register_saycmd("pro15", "showpro15", -1, "")
  100. kz_register_saycmd("nub15", "shownub15", -1, "")
  101.  
  102. g_item = kz_mainmenu_item_register("Top15", "")
  103.  
  104. g_saytext = get_user_msgid("SayText")
  105. g_maxplayers = get_maxplayers()
  106. }
  107.  
  108. //==================================================================================================
  109.  
  110. public plugin_precache()
  111. {
  112. if( !dir_exists(KZ_TOP15_DIR) )
  113. mkdir(KZ_TOP15_DIR);
  114.  
  115. }
  116.  
  117. public plugin_cfg()
  118. {
  119. for (new i = 0 ; i < 15; ++i)
  120. {
  121. Pro_Tiempos[i] = 999999999.00000;
  122. Nub_Tiempos[i] = 999999999.00000;
  123. }
  124. read_pro15()
  125. read_nub15()
  126. }
  127.  
  128. //==================================================================================================
  129.  
  130. public kz_finishclimb(id, Float:tiempo, checkpoints, gochecks, weapon)
  131. {
  132. if( gochecks == 0 && (weapon == CSW_USP || weapon == CSW_KNIFE) )
  133. {
  134. set_sql_pro15(id, tiempo, weapon)
  135. }
  136. else if( weapon == CSW_USP || weapon == CSW_KNIFE || weapon == CSW_SCOUT )
  137. {
  138. set_sql_nub15(id, tiempo, gochecks, weapon)
  139. }
  140. else
  141. {
  142. //Others Weapons Tops
  143. }
  144. }
  145.  
  146. public set_sql_pro15(id, Float:tiempo, weapon)
  147. {
  148. new authid[32], name[32], nombrearma[32], ip[32], pais[3], horario[32];
  149. get_user_name(id, name, 31);
  150. get_user_authid(id, authid, 31);
  151. get_time(" %m/%d/%Y ", horario, 31);
  152. get_user_ip(id, ip, 31);
  153. geoip_code2(ip, pais);
  154. formatex(nombrearma, 31, g_weaponsnames[weapon])
  155. new bool:Is_in_pro15
  156. Is_in_pro15 = false
  157.  
  158. for(new i = 0; i < 15; i++)
  159. {
  160. if( equali(Pro_Names[i], name) )
  161. {
  162. Is_in_pro15 = true
  163. }
  164. }
  165.  
  166. for (new i = 0; i < 15; i++)
  167. {
  168. new Float:mejorar = tiempo - Pro_Tiempos[i];
  169. new Float:mejoro = Pro_Tiempos[i] - tiempo;
  170. new Float:protiempo = Pro_Tiempos[i]
  171.  
  172. if( tiempo < Pro_Tiempos[i])
  173. {
  174. new pos = i
  175.  
  176. while( !equal(Pro_Names[pos], name) && pos < 15 )
  177. {
  178. pos++;
  179. }
  180.  
  181. for (new j = pos; j > i; j--)
  182. {
  183. formatex(Pro_AuthIDS[j], 31, Pro_AuthIDS[j-1]);
  184. formatex(Pro_Names[j], 31, Pro_Names[j-1]);
  185. formatex(Pro_Weapons[j], 31, Pro_Weapons[j-1])
  186. formatex(Pro_Date[j], 31, Pro_Date[j-1])
  187. formatex(Pro_Country[j], 3, Pro_Country[j-1])
  188. Pro_Tiempos[j] = Pro_Tiempos[j-1];
  189. }
  190.  
  191. formatex(Pro_AuthIDS[i], 31, authid);
  192. formatex(Pro_Names[i], 31, name);
  193. formatex(Pro_Weapons[i], 31, nombrearma)
  194. formatex(Pro_Date[i], 31, horario)
  195. formatex(Pro_Country[i], 3, pais)
  196. Pro_Tiempos[i] = tiempo
  197.  
  198. //No olvidarse !! Aca poner para que lo Grabe <!-- s:D --><img src=\"{SMILIES_PATH}/icon_e_biggrin.gif\" alt=\":D\" title=\"nagyon boldog\" /><!-- s:D -->
  199. save_pro15()
  200.  
  201. if( Is_in_pro15 )
  202. {
  203.  
  204. if( tiempo < protiempo )
  205. {
  206. new minutos, Float:segundos;
  207. minutos = floatround(mejoro, floatround_floor)/60;
  208. segundos = mejoro - (60*minutos);
  209. kz_reymon_print(0, "^x03%s^x04 improved his time %02d:%s%.4f", name, minutos, segundos < 10 ? "0" : "", segundos);
  210.  
  211. if( (i + 1) == 1)
  212. {
  213. client_cmd(0, "spk woop");
  214. kz_reymon_print(0, "CONGRATULATIONS^x03 %s^x04 is the new Leet in Pro15", name);
  215. }
  216. else
  217. {
  218. kz_reymon_print(0, "^x03%s^x04 new rank in Pro15 is [%i]", name, (i+1));
  219. }
  220. }
  221. }
  222. else
  223. {
  224. if( (i + 1) == 1)
  225. {
  226. client_cmd(0, "spk woop");
  227. kz_reymon_print(0, "CONGRATULATIONS^x03 %s^x04 is the new Leet in Pro15", name);
  228. }
  229. else
  230. {
  231. kz_reymon_print(0, "^x03%s^x04 new rank in Pro15 is [%i]", name, (i+1));
  232. }
  233. }
  234.  
  235. return;
  236. }
  237.  
  238. if( equali(Pro_Names[i], name) )
  239. {
  240. if( tiempo > protiempo )
  241. {
  242. new minutos, Float:segundos;
  243. minutos = floatround(mejorar, floatround_floor)/60;
  244. segundos = mejorar - (60*minutos);
  245. kz_reymon_print(0, "^x03%s^x04 fail his better time by %02d:%s%.5f", name, minutos, segundos < 10 ? "0" : "", segundos);
  246. return;
  247. }
  248. }
  249. }
  250. }
  251.  
  252. public save_pro15()
  253. {
  254. new mapname[33], profile[128]
  255. get_mapname(mapname, 32)
  256. formatex(profile, 127, "%s/pro_%s.cfg", KZ_TOP15_DIR, mapname)
  257.  
  258. if( file_exists(profile) )
  259. {
  260. delete_file(profile)
  261. }
  262.  
  263. new Data[256];
  264. new f = fopen(profile, "at")
  265.  
  266. for(new i = 0; i < 15; i++)
  267. {
  268. formatex(Data, 255, "^"%.5f^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^"^n", Pro_Tiempos[i], Pro_AuthIDS[i], Pro_Names[i], Pro_Weapons[i], Pro_Date[i], Pro_Country[i])
  269. fputs(f, Data)
  270. }
  271. fclose(f);
  272. }
  273.  
  274. public read_pro15()
  275. {
  276. new mapname[33], profile[128], prodata[256]
  277. get_mapname(mapname, 32)
  278. formatex(profile, 127, "%s/pro_%s.cfg", KZ_TOP15_DIR, mapname)
  279.  
  280. new f = fopen(profile, "rt" )
  281. new i = 0
  282. while( !feof(f) && i < 16)
  283. {
  284. fgets(f, prodata, 255)
  285. new totime[25]
  286. parse(prodata, totime, 24, Pro_AuthIDS[i], 31, Pro_Names[i], 31, Pro_Weapons[i], 31, Pro_Date[i], 31, Pro_Country[i], 3)
  287. Pro_Tiempos[i] = str_to_float(totime)
  288. i++;
  289. }
  290. fclose(f)
  291. }
  292.  
  293. //==================================================================================================
  294.  
  295. public set_sql_nub15(id, Float:tiempo, gochecks, weapon)
  296. {
  297. new authid[32], name[32], nombrearma[32], ip[32], pais[3], horario[32];
  298. get_user_name(id, name, 31);
  299. get_user_authid(id, authid, 31);
  300. get_time(" %m/%d/%Y ", horario, 31);
  301. get_user_ip(id, ip, 31);
  302. geoip_code2(ip, pais);
  303. formatex(nombrearma, 31, g_weaponsnames[weapon])
  304. new bool:Is_in_pro15
  305. Is_in_pro15 = false
  306.  
  307. for(new i = 0; i < 15; i++)
  308. {
  309. if( equali(Nub_Names[i], name) )
  310. {
  311. Is_in_pro15 = true
  312. }
  313. }
  314.  
  315. for (new i = 0; i < 15; i++)
  316. {
  317. new Float:mejorar = tiempo - Nub_Tiempos[i];
  318. new Float:mejoro = Nub_Tiempos[i] - tiempo;
  319. new Float:protiempo = Nub_Tiempos[i]
  320.  
  321. if( tiempo < Nub_Tiempos[i])
  322. {
  323. new pos = i
  324.  
  325. while( !equal(Nub_Names[pos], name) && pos < 15 )
  326. {
  327. pos++;
  328. }
  329.  
  330. for (new j = pos; j > i; j--)
  331. {
  332. formatex(Nub_AuthIDS[j], 31, Nub_AuthIDS[j-1]);
  333. formatex(Nub_Names[j], 31, Nub_Names[j-1]);
  334. formatex(Nub_Weapons[j], 31, Nub_Weapons[j-1])
  335. formatex(Nub_Date[j], 31, Nub_Date[j-1])
  336. formatex(Nub_Country[j], 3, Nub_Country[j-1])
  337. Nub_Tiempos[j] = Nub_Tiempos[j-1]
  338. Nub_GoChecks[j] = Nub_GoChecks[j-1]
  339. }
  340.  
  341. formatex(Nub_AuthIDS[i], 31, authid);
  342. formatex(Nub_Names[i], 31, name);
  343. formatex(Nub_Weapons[i], 31, nombrearma)
  344. formatex(Nub_Date[i], 31, horario)
  345. formatex(Nub_Country[i], 3, pais)
  346. Nub_Tiempos[i] = tiempo
  347. Nub_GoChecks[i] = gochecks
  348.  
  349. //No olvidarse !! Aca poner para que lo Grabe <!-- s:D --><img src=\"{SMILIES_PATH}/icon_e_biggrin.gif\" alt=\":D\" title=\"nagyon boldog\" /><!-- s:D -->
  350. save_nub15()
  351.  
  352. if( Is_in_pro15 )
  353. {
  354.  
  355. if( tiempo < protiempo )
  356. {
  357. new minutos, Float:segundos;
  358. minutos = floatround(mejoro, floatround_floor)/60;
  359. segundos = mejoro - (60*minutos);
  360. kz_reymon_print(0, "^x03%s^x04 improved his time %02d:%s%.4f", name, minutos, segundos < 10 ? "0" : "", segundos);
  361.  
  362. if( (i + 1) == 1)
  363. {
  364. client_cmd(0, "spk woop");
  365. kz_reymon_print(0, "CONGRATULATIONS^x03 %s^x04 is the new Leet in Nub15", name);
  366. }
  367. else
  368. {
  369. kz_reymon_print(0, "^x03%s^x04 new rank in Nub15 is [%i]", name, (i+1));
  370. }
  371. }
  372. }
  373. else
  374. {
  375. if( (i + 1) == 1)
  376. {
  377. client_cmd(0, "spk woop");
  378. kz_reymon_print(0, "CONGRATULATIONS^x03 %s^x04 is the new Leet in Nub15", name);
  379. }
  380. else
  381. {
  382. kz_reymon_print(0, "^x03%s^x04 new rank in Nub15 is [%i]", name, (i+1));
  383. }
  384. }
  385.  
  386. return;
  387. }
  388.  
  389. if( equali(Nub_Names[i], name) )
  390. {
  391. if( tiempo > protiempo )
  392. {
  393. new minutos, Float:segundos;
  394. minutos = floatround(mejorar, floatround_floor)/60;
  395. segundos = mejorar - (60*minutos);
  396. kz_reymon_print(0, "^x03%s^x04 fail his better time by %02d:%s%.5f", name, minutos, segundos < 10 ? "0" : "", segundos);
  397. return;
  398. }
  399. }
  400. }
  401. }
  402.  
  403. public save_nub15()
  404. {
  405. new mapname[33], profile[128]
  406. get_mapname(mapname, 32)
  407. formatex(profile, 127, "%s/nub_%s.cfg", KZ_TOP15_DIR, mapname)
  408.  
  409. if( file_exists(profile) )
  410. {
  411. delete_file(profile)
  412. }
  413.  
  414. new Data[256];
  415. new f = fopen(profile, "at")
  416.  
  417. for(new i = 0; i < 15; i++)
  418. {
  419. formatex(Data, 255, "^"%.5f^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%i^"^n", Nub_Tiempos[i], Nub_AuthIDS[i], Nub_Names[i], Nub_Weapons[i], Nub_Date[i], Nub_Country[i], Nub_GoChecks[i])
  420. fputs(f, Data)
  421. }
  422. fclose(f);
  423. }
  424.  
  425. public read_nub15()
  426. {
  427. new mapname[33], profile[128], prodata[256]
  428. get_mapname(mapname, 32)
  429. formatex(profile, 127, "%s/nub_%s.cfg", KZ_TOP15_DIR, mapname)
  430.  
  431. new f = fopen(profile, "rt" )
  432. new i = 0
  433. while( !feof(f) && i < 16)
  434. {
  435. fgets(f, prodata, 255)
  436. new totime[25], checks[5]
  437. parse(prodata, totime, 24, Nub_AuthIDS[i], 31, Nub_Names[i], 31, Nub_Weapons[i], 31, Nub_Date[i], 31, Nub_Country[i], 3, checks, 4)
  438. Nub_Tiempos[i] = str_to_float(totime)
  439. Nub_GoChecks[i] = str_to_num(checks)
  440. i++;
  441. }
  442. fclose(f)
  443. }
  444.  
  445.  
  446. //==================================================================================================
  447.  
  448. public kz_itemmainmenu(id, item, page)
  449. {
  450. if( item == g_item )
  451. top15menu(id)
  452. }
  453.  
  454. public top15menu(id)
  455. {
  456. new menu = menu_create("\r[Kz-Arg] \yTop15 \w", "top15funccions");
  457. menu_additem(menu, "\wPro15", "1", 0);
  458. menu_additem(menu, "\wNub15", "2", 0);
  459.  
  460. menu_display(id, menu, 0);
  461.  
  462. return PLUGIN_HANDLED;
  463. }
  464.  
  465. public top15funccions(id, menu, item)
  466. {
  467. if(item == MENU_EXIT)
  468. {
  469. return PLUGIN_HANDLED;
  470. }
  471.  
  472. new data[6], iName[64]
  473. new iaccess, callback;
  474.  
  475. menu_item_getinfo(menu, item, iaccess, data,5, iName, 63, callback);
  476.  
  477. new key = str_to_num(data);
  478.  
  479. switch(key)
  480. {
  481. case 1:
  482. {
  483. showpro15(id);
  484. }
  485. case 2:
  486. {
  487. shownub15(id);
  488. }
  489. }
  490.  
  491. return PLUGIN_HANDLED;
  492. }
  493.  
  494. public showpro15(id)
  495. {
  496. new buffer[2048], name[32]
  497.  
  498. new len = formatex(buffer, 2047, "<body bgcolor=#94AEC6><table width=100%% cellpadding=2 cellspacing=0 border=0>")
  499. len += formatex(buffer[len], 2047-len, "<tr align=center bgcolor=#52697B><th width=5%%> # <th width=30%% align=left> Player <th width=25%%> Time <th width=20%%> Weapon ")
  500.  
  501. for (new i = 0; i < 15; i++)
  502. {
  503. name = Pro_Names[i]
  504.  
  505. if( Pro_Tiempos[i] > 9999999.0 )
  506. {
  507. len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#A4BED6", (i+1), "", "", "")
  508. }
  509. else
  510. {
  511. new minutos, Float:segundos
  512. minutos = floatround(Pro_Tiempos[i], floatround_floor)/60
  513. segundos = Pro_Tiempos[i] - (60*minutos)
  514.  
  515. while (containi(name, "<") != -1)
  516. replace(name, 63, "<", "&lt;")
  517. while (containi(name, ">") != -1)
  518. replace(name, 63, ">", "&gt;")
  519. len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %02d:%s%.5f <td> %s", ((i%2)==0) ? "" : " bgcolor=#A4BED6", (i+1), Pro_Names[i], minutos, segundos < 10 ? "0" : "", segundos, Pro_Weapons[i])
  520. }
  521. }
  522.  
  523. len += formatex(buffer[len], 2047-len, "</table></body>")
  524.  
  525. show_motd(id, buffer, "Pro15 Climbers")
  526.  
  527. return PLUGIN_HANDLED
  528. }
  529.  
  530. public shownub15(id)
  531. {
  532. new buffer[2048], name[32]
  533.  
  534. new len = formatex(buffer, 2047, "<body bgcolor=#94AEC6><table width=100%% cellpadding=2 cellspacing=0 border=0>")
  535. len += formatex(buffer[len], 2047-len, "<tr align=center bgcolor=#52697B><th width=5%%> # <th width=30%% align=left> Player <th width=25%%> Time <th width=20%%> GoChecks <th width=20%%> Weapon ")
  536.  
  537. for (new i = 0; i < 15; i++)
  538. {
  539. if( Nub_Tiempos[i] > 9999999.0 )
  540. {
  541. len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#A4BED6", (i+1), "", "", "", "")
  542. }
  543. else
  544. {
  545. name = Nub_Names[i]
  546. new minutos, Float:segundos
  547. minutos = floatround(Nub_Tiempos[i], floatround_floor)/60
  548. segundos = Nub_Tiempos[i] - (60*minutos)
  549.  
  550. while (containi(name, "<") != -1)
  551. replace(name, 63, "<", "&lt;")
  552. while (containi(name, ">") != -1)
  553. replace(name, 63, ">", "&gt;")
  554. len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %02d:%s%.5f <td> %d <td> %s", ((i%2)==0) ? "" : " bgcolor=#A4BED6", (i+1), Nub_Names[i], minutos, segundos < 10 ? "0" : "", segundos, Nub_GoChecks[i], Nub_Weapons[i])
  555. }
  556. }
  557.  
  558. len += formatex(buffer[len], 2047-len, "</table></body>")
  559.  
  560. show_motd(id, buffer, "Nub15 Climbers")
  561.  
  562. return PLUGIN_HANDLED
  563. }
  564.  
  565. //==================================================================================================
  566.  
  567. stock kz_reymon_print(id, const msg[], {Float,Sql,Result,_}:...)
  568. {
  569. new message[160], final[192];
  570. final[0] = 0x04;
  571. vformat(message, 159, msg, 3);
  572. formatex(final[1], 188, "[Kz-Arg] %s", message);
  573.  
  574. if(id)
  575. {
  576. kz_print_config(id, final);
  577. }
  578. else
  579. {
  580. for( new i = 1; i <= g_maxplayers; i++)
  581. if( is_user_connected(i) )
  582. kz_print_config(i, final)
  583. }
  584. }
  585.  
  586. stock kz_print_config(id, const msg[])
  587. {
  588. message_begin(MSG_ONE_UNRELIABLE, g_saytext, _, id);
  589. write_byte(id);
  590. write_string(msg);
  591. message_end();
  592. }
  593.  
  594. stock kz_register_saycmd(const saycommand[], const function[], flags, const info[])
  595. {
  596. new temp[64];
  597. formatex(temp, 63, "say /%s", saycommand);
  598. register_clcmd(temp, function, flags, info);
  599. formatex(temp, 63, "say .%s", saycommand);
  600. register_clcmd(temp, function, flags, info);
  601. formatex(temp, 63, "say_team /%s", saycommand);
  602. register_clcmd(temp, function, flags, info);
  603. formatex(temp, 63, ".%s", saycommand);
  604. register_clcmd(temp, function, flags, info);
  605. formatex(temp, 63, "/%s", saycommand);
  606. register_clcmd(temp, function, flags, info);
  607. }

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: kz top15 local name
HozzászólásElküldve: 2015.12.27. 14:35 
Offline
Őstag
Avatar

Csatlakozott: 2015.07.27. 22:56
Hozzászólások: 1367
Megköszönt másnak: 28 alkalommal
Megköszönték neki: 351 alkalommal
(SMA tag valamiért nem akar jó lenni, így Code-ba került.)

Az ékezetek hibátlanul működnek ha pl. Notepad++ -ban "UTF8 BOM nélkül"-i módban mented el az SMA fájlt.

Kód:
/*==================================================================================================
 
            ==================================
            =     Kz-Arg Mod By ReymonARG    =
            ==================================
 
 
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
            Copyright © 2008, ReymonARG
            This file is provided as is (no warranties)
 
   Kz-Arg Mod is free software;
   you can redistribute it and/or modify it under the terms of the
   GNU General Public License as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
   along with Kz-Arg Mod; if not, write to the
   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.
 
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
 
   // Creadits
   * Teame06
   * Kz-Arg Server
   * KzM Servers that I get the Model of de PHP for Top15:D
   * Xtreme-Jumps.eu
   * All persons that help in  AMX Mod X > Scripting
      arkshine, Emp`, danielkza, anakin_cstrike, Exolent[jNr], connorr,
      |PJ| Shorty, stupok, SchlumPF, etc..
 
 
   // Friends <!-- s:D --><img src=\"{SMILIES_PATH}/icon_e_biggrin.gif\" alt=\":D\" title=\"nagyon boldog\" /><!-- s:D -->
   * Ckx          ( Argentina )      Kz Player
   * ChaosAD       ( Argentina )       Kz Player
   * Kunqui       ( Argentina )       Kz Player
   * RTK          ( Argentina )      Kz Player
   * BLT          ( Argentina )       Kz Player
   * Juann         ( Argentina )       Scripter
   * Juanchox           ( ? )       Kz Player
   * Pajaro^      ( Argentina )      Kz Player
   * Limado       ( Argentina )      Kz Player
   * Pepo          ( Argentina )      Kz Player
   * Kuliaa      ( Argentina )      Kz Player
   * Mucholote       ( Ecuador )      Kz Player
   * Creative SXJ         ( Spain )      Request me the Plugin, So I did <!-- s:D --><img src=\"{SMILIES_PATH}/icon_e_biggrin.gif\" alt=\":D\" title=\"nagyon boldog\" /><!-- s:D -->                                    
===============================================================================R=E=Y=M=O=N==A=R=G=*/
#include <amxmodx>
#include <geoip>
#include <kzarg>
 
#define TOP_VERSION "1.0"
 
new const KZ_TOP15_DIR[] = "addons/amxmodx/configs/kz/top15"
 
new g_saytext
new g_maxplayers
new g_item
 
new Float:Pro_Tiempos[24]
new Pro_AuthIDS[24][32]
new Pro_Names[24][32]
new Pro_Weapons[24][32]
new Pro_Date[24][32]
new Pro_Country[24][3]
 
new Float:Nub_Tiempos[24]
new Nub_AuthIDS[24][32]
new Nub_Names[24][32]
new Nub_Weapons[24][32]
new Nub_Date[24][32]
new Nub_Country[24][3]
new Nub_GoChecks[24]
 
//==================================================================================================
 
new const g_weaponsnames[][] =
{
   "", // NULL
   "p228", "shield", "scout", "hegrenade", "xm1014", "c4",
   "mac10", "aug", "smokegrenade", "elite", "fiveseven",
   "ump45", "sg550", "galil", "famas", "usp", "glock18",
   "awp", "mp5navy", "m249", "m3", "m4a1", "tmp", "g3sg1",
   "flashbang", "deagle", "sg552", "ak47", "knife", "p90"
};
 
//==================================================================================================
 
public plugin_init()
{
   register_plugin("Kz-Arg Local Top15", TOP_VERSION, "ReymonARG");
 
   kz_register_saycmd("top15", "top15menu", -1, "")
   kz_register_saycmd("pro15", "showpro15", -1, "")
   kz_register_saycmd("nub15", "shownub15", -1, "")
 
   g_item = kz_mainmenu_item_register("Top15", "")
 
   g_saytext = get_user_msgid("SayText")
   g_maxplayers = get_maxplayers()
}
 
//==================================================================================================
 
public plugin_precache()
{
   if( !dir_exists(KZ_TOP15_DIR) )
      mkdir(KZ_TOP15_DIR);
 
}
 
public plugin_cfg()
{
   for (new i = 0 ; i < 15; ++i)
   {
      Pro_Tiempos[i] = 999999999.00000;
      Nub_Tiempos[i] = 999999999.00000;
   }
   read_pro15()
   read_nub15()
}
 
//==================================================================================================
 
public kz_finishclimb(id, Float:tiempo, checkpoints, gochecks, weapon)
{
   if( gochecks == 0 && (weapon == CSW_USP || weapon == CSW_KNIFE) )
   {
      set_sql_pro15(id, tiempo, weapon)
   }
   else if( weapon == CSW_USP || weapon == CSW_KNIFE || weapon == CSW_SCOUT )
   {
      set_sql_nub15(id, tiempo, gochecks, weapon)
   }
   else
   {
      //Others Weapons Tops
   }
}
 
public set_sql_pro15(id, Float:tiempo, weapon)
{
   new authid[32], name[32], nombrearma[32], ip[32], pais[3], horario[32];
   get_user_name(id, name, 31);
   get_user_authid(id, authid, 31);
   get_time(" %m/%d/%Y ", horario, 31);
   get_user_ip(id, ip, 31);
   geoip_code2(ip, pais);
   formatex(nombrearma, 31, g_weaponsnames[weapon])
   new bool:Is_in_pro15
   Is_in_pro15 = false
 
   for(new i = 0; i < 15; i++)
   {
      if( equali(Pro_Names[i], name) )
      {
         Is_in_pro15 = true
      }
   }
 
   for (new i = 0; i < 15; i++)
   {
      new Float:mejorar = tiempo - Pro_Tiempos[i];
      new Float:mejoro = Pro_Tiempos[i] - tiempo;
      new Float:protiempo = Pro_Tiempos[i]
 
      if( tiempo < Pro_Tiempos[i])
      {
         new pos = i
 
         while( !equal(Pro_Names[pos], name) && pos < 15 )
         {
            pos++;
         }
 
         for (new j = pos; j > i; j--)
         {
            formatex(Pro_AuthIDS[j], 31, Pro_AuthIDS[j-1]);
            formatex(Pro_Names[j], 31, Pro_Names[j-1]);
            formatex(Pro_Weapons[j], 31, Pro_Weapons[j-1])
            formatex(Pro_Date[j], 31, Pro_Date[j-1])
            formatex(Pro_Country[j], 3, Pro_Country[j-1])
            Pro_Tiempos[j] = Pro_Tiempos[j-1];
         }
 
         formatex(Pro_AuthIDS[i], 31, authid);
         formatex(Pro_Names[i], 31, name);
         formatex(Pro_Weapons[i], 31, nombrearma)
         formatex(Pro_Date[i], 31, horario)
         formatex(Pro_Country[i], 3, pais)
         Pro_Tiempos[i] = tiempo
 
         //No olvidarse !! Aca poner para que lo Grabe <!-- s:D --><img src=\"{SMILIES_PATH}/icon_e_biggrin.gif\" alt=\":D\" title=\"nagyon boldog\" /><!-- s:D -->
         save_pro15()
 
         if( Is_in_pro15 )
         {
 
            if( tiempo < protiempo )
            {
               new minutos, Float:segundos;
               minutos = floatround(mejoro, floatround_floor)/60;
               segundos = mejoro - (60*minutos);
               kz_reymon_print(0, "^x03%s^x04 javította az idejét %02d:%s%.4f", name, minutos, segundos < 10 ? "0" : "", segundos);
 
               if( (i + 1) == 1)
               {
                  client_cmd(0, "spk woop");
                  kz_reymon_print(0, "GRATULÁLUNK^x03 %s^x04 az új vezér a Pro15 listában", name);
               }
               else
               {
                  kz_reymon_print(0, "^x03%s^x04 új rangja a Pro15 listában a(z) [%i]", name, (i+1));
               }
            }   
         }
         else
         {
            if( (i + 1) == 1)
            {
               client_cmd(0, "spk woop");
               kz_reymon_print(0, "GRATULÁLUNK^x03 %s^x04 az új vezér a Pro15 listában", name);
            }
            else
            {
               kz_reymon_print(0, "^x03%s^x04 új rangja a Pro15 listában a(z) [%i]", name, (i+1));
            }
         }
 
         return;
      }
 
      if( equali(Pro_Names[i], name) )
      {
         if( tiempo > protiempo )
         {
            new minutos, Float:segundos;
            minutos = floatround(mejorar, floatround_floor)/60;
            segundos = mejorar - (60*minutos);
            kz_reymon_print(0, "^x03%s^x04 lassabb volt az előző idejénél %02d:%s%.5f", name, minutos, segundos < 10 ? "0" : "", segundos);
            return;
         }
      }
   }
}
 
public save_pro15()
{
   new mapname[33], profile[128]
   get_mapname(mapname, 32)
   formatex(profile, 127, "%s/pro_%s.cfg", KZ_TOP15_DIR, mapname)
 
   if( file_exists(profile) )
   {
      delete_file(profile)
   }
 
   new Data[256];
   new f = fopen(profile, "at")
 
   for(new i = 0; i < 15; i++)
   {
      formatex(Data, 255, "^"%.5f^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^"^n", Pro_Tiempos[i], Pro_AuthIDS[i], Pro_Names[i], Pro_Weapons[i], Pro_Date[i], Pro_Country[i])
      fputs(f, Data)
   }
   fclose(f);
}
 
public read_pro15()
{
   new mapname[33], profile[128], prodata[256]
   get_mapname(mapname, 32)
   formatex(profile, 127, "%s/pro_%s.cfg", KZ_TOP15_DIR, mapname)
 
   new f = fopen(profile, "rt" )
   new i = 0
   while( !feof(f) && i < 16)
   {
      fgets(f, prodata, 255)
      new totime[25]
      parse(prodata, totime, 24, Pro_AuthIDS[i], 31, Pro_Names[i], 31, Pro_Weapons[i], 31, Pro_Date[i], 31, Pro_Country[i], 3)
      Pro_Tiempos[i] = str_to_float(totime)
      i++;
   }
   fclose(f)
}
 
//==================================================================================================
 
public set_sql_nub15(id, Float:tiempo, gochecks, weapon)
{
   new authid[32], name[32], nombrearma[32], ip[32], pais[3], horario[32];
   get_user_name(id, name, 31);
   get_user_authid(id, authid, 31);
   get_time(" %m/%d/%Y ", horario, 31);
   get_user_ip(id, ip, 31);
   geoip_code2(ip, pais);
   formatex(nombrearma, 31, g_weaponsnames[weapon])
   new bool:Is_in_pro15
   Is_in_pro15 = false
 
   for(new i = 0; i < 15; i++)
   {
      if( equali(Nub_Names[i], name) )
      {
         Is_in_pro15 = true
      }
   }
 
   for (new i = 0; i < 15; i++)
   {
      new Float:mejorar = tiempo - Nub_Tiempos[i];
      new Float:mejoro = Nub_Tiempos[i] - tiempo;
      new Float:protiempo = Nub_Tiempos[i]
 
      if( tiempo < Nub_Tiempos[i])
      {
         new pos = i
 
         while( !equal(Nub_Names[pos], name) && pos < 15 )
         {
            pos++;
         }
 
         for (new j = pos; j > i; j--)
         {
            formatex(Nub_AuthIDS[j], 31, Nub_AuthIDS[j-1]);
            formatex(Nub_Names[j], 31, Nub_Names[j-1]);
            formatex(Nub_Weapons[j], 31, Nub_Weapons[j-1])
            formatex(Nub_Date[j], 31, Nub_Date[j-1])
            formatex(Nub_Country[j], 3, Nub_Country[j-1])
            Nub_Tiempos[j] = Nub_Tiempos[j-1]
            Nub_GoChecks[j] = Nub_GoChecks[j-1]
         }
 
         formatex(Nub_AuthIDS[i], 31, authid);
         formatex(Nub_Names[i], 31, name);
         formatex(Nub_Weapons[i], 31, nombrearma)
         formatex(Nub_Date[i], 31, horario)
         formatex(Nub_Country[i], 3, pais)
         Nub_Tiempos[i] = tiempo
         Nub_GoChecks[i] = gochecks
 
         //No olvidarse !! Aca poner para que lo Grabe <!-- s:D --><img src=\"{SMILIES_PATH}/icon_e_biggrin.gif\" alt=\":D\" title=\"nagyon boldog\" /><!-- s:D -->
         save_nub15()
 
         if( Is_in_pro15 )
         {
 
            if( tiempo < protiempo )
            {
               new minutos, Float:segundos;
               minutos = floatround(mejoro, floatround_floor)/60;
               segundos = mejoro - (60*minutos);
               kz_reymon_print(0, "^x03%s^x04 javított az idején %02d:%s%.4f", name, minutos, segundos < 10 ? "0" : "", segundos);
 
               if( (i + 1) == 1)
               {
                  client_cmd(0, "spk woop");
                  kz_reymon_print(0, "GRATULÁLUNK^x03 %s^x04 az új vezér a Nub15 listában", name);
               }
               else
               {
                  kz_reymon_print(0, "^x03%s^x04 új rangja a Nub15 listában a(z) [%i]", name, (i+1));
               }
            }   
         }
         else
         {
            if( (i + 1) == 1)
            {
               client_cmd(0, "spk woop");
               kz_reymon_print(0, "GRATULÁLUNK^x03 %s^x04 az új vezér a Nub15 listában", name);
            }
            else
            {
               kz_reymon_print(0, "^x03%s^x04 új rangja a Nub15 listában a(z) [%i]", name, (i+1));
            }
         }
 
         return;
      }
 
      if( equali(Nub_Names[i], name) )
      {
         if( tiempo > protiempo )
         {
            new minutos, Float:segundos;
            minutos = floatround(mejorar, floatround_floor)/60;
            segundos = mejorar - (60*minutos);
            kz_reymon_print(0, "^x03%s^x04 lassabb volt az előző idejénél %02d:%s%.5f", name, minutos, segundos < 10 ? "0" : "", segundos);
            return;
         }
      }
   }
}
 
public save_nub15()
{
   new mapname[33], profile[128]
   get_mapname(mapname, 32)
   formatex(profile, 127, "%s/nub_%s.cfg", KZ_TOP15_DIR, mapname)
 
   if( file_exists(profile) )
   {
      delete_file(profile)
   }
 
   new Data[256];
   new f = fopen(profile, "at")
 
   for(new i = 0; i < 15; i++)
   {
      formatex(Data, 255, "^"%.5f^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%i^"^n", Nub_Tiempos[i], Nub_AuthIDS[i], Nub_Names[i], Nub_Weapons[i], Nub_Date[i], Nub_Country[i], Nub_GoChecks[i])
      fputs(f, Data)
   }
   fclose(f);
}
 
public read_nub15()
{
   new mapname[33], profile[128], prodata[256]
   get_mapname(mapname, 32)
   formatex(profile, 127, "%s/nub_%s.cfg", KZ_TOP15_DIR, mapname)
 
   new f = fopen(profile, "rt" )
   new i = 0
   while( !feof(f) && i < 16)
   {
      fgets(f, prodata, 255)
      new totime[25], checks[5]
      parse(prodata, totime, 24, Nub_AuthIDS[i], 31, Nub_Names[i], 31, Nub_Weapons[i], 31, Nub_Date[i], 31, Nub_Country[i], 3, checks, 4)
      Nub_Tiempos[i] = str_to_float(totime)
      Nub_GoChecks[i] = str_to_num(checks)
      i++;
   }
   fclose(f)
}
 
 
//==================================================================================================
 
public kz_itemmainmenu(id, item, page)
{
   if( item == g_item )
      top15menu(id)
}
 
public top15menu(id)
{
   new menu = menu_create("\r[Kz-Arg] \yTop15 \w", "top15funccions");
   menu_additem(menu, "\wPro15", "1", 0);
   menu_additem(menu, "\wNub15", "2", 0);
 
   menu_display(id, menu, 0);
 
   return PLUGIN_HANDLED;
}
 
public top15funccions(id, menu, item)
{
   if(item == MENU_EXIT)
   {
      return PLUGIN_HANDLED;
   }
 
   new data[6], iName[64]
   new iaccess, callback;
 
   menu_item_getinfo(menu, item, iaccess, data,5, iName, 63, callback);
 
   new key = str_to_num(data);
 
   switch(key)
   {
      case 1:
      {
         showpro15(id);
      }
      case 2:
      {
         shownub15(id);
      }
   }
 
   return PLUGIN_HANDLED;
}
 
public showpro15(id)
{      
   new buffer[2048], name[32]
 
   new len = formatex(buffer, 2047, "<body bgcolor=#94AEC6><table width=100%% cellpadding=2 cellspacing=0 border=0>")
   len += formatex(buffer[len], 2047-len, "<tr  align=center bgcolor=#52697B><th width=5%%> # <th width=30%% align=left> Játékos <th  width=25%%> Idő <th width=20%%> Fegyver ")
 
   for (new i = 0; i < 15; i++)
   {   
      name = Pro_Names[i]
 
      if( Pro_Tiempos[i] > 9999999.0 )
      {
         len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#A4BED6", (i+1), "", "", "")
      }
      else
      {
         new minutos, Float:segundos
         minutos = floatround(Pro_Tiempos[i], floatround_floor)/60
         segundos = Pro_Tiempos[i] - (60*minutos)
 
         while (containi(name, "<") != -1)
            replace(name, 63, "<", "&lt;")
         while (containi(name, ">") != -1)
            replace(name, 63, ">", "&gt;")
         len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %02d:%s%.5f <td> %s", ((i%2)==0) ? "" : " bgcolor=#A4BED6", (i+1), Pro_Names[i], minutos, segundos < 10 ? "0" : "", segundos, Pro_Weapons[i])
      }
   }
 
   len += formatex(buffer[len], 2047-len, "</table></body>")
 
   show_motd(id, buffer, "A Pro15 lista élmezőnye")
 
   return PLUGIN_HANDLED
}
 
public shownub15(id)
{
   new buffer[2048], name[32]
 
   new len = formatex(buffer, 2047, "<body bgcolor=#94AEC6><table width=100%% cellpadding=2 cellspacing=0 border=0>")
   len += formatex(buffer[len], 2047-len, "<tr  align=center bgcolor=#52697B><th width=5%%> # <th width=30%% align=left> Játékos <th  width=25%%> Idő <th width=20%%> GoChecks <th width=20%%> Fegyver ")
 
   for (new i = 0; i < 15; i++)
   {      
      if( Nub_Tiempos[i] > 9999999.0 )
      {
         len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#A4BED6", (i+1), "", "", "", "")
      }
      else
      {
         name = Nub_Names[i]
         new minutos, Float:segundos
         minutos = floatround(Nub_Tiempos[i], floatround_floor)/60
         segundos = Nub_Tiempos[i] - (60*minutos)
 
         while (containi(name, "<") != -1)
            replace(name, 63, "<", "&lt;")
         while (containi(name, ">") != -1)
            replace(name, 63, ">", "&gt;")
         len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %02d:%s%.5f <td> %d <td> %s", ((i%2)==0) ? "" : " bgcolor=#A4BED6", (i+1), Nub_Names[i], minutos, segundos < 10 ? "0" : "", segundos, Nub_GoChecks[i], Nub_Weapons[i])
      }
   }
 
   len += formatex(buffer[len], 2047-len, "</table></body>")
 
   show_motd(id, buffer, "A Nub15 lista élmezőnye")
 
   return PLUGIN_HANDLED
}
 
//==================================================================================================
 
stock kz_reymon_print(id, const msg[], {Float,Sql,Result,_}:...)
{
   new message[160], final[192];
   final[0] = 0x04;
   vformat(message, 159, msg, 3);
   formatex(final[1], 188, "[Kz-Arg] %s", message);
 
   if(id)
   {
      kz_print_config(id, final);
   }
   else
   {
      for( new i = 1; i <= g_maxplayers; i++)
         if( is_user_connected(i) )
            kz_print_config(i, final)
   }
}
 
stock kz_print_config(id, const msg[])
{
   message_begin(MSG_ONE_UNRELIABLE, g_saytext, _, id);
   write_byte(id);
   write_string(msg);
   message_end();
}
 
stock kz_register_saycmd(const saycommand[], const function[], flags, const info[])
{
   new temp[64];
   formatex(temp, 63, "say /%s", saycommand);
   register_clcmd(temp, function, flags, info);
   formatex(temp, 63, "say .%s", saycommand);
   register_clcmd(temp, function, flags, info);
   formatex(temp, 63, "say_team /%s", saycommand);
   register_clcmd(temp, function, flags, info);
   formatex(temp, 63, ".%s", saycommand);
   register_clcmd(temp, function, flags, info);
   formatex(temp, 63, "/%s", saycommand);
   register_clcmd(temp, function, flags, info);
}

Ők köszönték meg regener nek ezt a hozzászólást: elit (2015.12.27. 15:33)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 2 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 0 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole