How to get the economy total balance?

  • 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.

Martini002

Member
Feb 17, 2017
36
0
0
40
Hello,

How can I get the total money in the economy?

f90c1249e0c2461589e7b7be3e3483e5.png


This come with the Essentials /balancetop
I want to know how much money my players owns.

I can not believe I must to read each player file and count each player balance to get the total.

Thanks
 
How did you set your variables with money? Like this?

code_language.skript:
{Money::%player%}

if yes. so do
code_language.skript:
set {_s} to size of {Money::*}
Send "%{_s}% player's need to scan... wait..."
 
I do not set money variables for my players, I use Essentials Economy,
I just want to read the variable that stores the total of money of the economy from that plugin.

Other option would be to internally catch the output of the /balancetop command.
 
I do not set money variables for my players, I use Essentials Economy,
I just want to read the variable that stores the total of money of the economy from that plugin.

Other option would be to internally catch the output of the /balancetop command.
Why do you want it?

I think is not possible to way it. or you set evertime money to variables if they type any commands. check how amount they money has. and set to variables...
 
You can work around that:

code_language.skript:
on join:
    if {economy::players::%player%} isn't set:
        set {economy::players::%player%} to "%player%" parsed as offline player

command /check:
    trigger:
        loop {economy::players::*}:
            add loop-value's money to {_global-balance}
        message "%{_global-balance}%"
 
You can work around that:

code_language.skript:
on join:
    if {economy::players::%player%} isn't set:
        set {economy::players::%player%} to "%player%" parsed as offline player

command /check:
    trigger:
        loop {economy::players::*}:
            add loop-value's money to {_global-balance}
        message "%{_global-balance}%"

I was thinking about this but there is a problem, it will only count the balance of these players that get connected to the server from now, what about some guys that have a important amount of money and have long time away?

I want to get the total money in the economy because I want to add features like inflation and autoupdated shop prices, so I will never change again the prices of the items, and also I would be able to handle variables that get a big impact on the server economy, basically I want to recreate a real economy. Hope you understand what I am trying to do.

Anyway; Is there a way to catch the output of any command?
[doublepost=1493855899,1493848904][/doublepost]
You can work around that:

code_language.skript:
on join:
    if {economy::players::%player%} isn't set:
        set {economy::players::%player%} to "%player%" parsed as offline player

command /check:
    trigger:
        loop {economy::players::*}:
            add loop-value's money to {_global-balance}
        message "%{_global-balance}%"

Studying this option, would be nice to do a complete check of each player file just for get the total amount of money just one time, after that action just track the money changes when they join and quit the server, I think would be a nice alternative
 
Status
Not open for further replies.