Jump to content

Balance Skript


Smiley_Guy_

Recommended Posts

Quote

 

command /bal [<offline player>] [<text>]:
    trigger:
        if arg-1 is set:
            if arg-2 is set:
                if {balance::%arg-1's uuid%} isn't set:
                    send "&aBalance of &4%arg-1%&a is: &c$0" to player
                else:
                    send "&aBalance of &4%arg-1%&a is: &c$%{balance::%arg-1's uuid%}%" to player
            else:
                if {balance::%arg-1's uuid%} isn't set:
                    send "&aBalance of &4%arg-1%&a is: &c$0" to player
                else:
                    send "&aBalance of &4%arg-1%&a is: &c$%{balance::%arg-1's uuid%}%" to player
        else:
            if {balance::%player's uuid%} isn't set:
                send "&aBalance: &c$0" to player
            else:
                send "&aBalance: &c$%{balance::%player's uuid%}%" to player

command /balance [<offline player>] [<text>]:
    trigger:
        if arg-1 is set:
            if arg-2 is set:
                if {balance::%arg-1's uuid%} isn't set:
                    send "&aBalance of &4%arg-1%&a is: &c$0" to player
                else:
                    send "&aBalance of &4%arg-1%&a is: &c$%{balance::%arg-1's uuid%}%" to player
            else:
                if {balance::%arg-1's uuid%} isn't set:
                    send "&aBalance of &4%arg-1%&a is: &c$0" to player
                else:
                    send "&aBalance of &4%arg-1%&a is: &c$%{balance::%arg-1's uuid%}%" to player
        else:
            if {balance::%player's uuid%} isn't set:
                send "&aBalance: &c$0" to player
            else:
                send "&aBalance: &c$%{balance::%player's uuid%}%" to player
                
command /baltop [<text>]:
    trigger:
        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
        send "&7&m-----------&8< &6Top10 &8>&7&m-----------"
        loop {_high.to.low.list::*}:
            add 1 to {_topnumber}
            set {_player} to "%loop-value%" parsed as offlineplayer
            send "&7%{_topnumber}% - &c%{_player}% &8» &c$%{balance::%loop-value%}%"
            add 1 to {_i}
            if {_topnumber} > 10:
                stop
        send "&7&m------------------------------"
        
command /balancetop [<text>]:
    trigger:
        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
        send "&7&m-----------&8< &6Top10 &8>&7&m-----------"
        loop {_high.to.low.list::*}:
            add 1 to {_topnumber}
            set {_player} to "%loop-value%" parsed as offlineplayer
            send "&7%{_topnumber}% - &c%{_player}% &8» &c$%{balance::%loop-value%}%"
            add 1 to {_i}
            if {_topnumber} > 10:
                stop
        send "&7&m------------------------------"

command /eco <text> <offline player> <integer>:
    permission: economy
    description: Manages the server economy.
    usage: /eco <give|take|set> <player> <amount>
    trigger:
        if arg-1 is "set", "s" or "se":
            set {balance::%arg-2's uuid%} to arg-3
            send "&aYour balance was set to $%arg-3%&a." to arg-2
            send "&aYou set &4%arg-2%&a's balance to $%arg-3%&a." to player
        if arg-1 is "g", "gi", "giv" or "give":
            add arg-3 to {balance::%arg-2's uuid%}
            send "&a$%arg-3% &ahas been added to your account." to arg-2
            send "&a$%arg-3%&a added to &4%arg-2%&a's account. New balance: $%{balance::%arg-2's uuid%}%" to player
        if arg-1 is "t", "ta", "tak" or "take":
            remove arg-3 from {balance::%arg-2's uuid%}
            send "&e$%arg-3%&a has been taken from your account." to arg-2
            send "&e$%arg-3%&a taken from %arg-2%&a's &aaccount. &aNew balance: &e%{balance::%arg-2's uuid%}%" to player

command /economy <text> <offline player> <integer>:
    permission: economy
    description: Manages the server economy.
    usage: /eco <give|take|set> <player> <amount>
    trigger:
        if arg-1 is "set", "s" or "se":
            set {balance::%arg-2's uuid%} to arg-3
            send "&aYour balance was set to $%arg-3%&a." to arg-2
            send "&aYou set &4%arg-2%&a's balance to $%arg-3%&a." to player
        if arg-1 is "g", "gi", "giv" or "give":
            add arg-3 to {balance::%arg-2's uuid%}
            send "&a$%arg-3% &ahas been added to your account." to arg-2
            send "&a$%arg-3%&a added to &4%arg-2%&a's account. New balance: $%{balance::%arg-2's uuid%}%" to player
        if arg-1 is "t", "ta", "tak" or "take":
            remove arg-3 from {balance::%arg-2's uuid%}
            send "&e$%arg-3%&a has been taken from your account." to arg-2
            send "&e$%arg-3%&a taken from %arg-2%&a's &aaccount. &aNew balance: &e%{balance::%arg-2's uuid%}%" to player

command /pay <offline player> <integer>:
    description: Pays another player from your balance.
    usage: /pay <player> <amount>
    trigger:
        if arg-2 >= 1:
            if {balance::%player's uuid%} >= arg-2:
                send "&a$%arg-2% &ahas been sent to &4%arg-1%&a." to player
                send "&a$%arg-2% &6has been received from &4%arg-1%&6." to arg-1
                remove arg-2 from {balance::%player's uuid%}
                add arg-2 to {balance::%arg-1's uuid%}
            else:
                send "&cInsufficient funds!" to player
        else:
            send "&cYour payment can't be under $1" to player

 

 

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
On 5/23/2021 at 3:58 PM, Cerial_Killer said:

You don't have to make 2 separate commands for an alias, you can add this to your code:


command /test:
    aliases: /an, /alias
    trigger:

        # put stuff in here

 

I know it wouldn't work on my server though 

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...