1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to save a balance in a variable

Discussion in 'Skript' started by emperorofwater, Sep 28, 2020.

Thread Status:
Not open for further replies.
  1. emperorofwater

    Joined:
    Oct 28, 2019
    Messages:
    24
    Likes Received:
    0
    this returns the error
    Code (Text):
    1. 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
     
  2. MrGametop1

    MrGametop1 Member

    Joined:
    Mar 10, 2017
    Messages:
    25
    Likes Received:
    0
    Try with
    Code (Text):
    1. Set {Money::loop-player} to loop-player's balance
    Edit
    Code (Text):
    1. Set {Money::%loop-player%} to loop-player's balance
     
    #2 MrGametop1, Sep 28, 2020
    Last edited: Oct 1, 2020
  3. emperorofwater

    Joined:
    Oct 28, 2019
    Messages:
    24
    Likes Received:
    0
    that defeats the purpose
     
  4. Dave

    Dave Active Member

    Joined:
    Jul 20, 2018
    Messages:
    228
    Likes Received:
    9
    {money.%loop-player%}
     
  5. MrGametop1

    MrGametop1 Member

    Joined:
    Mar 10, 2017
    Messages:
    25
    Likes Received:
    0
    Why's that?
    --- Double Post Merged, Oct 1, 2020, Original Post Date: Oct 1, 2020 ---
    It's better using :: instead of just .
    Then you can loop it much easier and delete or reset money on alot of diffrent players at once
     
  6. bpitcher2013

    bpitcher2013 Member

    Joined:
    Jan 25, 2020
    Messages:
    14
    Likes Received:
    1
    Code (Text):
    1. command /sell:
    2.     trigger:
    3.         set {_o} to number of all [item] in player's inventory * 200)
    4.         set {_ns} to (number of all [item] in player's inventory * 150)
    5.         set {_q} to (number of all [item] in player's inventory * 125)
    6.         set {_e} to (number of all [item] in player's inventory * 100)
    7.         set {_d} to (number of all [item] in player's inventory * 50)
    8.         set {_i} to (number of all [item] in player's inventory * 20)
    9.         set {_c} to (number of all [item] in player's inventory * 10)
    10.  
    11.         remove all [item] from player's inventory
    12.         remove all [item] from player's inventory
    13.         remove all [item] from player's inventory
    14.         remove all [item] from player's inventory
    15.         remove all [item] from player's inventory
    16.         remove all [item] from player's inventory
    17.         remove all [item] from player's inventory
    18.  
    19.         set {_total} to ({_o} + {_ns} + {_q} + {_e} + {_d} + {_i} + {_c})
    20.         add {_total} to {bal::%player's uuid%}
    21.         send "&aSold all for %{_total}%&a$!"
    22.  
    23.  
    24. command /bal:
    25.     trigger:
    26.         send "&aBalance: &c%{bal::%player's uuid%}%&c$"
    27.  
    28. command /bt [<integer>]:
    29.     aliases: /baltop, /balt, /btop
    30.     trigger:
    31.         loop {bal::*}:
    32.             add 1 to {_size}
    33.             if {_low.to.high.list::%loop-value%} is not set:
    34.                 set {_low.to.high.list::%loop-value%} to loop-index
    35.             else:
    36.                 set {_n} to 0
    37.                 loop {_size} times:
    38.                     set {_n} to {_n}+1
    39.                     {_low.to.high.list::%loop-value-1%.%{_n}%} is not set
    40.                     set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index
    41.                     stop loop
    42.         wait 1 tick
    43.         set {_n} to size of {_low.to.high.list::*}
    44.         loop {_low.to.high.list::*}:
    45.             set {_high.to.low.list::%{_n}%} to loop-value
    46.             set {_n} to {_n}-1
    47.         wait 1 tick
    48.         #send "&7&m--------------------"
    49.         send "&6Ordering the balances of &c%size of {Joins::*}%&6 players, please wait."
    50.         send "&6Top balances (%now%)"
    51.         send "&e----&6 Balancetop&e ----"
    52.         if {bal::*} contains "gage :D":
    53.             remove "gage :D" from {bal::*}
    54.         if size of {bal::*} is less than 8:
    55.             send "&cdebug: %size of {bal::*}%"
    56.             set {_num} to 1
    57.             loop (8 - size of {bal::*}) times:
    58.                 add "0" to {bal::*}
    59.         loop {_high.to.low.list::*}:
    60.             add 1 to {_result}
    61.             set {_player} to loop-value parsed as an offline player
    62.             send "%{_result}%. %{_player}%, $%{bal::%loop-value%}%" to player
    63.             if {_result} is 8:
    64.                 stop
    65.          
    66. command /resetbaltop:
    67.     permission: *
    68.     trigger:
    69.         delete {bal::*}
     
Thread Status:
Not open for further replies.

Share This Page

Loading...