how to save a balance in a variable

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.
Oct 28, 2019
24
0
1
this returns the error
Code:
set {2money::money} to loop-player's balance
A money cannot be saved, i.e. the contents of the variable {2money::money} will be lost when the server stops. (script.sk, line 52: set {2money::money} to loop-player's balance')
how do i save the variable as the money without it being deleted on server stop
 
Try with
Code:
Set {Money::loop-player} to loop-player's balance

Edit
Code:
Set {Money::%loop-player%} to loop-player's balance
 
Last edited:
Code:
command /sell:
    trigger:
        set {_o} to number of all [item] in player's inventory * 200)
        set {_ns} to (number of all [item] in player's inventory * 150)
        set {_q} to (number of all [item] in player's inventory * 125)
        set {_e} to (number of all [item] in player's inventory * 100)
        set {_d} to (number of all [item] in player's inventory * 50)
        set {_i} to (number of all [item] in player's inventory * 20)
        set {_c} to (number of all [item] in player's inventory * 10)

        remove all [item] from player's inventory
        remove all [item] from player's inventory
        remove all [item] from player's inventory
        remove all [item] from player's inventory
        remove all [item] from player's inventory
        remove all [item] from player's inventory
        remove all [item] from player's inventory

        set {_total} to ({_o} + {_ns} + {_q} + {_e} + {_d} + {_i} + {_c})
        add {_total} to {bal::%player's uuid%}
        send "&aSold all for %{_total}%&a$!"


command /bal:
    trigger:
        send "&aBalance: &c%{bal::%player's uuid%}%&c$"

command /bt [<integer>]:
    aliases: /baltop, /balt, /btop
    trigger:
        loop {bal::*}:
            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
        #send "&7&m--------------------"
        send "&6Ordering the balances of &c%size of {Joins::*}%&6 players, please wait."
        send "&6Top balances (%now%)"
        send "&e----&6 Balancetop&e ----"
        if {bal::*} contains "gage :D":
            remove "gage :D" from {bal::*}
        if size of {bal::*} is less than 8:
            send "&cdebug: %size of {bal::*}%"
            set {_num} to 1
            loop (8 - size of {bal::*}) times:
                add "0" to {bal::*}
        loop {_high.to.low.list::*}:
            add 1 to {_result}
            set {_player} to loop-value parsed as an offline player
            send "%{_result}%. %{_player}%, $%{bal::%loop-value%}%" to player
            if {_result} is 8:
                stop
          
command /resetbaltop:
    permission: *
    trigger:
        delete {bal::*}
 
Status
Not open for further replies.