szumielxd

Untitled

Jun 7th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.44 KB | None | 0 0
  1. on load:
  2. send "[Statystyki] Trwa proba polaczenia z serwerem bazodanowym MySQL..." to console
  3. set {_TIME.1} to unix timestamp of now #current system milliseconds
  4. execute "SELECT version()" in {STATYSTYKI.SQL} and store the result in {_TMP::*}
  5. set {_TIME.2} to unix timestamp of now #current system milliseconds
  6. set {_LOAD.TIME} to {_TIME.2} - {_TIME.1}
  7. if last database error is not set:
  8. send "[Statystyki] Proba polaczenia z serwerem bazy danych przebiegla pomyslnie." to console
  9. if {STATYSTYKI.SQL.RUN} is set:
  10. clear {STATYSTYKI.SQL.RUN}
  11. send "[Statystyki] Topka jest juz aktualizowana." to console
  12. else:
  13. send "[Statystyki] Napotkano na problemy podczas proby polaczenia z serwerem bazy danych." to console
  14. send "[Statystyki] Napotkany problem: %last database error%." to console
  15. send "[Statystyki] Topka nie bedzie juz aktualizowana." to console
  16. send "[Statystyki] Polaczenie MYSQL zawiodlo, posimy powiadomic Wlasciciela." to all ops
  17. set {STATYSTYKI.SQL.RUN} to 1
  18. send "[Statystyki] Czas proby polaczenia: %{_LOAD.TIME}%ms." to console
  19. send "[Statystyki] Czas proby polaczenia: %{_LOAD.TIME}%ms." to "szumielxd_" parsed as player
  20.  
  21. function UPDATE():
  22. if {STATYSTYKI.SQL.RUN} is set:
  23. send "[Statystyki] Tablica TOP graczy nie zostala zaaktualizowana." to console
  24. stop
  25. loop 10 times:
  26. execute "SELECT PLAYER_NAME FROM `tbl_options_players_stats` WHERE STAT_TYPE='KILLS' ORDER BY `tbl_options_players_stats`.`QUANTITY` DESC LIMIT 1 OFFSET %loop-number - 1%" in {STATYSTYKI.SQL} and store the result in {_TMP0::%loop-number%::*}
  27. set {_STATYSTYKI::%loop-number%} to {_TMP0::%loop-number%::PLAYER_NAME::1}
  28. execute "SELECT UNIQUEID FROM tbl_options_players_stats WHERE PLAYER_NAME=%{_STATYSTYKI::%loop-number%}%" in {STATYSTYKI.SQL} and store the result in {_TMP1::%loop-number%::*}
  29. set {_UNIQUEID::%loop-number%} to {_TMP1::%loop-number%::UNIQUEID::1}
  30. execute "SELECT QUANTITY FROM tbl_options_players_stats WHERE UNIQUEID=%{_UNIQUEID::%loop-number%}%" in {STATYSTYKI.SQL} and store the result in {_TMP2::%loop-number%::*}
  31. execute "SELECT STAT_TYPE FROM tbl_options_players_stats WHERE UNIQUEID=%{_UNIQUEID::%loop-number%}%" in {STATYSTYKI.SQL} and store the result in {_TMP2::%loop-number%::*}
  32. set {_i} to 0
  33. loop {_TMP2::%loop-number%::STAT_TYPE::*}:
  34. add 1 to {_i}
  35. if loop-value-2 is "KILLS":
  36. set {_STATYSTYKI1::%loop-number%} to {_TMP2::%loop-number%::QUANTITY::%{_i}%}
  37. else if loop-value-2 is "DEATHS":
  38. set {_STATYSTYKI2::%loop-number%} to {_TMP2::%loop-number%::QUANTITY::%{_i}%}
  39. else if loop-value-2 is "DANAGE_NEXUSES":
  40. set {_STATYSTYKI3::%loop-number%} to {_TMP2::%loop-number%::QUANTITY::%{_i}%}
  41. else if loop-value-2 is "WINS":
  42. set {_STATYSTYKI4::%loop-number%} to {_TMP2::%loop-number%::QUANTITY::%{_i}%}
  43. if {_STATYSTYKI::%loop-number%} is not set:
  44. execute console command "npc select %26 + loop-number%"
  45. execute console command "npc rename &c&lBRAK GRACZA"
  46. else:
  47. execute console command "npc select %26 + loop-number%"
  48. execute console command "npc rename &6%{_STATYSTYKI::%loop-number%}%"
  49. if {_STATYSTYKI1::%loop-number%} is not set:
  50. execute console command "/hd setline top%loop-number% 2 &7&l» &eIlosc zabojstw: &c&lBRAK DANYCH"
  51. else:
  52. execute console command "/hd setline top%loop-number% 2 &7&l» &eIlosc zabojstw: &a&l%{_STATYSTYKI1::%loop-number%}%"
  53. if {_STATYSTYKI2::%loop-number%} is not set:
  54. execute console command "/hd setline top%loop-number% 3 &7&l» &eIlosc zgonow: &c&lBRAK DANYCH"
  55. else:
  56. execute console command "/hd setline top%loop-number% 3 &7&l» &eIlosc zgonow: &a&l%{_STATYSTYKI2::%loop-number%}%"
  57. if {_STATYSTYKI3::%loop-number%} is not set:
  58. execute console command "/hd setline top%loop-number% 4 &7&l» &eZniszczone kamienie dusz: &c&lBRAK DANYCH"
  59. else:
  60. execute console command "/hd setline top%loop-number% 4 &7&l» &eZniszczone kamienie dusz: &a&l%{_STATYSTYKI3::%loop-number%}%"
  61. if {_STATYSTYKI4::%loop-number%} is not set:
  62. execute console command "/hd setline top%loop-number% 5 &7&l» &eWygrane gry: &c&lBRAK DANYCH"
  63. else:
  64. execute console command "/hd setline top%loop-number% 5 &7&l» &eWygrane gry: &a&l%{_STATYSTYKI4::%loop-number%}%"
  65.  
  66. every 1500 seconds:
  67. UPDATE()
  68.  
  69. command /topupdate [<text>]:
  70. permission: pomocnik+
  71. permission message: [Statystyki] Nie posiadasz dostepu.
  72. trigger:
  73. send "[Statystyki] Zapytanie do serwera bazodanowego MYSQL zostalo wyslane!"
  74. UPDATE()
Advertisement
Add Comment
Please, Sign In to add comment