Advertisement
Guest User

Untitled

a guest
Feb 25th, 2021
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.41 KB | None | 0 0
  1. # FORMATTING
  2.  
  3. function format1(numb: object) :: text:
  4. if "%{_numb}%" contains ".":
  5. set {_s::*} to split "%{_numb}%" at "."
  6. set {_numb} to "%addComma({_s::1})%.%last 2 characters of {_s::2}%"
  7. return "%{_numb}%"
  8. else:
  9. set {_numb} to addComma("%{_numb}%")
  10. return "%{_numb} ? 0%"
  11.  
  12. function addComma(partialNumb: string) :: text:
  13. if length of {_partialNumb} > 3:
  14. return "%addComma(first length of {_partialNumb} - 3 characters of {_partialNumb})%,%last 3 characters of {_partialNumb}%"
  15. return {_partialNumb}
  16.  
  17. function format2(n: number) :: text:
  18. set {_data} to "e+3,99|e+2,65|e+1,42|e,21|e,21|QT,18|Q,15|T,12|B,9|M,6|k,3"
  19. loop split {_data} at "|":
  20. set {_s::*} to split loop-value at ","
  21. {_n} >= 10 ^ {_s::2} parsed as number
  22. return "%{_n} / 10 ^ {_s::2} parsed as number%%{_s::1}%"
  23. return "%{_n}%"
  24.  
  25. # ADMIN COMMAND
  26.  
  27. command /eco [<text>] [<offlineplayer>] [<number>]:
  28. permission: admin.money
  29. permission message: &cNo permission!
  30. trigger:
  31. if arg-3 is not set:
  32. send "&cIncorrect Ussage! /eco (give|take|set) (player) (number)"
  33. else:
  34. if arg-1 is "give":
  35. add arg-3 to {balance::%arg-2's uuid%}
  36. send "&c&l[MONEY] &7You have added &c$%format1(arg-3)% &7to &c%arg-2%&c's &7balance."
  37. else if arg-1 is "take":
  38. subtract arg-3 from {balance::%arg-2's uuid%}
  39. send "&c&l[MONEY] &7You have taken &c$%format1(arg-3)% &7from &c%arg-2%&c's &7balance."
  40. else if arg-1 is "set":
  41. set {balance::%arg-2's uuid%} to arg-3
  42. send "&c&l[MONEY] &7You have set &c%arg-2%&c's &7balance to &c$%format1(arg-3)%&7."
  43.  
  44. on tab complete of "/eco":
  45. set tab completions for position 1 to "give", "take", and "set"
  46. set tab completions for position 2 to all players
  47. set tab completions for position 3 to 1, 10, 100, 1000, and 10000
  48.  
  49. # BALANCE TOP
  50.  
  51. command /baltop [<integer>]:
  52. aliases: balancetop, btop
  53. trigger:
  54. if arg-1 is not set:
  55. baltop(player, 1)
  56. else:
  57. baltop(player, arg-1)
  58.  
  59. function baltop(p: player, page: integer):
  60. set {_d} to {_page}
  61. subtract 1 from {_d}
  62. set {_min} to 9 * {_d}
  63. add 1 to {_min}
  64. set {_cap} to {_min}
  65. add 9 to {_cap}
  66. loop {balance::*}:
  67. add 1 to {_size}
  68. if {_low.to.high.list::%loop-value%} is not set:
  69. set {_low.to.high.list::%loop-value%} to loop-index
  70. else:
  71. set {_n} to 0
  72. loop {_size} times:
  73. set {_n} to {_n}+1
  74. {_low.to.high.list::%loop-value-1%.%{_n}%} is not set
  75. set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index
  76. stop loop
  77. wait 1 tick
  78. set {_n} to size of {_low.to.high.list::*}
  79. loop {_low.to.high.list::*}:
  80. set {_high.to.low.list::%{_n}%} to loop-value
  81. set {_n} to {_n}-1
  82. wait 1 tick
  83. set {_i} to 0
  84. loop {_low.to.high.list::*}:
  85. add 1 to {_tn}
  86. set {_max} to ceil({_tn}/9)
  87. loop {balance::*}:
  88. add loop-value to {_servertotal}
  89. if {_tn} >= {_min}:
  90. send "&cBalance Top - Page &8[&7%{_page}%&8/&7%{_max}%&8]" to {_p}
  91. send "&cServer Total: &7$%format1({_servertotal})%" to {_p}
  92. send "" to {_p}
  93. else:
  94. send "&cInvalid chapter." to {_p}
  95. loop {_high.to.low.list::*}:
  96. add 1 to {_topnumber}
  97. set {_player} to "%loop-value%" parsed as offlineplayer
  98. if {_topnumber} >= {_min}:
  99. if {_topnumber} < {_cap}:
  100. send "&c%{_topnumber}% &f%{_player}% &c- $%format1({balance::%loop-value%})%" to {_p}
  101. add 1 to {_i}
  102.  
  103. # BALANCE CHECK
  104.  
  105. on tab complete of "/balance" or "/bal":
  106. set tab completions for position 2 to all players
  107.  
  108. command /balance [<offlineplayer>]:
  109. trigger:
  110. if arg-1 is not set:
  111. send "&7Your balance: &c$%format1({balance::%player's uuid%})%"
  112. else:
  113. if {joined::%arg-1's uuid%} is true:
  114. send "&7%arg-1%&7's balance: &c$%format1({balance::%arg-1's uuid%})%"
  115. else:
  116. send "&cThat player has not joined before."
  117.  
  118. command /bal [<offlineplayer>]:
  119. trigger:
  120. if arg-1 is not set:
  121. send "&7Your balance: &c$%format1({balance::%player's uuid%})%"
  122. else:
  123. if {joined::%arg-1's uuid%} is true:
  124. send "&7%arg-1%&7's balance: &c$%format1({balance::%arg-1's uuid%})%"
  125. else:
  126. send "&cThat player has not joined before."
  127.  
  128. # OTHER
  129.  
  130. on join:
  131. if {balance::%player's uuid%} is not set:
  132. set {balance::%player's uuid%} to 0
  133.  
  134. on join:
  135. if {joined::%player's uuid%} is not set:
  136. set {joined::%player's uuid%} to true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement