Advertisement
FrostedWeFall

TPS

Nov 28th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.89 KB | None | 0 0
  1. #---------------------------------
  2. #----------- TPS CHECK -----------
  3. #--------- PAR BLASKO ------------
  4. #---------------------------------
  5.  
  6. options:
  7. version: 1.2.2
  8.  
  9. on load: #Checks if the variables (server) are created
  10. if {lag.verif} is not set:
  11. set {lag.verif} to true
  12. if {lag.logs.player} is not set:
  13. set {lag.logs.player} to true
  14. if {lag.logs.server} is not set:
  15. set {lag.logs.server} to true
  16.  
  17. on join: #Checks if varibles (players) are created, and displays a message displaying server stability
  18. if {lag.verif.%player%} is not set:
  19. set {lag.verif.%player%} to true
  20. if {lag.gui.%player%} is not set:
  21. set {lag.gui.%player%} to false
  22. set {_tps} to tps
  23. message "&8&m-----------------------------------------------------"
  24. if {_tps} is between 0 and 10:
  25. message "&7The server is : &cunstable"
  26. if {_tps} is between 11 and 14:
  27. message "&7The server is : &6little unstable"
  28. if {_tps} is between 15 and 18:
  29. message "&7The server is : &estable"
  30. if {_tps} is between 19 and 20:
  31. message "&7The server is : &afluid"
  32. message "&7TPS = &a%{_tps}%"
  33. message "&8&m-----------------------------------------------------"
  34.  
  35. every 5 minutes: #Lance checks
  36. make all players execute command "/lag check"
  37. if {lag.verif} is true:
  38. set {_tps} to tps
  39. log "TPS = %{_tps}%"
  40. set {_freememory} to free memory
  41. set {_maxmemory} to max memory
  42. set {_usememory} to ({_maxmemory} - {_freememory})
  43. set {_maxmemory} to {_maxmemory}/1048576
  44. set {_freememory} to {_freememory}/1048576
  45. set {_usememory} to {_usememory}/1048576
  46. set {_maxplayer} to max players
  47. wait 1 tick
  48. log "Free memory : %{_freememory}% / %{_maxmemory}%"
  49. log "Players : %number of players% / %{_maxplayer}%"
  50. if {_tps} is between 0 and 14:
  51. broadcast "&4➤ &cThe server is unstable -> TPS = &r%{_tps}%"
  52. if {lag.logs.server} is true:
  53. create file "plugins/TPSCheck/TPS/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/rapport.txt"
  54. wf "Server Stability Report - %now%" to "plugins/TPSCheck/TPS/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/rapport.txt"
  55. wf "-----------------------------------------------" to "plugins/TPSCheck/TPS/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/rapport.txt"
  56. wf "TPS : %{_tps}%" to "plugins/TPSCheck/TPS/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/rapport.txt"
  57. wf "Free memory : %{_freememory}% MB" to "plugins/TPSCheck/TPS/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/rapport.txt"
  58. wf "Maximum memory : %{_maxmemory}% MB" to "plugins/TPSCheck/TPS/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/rapport.txt"
  59. wf "Memory usage : %{_usememory}% MB" to "plugins/TPSCheck/TPS/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/rapport.txt"
  60. wf "Number of connected players : %number of players% / %{_maxplayer}%" to "plugins/TPSCheck/TPS/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/rapport.txt"
  61. wf "" to "plugins/TPSCheck/TPS/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/rapport.txt"
  62. if {_tps} is between 0 and 10:
  63. wf "state : unstable" to "plugins/TPSCheck/TPS/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/rapport.txt"
  64. if {_tps} is between 11 and 14:
  65. wf "state : little unstable" to "plugins/TPSCheck/TPS/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/rapport.txt"
  66. if {_tps} is between 15 and 18:
  67. wf "state : stable" to "plugins/TPSCheck/TPS/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/rapport.txt"
  68. if {_tps} is between 19 and 20:
  69. wf "state : fluid" to "plugins/TPSCheck/TPS/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/rapport.txt"
  70. log "A report was create | Location : plugins/TPSCheck/TPS/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/rapport.txt"
  71. delete {_freememory}
  72. delete {_maxmemory}
  73. delete {_usememory}
  74. delete {_maxplayer}
  75.  
  76. command /lag [<text>] [<text>] [<text>]: #the main control Skript
  77. aliases: ping, lag
  78. trigger:
  79. if argument 1 is "help": #Displays commands Skript
  80. message ""
  81. message "&e&m-----------------&e⬛&6 TPSCheck - Help &e&m⬛-------------------"
  82. message ""
  83. message "&a➤ &d/tpscheck &7: Lets see your ping and TPS."
  84. message "&a➤ &d/tpscheck option &7: Displays options."
  85. if player has permission "tpscheck.admin":
  86. message ""
  87. message "&c➤ &d/tpscheck admin &7: Displays settings Skript."
  88. message "&c➤ &d/tpscheck reload &7: Can charge the Skript."
  89. message ""
  90. message "&b➤ &7For these commands, the &c/tpscheck &7 may be replaced by &c/lag &7or &c/ping&7."
  91. message ""
  92. message "&e&m-----------------------------------------------------"
  93. message ""
  94.  
  95. if argument 1 is "check": #Command used to conduct the audit every five minutes (if the player allows checks)
  96. if {lag.verif.%player%} is true:
  97. set {ping.%player%} to player's ping
  98. log "Ping de %player% (UUID = %uuid of player%) = %{ping.%player%}%ms"
  99. if {lag.logs.player} is true:
  100. create file "plugins/TPSCheck/Ping/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/%player%.txt"
  101. wf "Informations - %player% - %now%" to "plugins/TPSCheck/Ping/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/%player%.txt"
  102. wf "-------------------------------------------" to "plugins/TPSCheck/Ping/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/%player%.txt"
  103. wf "UUID = %player's UUID%" to "plugins/TPSCheck/Ping/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/%player%.txt"
  104. wf "Ping = %{ping.%player%}%" to "plugins/TPSCheck/Ping/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/%player%.txt"
  105. wf "World = %player's world%" to "plugins/TPSCheck/Ping/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/%player%.txt"
  106. wf "Position :" to "plugins/TPSCheck/Ping/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/%player%.txt"
  107. wf "X = %x-coordinate of player's location%" to "plugins/TPSCheck/Ping/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/%player%.txt"
  108. wf "Y = %y-coordinate of player's location%" to "plugins/TPSCheck/Ping/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/%player%.txt"
  109. wf "Z = %z-coordinate of player's location%" to "plugins/TPSCheck/Ping/year_%year%/month_%month%/day_%day%/hour_%hour%/minute_%minute%/%player%.txt"
  110. if {ping.%player%} is greater than or equal to 250:
  111. message "&4➤ &cYour connection is unstable -> Your ping : &r%{ping.%player%}%ms"
  112. message "&7[&cLag&7] &4➤ This check is performed every five minutes, you can disable it in the settings : &c/lag option"
  113.  
  114. if argument 1 is "option" or "options": #Displays individual options editable by all players
  115. set {ping.%player%} to player's ping
  116. set {_tps} to tps
  117. open chest with 3 rows named "&9>> &lOptions&9 <<" to player
  118. wait 2 tick
  119. format slot 0 of player with crafting table named "&6>> &lHelp&6 <<" with lore "&7Adjust settings TPSCheck||&7from this menu." to be unstealable
  120. if player has permission "tpscheck.admin":
  121. format slot 7 of player with anvil named "&rOptions Skript" to run [make player execute command "/lag admin"]
  122. format slot 8 of player with name tag named "&ractualize" to run [make player execute command "/lag option"]
  123. if {lag.gui.%player%} is true:
  124. format slot 12 of player with light green clay named "&eInterface /lag..." with lore "&7State : &aActive||&r||&7If you enable the GUI option, when you||&7execute the command &c/lag&7, a GUI opens||&7to display information such as TPS, Ping, ...||&7while if the option is disabled, the command||&7&c/lag&7 display this information in chat." to run [make player execute command "/lag option gui"]
  125. else:
  126. format slot 12 of player with red clay named "&eInterface /lag..." with lore "&7State : &cInnactif||&r||&7If you enable the GUI option, when you||&7execute the command &c/lag&7, a GUI opens||&7to display information such as TPS, Ping, ...||&7while if the option is disabled, the command||&7&c/lag&7 this information in chat." to run [make player execute command "/lag option gui"]
  127. if {lag.verif.%player%} is true:
  128. format slot 14 of player with light green clay named "&eVérification..." with lore "&7State : &aActive||&r||&7If you enable this option, a verification||&7will make all &c5&7 minutes and you||&7indicate if your connection is slow." to run [make player execute command "/lag option verif"]
  129. else:
  130. format slot 14 of player with red clay named "&eVérification..." with lore "&7State : &cInnactif||&r||&7If you enable this option, a verification||&7will make all &c5&7 minutes and you||&7indicate if your connection is slow." to run [make player execute command "/lag option verif"]
  131. format slot 17 of player with book named "&rInformation" with lore "&7TPS : &a%{_tps}%||&7Ping : &a%{ping.%player%}%" to be unstealable
  132. format slot 18 of player with paper named "&eTPSCheck :" with lore "&7Created by : &aBlasko (Akion)||&7Version : &a{@version}" to be unstealable
  133. format slot 26 of player with arrow named "&rclose" to close
  134.  
  135. if argument 2 is "gui":
  136. if {lag.gui.%player%} is false:
  137. set {lag.gui.%player%} to true
  138. message "&7[&cLag&7] &a➤ GUI &aactivated&7"
  139. play raw sound "random.orb" at player with pitch 1 volume 10
  140. make player execute command "/lag option"
  141. stop
  142. if {lag.gui.%player%} is true:
  143. set {lag.gui.%player%} to false
  144. message "&7[&cLag&7] &a➤ GUI &cdisabled&7"
  145. play raw sound "random.orb" at player with pitch 1 volume 10
  146. make player execute command "/lag option"
  147. stop
  148.  
  149. if argument 2 is "verif":
  150. if {lag.verif.%player%} is false:
  151. set {lag.verif.%player%} to true
  152. message "&7[&cLag&7] &a➤ Verification &aactivated&7"
  153. play raw sound "random.orb" at player with pitch 1 volume 10
  154. make player execute command "/lag option"
  155. stop
  156. if {lag.verif.%player%} is true:
  157. set {lag.verif.%player%} to false
  158. message "&7[&cLag&7] &a➤ Verification &cdisabled&7"
  159. play raw sound "random.orb" at player with pitch 1 volume 10
  160. make player execute command "/lag option"
  161. stop
  162.  
  163. if argument 1 is not set: #If the order is carried out without any arguments, it's the TPS and table that will appear in chat or in a GUI (according to user preferences)
  164. set {ping.%player%} to player's ping
  165. set {_tps} to tps
  166. if {lag.gui.%player%} is true:
  167. set {_maxplayer} to max players
  168. open chest with 3 rows named "&9>> &lLag&9 <<" to player
  169. wait 1 tick
  170. format slot 0 of player with crafting table named "&6>> &lHelp&6 <<" with lore "&r&7If you enable the GUI option, when you run||&r&7the command &c/lag&7, a GUI will open to display||&r&7information (TPS, Ping, etc...), while if the option is||&r&7disabled, the command &c/lag&7 view this information||&r&7chat." to be unstealable
  171. format slot 8 of player with name tag named "&ractualize" to run [make player execute command "/lag"]
  172. format slot 12 of player with light blue clay named "&eTPS : &a%{_tps}%" with lore "&7The TPS indicate whether the||&7server is overloaded.||&r||&r&a20 = &bperfect" to be unstealable
  173. format slot 13 of player with blue clay named "&ePing : &a%{ping.%player%}%" with lore "&7The table shows the time||&7response with the server." to be unstealable
  174. format slot 14 of player with player head named "&eNumber of Players : &a%number of players%&7/%{_maxplayer}%" to be unstealable
  175. format slot 17 of player with anvil named "&rOptions" to run [make player execute command "/lag option"]
  176. if player has permission "tpscheck.admin":
  177. format slot 7 of player with anvil named "&rOptions Skript" to run [make player execute command "/lag admin"]
  178. format slot 18 of player with paper named "&eTPSCheck :" with lore "&7Created by : &aBlasko (Akion)||&7Version : &a{@version}" to be unstealable
  179. format slot 26 of player with arrow named "&rClose" to close
  180. else:
  181. message "&e&m-----------------------------------------------------"
  182. if sender is player:
  183. if {ping.%player%} is between 0 and 199:
  184. message "&6Your ping : &a%{ping.%player%}%ms"
  185. if {ping.%player%} is between 200 and 349:
  186. message "&6Your ping : &e%{ping.%player%}%ms"
  187. if {ping.%player%} is between 350 and 499:
  188. message "&6Your ping : &6%{ping.%player%}%ms"
  189. if {ping.%player%} is between 500 and 999:
  190. message "&6Your ping : &c%{ping.%player%}%ms"
  191. if {ping.%player%} is greater than 1000:
  192. message "&6Your ping : &4%{ping.%player%}%ms"
  193. message "&7The table indicates the response time with the server"
  194. message "&6TPS : &a%{_tps}%"
  195. message "&7The TPS indicate if the server is overloaded, &a20 = &bperfect"
  196. message "&e%now%"
  197. message "&e&m-----------------------------------------------------"
  198.  
  199. if argument 1 is "reload": #Script can charge in case of any problems
  200. if player has permission "tpscheck.admin":
  201. wait 1 tick #Allows to make a 'button' in a GUI (without this function, the item will not stand in its place will be duplicated by the user)
  202. make player execute command "/sk reload tpscheck"
  203. else:
  204. message "&cYou do not have permission."
  205.  
  206. if argument 1 is "admin": #Displays options (server) the Skript
  207. if player has permission "tpscheck.admin":
  208. if argument 2 is not set: #Basic menu
  209. set {ping.%player%} to player's ping
  210. set {_tps} to tps
  211. open chest with 3 rows named "&c>> &lOptions&c <<" to player
  212. wait 2 tick
  213. format slot 0 of player with crafting table named "&6>> &lHelp&6 <<" with lore "&7Adjust settings TPSCheck||&7from this menu." to be unstealable
  214. format slot 8 of player with name tag named "&ractualize" to run [make player execute command "/lag admin"]
  215. format slot 7 of player with eye of ender named "&rReload Skript" to run [make player execute command "/lag reload"]
  216. format slot 12 of player with book and quill named "&eCreating logs" with lore "&7If the option is enabled, the server will create||&7logs (TPS, Ping every of players) all||&7five minutes.||&r||&8lick to access settings..." to run [make player execute command "/lag admin logs"]
  217. if {lag.verif} is true:
  218. format slot 14 of player with light green clay named "&eServer verification" with lore "&7state : &aActive||&r||&7If you enable this option, a verification||&7will make all &c5&7 minutes and you||&7indicate if the server is slow." to run [make player execute command "/lag admin verif"]
  219. else:
  220. format slot 14 of player with red clay named "&eServer verification" with lore "&7state : &cInnactif||&r||&7If you enable this option, a verification||&7will make all &c5&7 minutes and you||&7indicate if the server is slow." to run [make player execute command "/lag admin verif"]
  221. format slot 17 of player with book named "&rInformation" with lore "&7TPS : &a%{_tps}%||&7Ping : &a%{ping.%player%}%" to be unstealable
  222. format slot 18 of player with paper named "&eTPSCheck :" with lore "&7Created by : &aBlasko (akion)||&7Version : &a{@version}" to be unstealable
  223. format slot 26 of player with arrow named "&rFermer" to close
  224.  
  225. if argument 2 is "logs": #Submenu displaying the options for logs
  226. if argument 3 is not set:
  227. set {ping.%player%} to player's ping
  228. set {_tps} to tps
  229. open chest with 1 rows named "&c>> &lOption Skript&c <<" to player
  230. wait 2 tick
  231. format slot 0 of player with crafting table named "&6>> &lHelp&6 <<" with lore "&7Set the log settings||&7from this menu." to be unstealable
  232. format slot 1 of player with paper named "&eTPSCheck :" with lore "&7Created by : &aBlasko (akion)||&7Version : &a{@version}" to be unstealable
  233. if {lag.logs.player} is true:
  234. format slot 3 of player with light green clay named "&eLogs : players" with lore "&7state : &aActive||&r||&7Creating logs containing||&7information &cplayers&7 all||&7the &c5 &7minutes." to run [make player execute command "/lag admin logs player"]
  235. else:
  236. format slot 3 of player with red clay named "&eLogs : players" with lore "&7state : &cInnactif||&r||&7Creating logs containing||&7information &cplayers&7 all||&7the &c5 &7minutes." to run [make player execute command "/lag admin logs player"]
  237. if {lag.logs.server} is true:
  238. format slot 5 of player with light green clay named "&eLogs : Server" with lore "&7state : &aActive||&r||&7Creating logs containing||&7information &cserver&7 all||&7the &c5 &7minutes." to run [make player execute command "/lag admin logs server"]
  239. else:
  240. format slot 5 of player with red clay named "&eLogs : Server" with lore "&7state : &cInnactif||&r||&7Creating logs containing||&7information &cserver&7 all||&7the &c5 &7minutes." to run [make player execute command "/lag admin logs server"]
  241. format slot 7 of player with book named "&rInformations" with lore "&7TPS : &a%{_tps}%||&7Ping : &a%{ping.%player%}%||&r||&8Click to refresh..." to run [make player execute command "/lag admin logs"]
  242. format slot 8 of player with arrow named "&rback" to run [make player execute command "/lag admin"]
  243. if argument 3 is "player":
  244. if {lag.logs.player} is false:
  245. set {lag.logs.player} to true
  246. message "&7[&cLag&7] &a➤ Logs players &aactivated&7"
  247. play raw sound "random.orb" at player with pitch 1 volume 10
  248. make player execute command "/lag admin logs"
  249. stop
  250. if {lag.logs.player} is true:
  251. set {lag.logs.player} to false
  252. message "&7[&cLag&7] &a➤ Logs players &cdisabled&7"
  253. play raw sound "random.orb" at player with pitch 1 volume 10
  254. make player execute command "/lag admin logs"
  255. stop
  256. if argument 3 is "server":
  257. if {lag.logs.server} is false:
  258. set {lag.logs.server} to true
  259. message "&7[&cLag&7] &a➤ Logs server &aactivated&7"
  260. play raw sound "random.orb" at player with pitch 1 volume 10
  261. make player execute command "/lag admin logs"
  262. stop
  263. if {lag.logs.server} is true:
  264. set {lag.logs.server} to false
  265. message "&7[&cLag&7] &a➤ Logs server &cdisabled&7"
  266. play raw sound "random.orb" at player with pitch 1 volume 10
  267. make player execute command "/lag admin logs"
  268. stop
  269. else:
  270. message "Debug: error"
  271. if argument 2 is "verif":
  272. if {lag.verif} is false:
  273. set {lag.verif} to true
  274. message "&7[&cLag&7] &a➤ Server verification &aactivated&7"
  275. play raw sound "random.orb" at player with pitch 1 volume 10
  276. make player execute command "/lag admin"
  277. stop
  278. if {lag.verif} is true:
  279. set {lag.verif} to false
  280. message "&7[&cLag&7] &a➤ Server verification &cdisabled&7"
  281. play raw sound "random.orb" at player with pitch 1 volume 10
  282. make player execute command "/lag admin"
  283. stop
  284. else:
  285. message "&4➤ &cYou do not have permission."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement