Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # FORMATTING
- function format1(numb: object) :: text:
- if "%{_numb}%" contains ".":
- set {_s::*} to split "%{_numb}%" at "."
- set {_numb} to "%addComma({_s::1})%.%last 2 characters of {_s::2}%"
- return "%{_numb}%"
- else:
- set {_numb} to addComma("%{_numb}%")
- return "%{_numb} ? 0%"
- function addComma(partialNumb: string) :: text:
- if length of {_partialNumb} > 3:
- return "%addComma(first length of {_partialNumb} - 3 characters of {_partialNumb})%,%last 3 characters of {_partialNumb}%"
- return {_partialNumb}
- function format2(n: number) :: text:
- 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"
- loop split {_data} at "|":
- set {_s::*} to split loop-value at ","
- {_n} >= 10 ^ {_s::2} parsed as number
- return "%{_n} / 10 ^ {_s::2} parsed as number%%{_s::1}%"
- return "%{_n}%"
- # ADMIN COMMAND
- command /eco [<text>] [<offlineplayer>] [<number>]:
- permission: admin.money
- permission message: &cNo permission!
- trigger:
- if arg-3 is not set:
- send "&cIncorrect Ussage! /eco (give|take|set) (player) (number)"
- else:
- if arg-1 is "give":
- add arg-3 to {balance::%arg-2's uuid%}
- send "&c&l[MONEY] &7You have added &c$%format1(arg-3)% &7to &c%arg-2%&c's &7balance."
- else if arg-1 is "take":
- subtract arg-3 from {balance::%arg-2's uuid%}
- send "&c&l[MONEY] &7You have taken &c$%format1(arg-3)% &7from &c%arg-2%&c's &7balance."
- else if arg-1 is "set":
- set {balance::%arg-2's uuid%} to arg-3
- send "&c&l[MONEY] &7You have set &c%arg-2%&c's &7balance to &c$%format1(arg-3)%&7."
- on tab complete of "/eco":
- set tab completions for position 1 to "give", "take", and "set"
- set tab completions for position 2 to all players
- set tab completions for position 3 to 1, 10, 100, 1000, and 10000
- # BALANCE TOP
- command /baltop [<integer>]:
- aliases: balancetop, btop
- trigger:
- if arg-1 is not set:
- baltop(player, 1)
- else:
- baltop(player, arg-1)
- function baltop(p: player, page: integer):
- set {_d} to {_page}
- subtract 1 from {_d}
- set {_min} to 9 * {_d}
- add 1 to {_min}
- set {_cap} to {_min}
- add 9 to {_cap}
- loop {balance::*}:
- add 1 to {_size}
- if {_low.to.high.list::%loop-value%} is not set:
- set {_low.to.high.list::%loop-value%} to loop-index
- else:
- set {_n} to 0
- loop {_size} times:
- set {_n} to {_n}+1
- {_low.to.high.list::%loop-value-1%.%{_n}%} is not set
- set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index
- stop loop
- wait 1 tick
- set {_n} to size of {_low.to.high.list::*}
- loop {_low.to.high.list::*}:
- set {_high.to.low.list::%{_n}%} to loop-value
- set {_n} to {_n}-1
- wait 1 tick
- set {_i} to 0
- loop {_low.to.high.list::*}:
- add 1 to {_tn}
- set {_max} to ceil({_tn}/9)
- loop {balance::*}:
- add loop-value to {_servertotal}
- if {_tn} >= {_min}:
- send "&cBalance Top - Page &8[&7%{_page}%&8/&7%{_max}%&8]" to {_p}
- send "&cServer Total: &7$%format1({_servertotal})%" to {_p}
- send "" to {_p}
- else:
- send "&cInvalid chapter." to {_p}
- loop {_high.to.low.list::*}:
- add 1 to {_topnumber}
- set {_player} to "%loop-value%" parsed as offlineplayer
- if {_topnumber} >= {_min}:
- if {_topnumber} < {_cap}:
- send "&c%{_topnumber}% &f%{_player}% &c- $%format1({balance::%loop-value%})%" to {_p}
- add 1 to {_i}
- # BALANCE CHECK
- on tab complete of "/balance" or "/bal":
- set tab completions for position 2 to all players
- command /balance [<offlineplayer>]:
- trigger:
- if arg-1 is not set:
- send "&7Your balance: &c$%format1({balance::%player's uuid%})%"
- else:
- if {joined::%arg-1's uuid%} is true:
- send "&7%arg-1%&7's balance: &c$%format1({balance::%arg-1's uuid%})%"
- else:
- send "&cThat player has not joined before."
- command /bal [<offlineplayer>]:
- trigger:
- if arg-1 is not set:
- send "&7Your balance: &c$%format1({balance::%player's uuid%})%"
- else:
- if {joined::%arg-1's uuid%} is true:
- send "&7%arg-1%&7's balance: &c$%format1({balance::%arg-1's uuid%})%"
- else:
- send "&cThat player has not joined before."
- # OTHER
- on join:
- if {balance::%player's uuid%} is not set:
- set {balance::%player's uuid%} to 0
- on join:
- if {joined::%player's uuid%} is not set:
- set {joined::%player's uuid%} to true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement