Using TuSke to get balance of offline player - Struggling

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

aliano99

Member
Feb 17, 2017
4
0
0
30
Hey!

I'm trying to do a tax plugin which gets the balance of both online and offline players. My issue is that I can't seem to get the balance of the offline player, it just returns <none> when they have $1000. I'm not sure why

Code:
on join:
 if "%{newlogins::*}%" contains "%player%":
  stop
 add player to {newlogins::*}
 broadcast "Success"



command /taxeveryone:
    trigger:
        broadcast "Tax has been collected! As the tax code is HIGH FLAT, everyone has been taxed the same at 0.8%%. The next round of tax collection will occur in 3 hours."
        broadcast "Taxes go to the treasury and is distributed to pay for healthcare, transport, welfare amongst other government-run programmes!"
        loop {newlogins::*}:
            set {_bal} to balance of loop-value
            # A 1% tax, you can make it whatever you want
            set {_tax} to {_bal}*0.03
            remove {_tax} from loop-value's balance
            if loop-value is not online:
                set {_newbal} to balance of loop-value
                send "%loop-value%"
                send "Old balance %{_newbal}%"
                set {_newtax} to {_newbal}*0.03
                send "Tax removed from player %{_newtax}%"
                remove {_newtax} from the money of player data of loop-value

Thanks!
 
Ah I see, I've amended the code but sadly I'm still getting <none> for the balance of the offline player. I've tried implementing balance of player data but still getting same result. :emoji_frowning:


Code:
command /taxeveryone:
    trigger:
        broadcast "Tax has been collected! As the tax code is HIGH FLAT, everyone has been taxed the same at 0.8%%. The next round of tax collection will occur in 3 hours."
        broadcast "Taxes go to the treasury and is distributed to pay for healthcare, transport, welfare amongst other government-run programmes!"
        loop {newlogins::*}:
            set {_bal} to balance of loop-value
            # A 1% tax, you can make it whatever you want
            set {_tax} to {_bal}*0.03
            remove {_tax} from loop-value's balance
            if loop-value is not online:
                set {_newbal} to balance of player data of loop-value
                send "Old balance %{_newbal}%"
                set {_newtax} to {_newbal}*0.03
                send "Tax removed from player %{_newtax}%"
                remove {_newtax} from balance of player data of loop-value
 
Maybe set a local variable to the player data, and using that?
 
Sorry, I'm not too sure how to do that. I thought

set {_newbal} to balance of player data of loop-value

would hopefully be setting a local variable to the player data but I could be completely wrong :emoji_grin:
 
Try
Code:
set {_p} to player data of loop-value
set {_newbal} to balance of {_p}
message "%{_p}% (%loop-value%): %{_newbal}%"
and tell me which of the three are <none>
 
Status
Not open for further replies.