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

Using TuSke to get balance of offline player - Struggling

Discussion in 'Skript' started by aliano99, Mar 12, 2019.

  1. a

    aliano99 Member

    Joined:
    Feb 17, 2017
    Messages:
    4
    Likes Received:
    0
    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 (Text):
    1.  
    2. on join:
    3.  if "%{newlogins::*}%" contains "%player%":
    4.   stop
    5.  add player to {newlogins::*}
    6.  broadcast "Success"
    7.  
    8.  
    9.  
    10. command /taxeveryone:
    11.     trigger:
    12.         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."
    13.         broadcast "Taxes go to the treasury and is distributed to pay for healthcare, transport, welfare amongst other government-run programmes!"
    14.         loop {newlogins::*}:
    15.             set {_bal} to balance of loop-value
    16.             # A 1% tax, you can make it whatever you want
    17.             set {_tax} to {_bal}*0.03
    18.             remove {_tax} from loop-value's balance
    19.             if loop-value is not online:
    20.                 set {_newbal} to balance of loop-value
    21.                 send "%loop-value%"
    22.                 send "Old balance %{_newbal}%"
    23.                 set {_newtax} to {_newbal}*0.03
    24.                 send "Tax removed from player %{_newtax}%"
    25.                 remove {_newtax} from the money of player data of loop-value
    Thanks!
     
  2. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    777
    Likes Received:
    50
    Medals:
    • Useful Useful x 1
  3. a

    aliano99 Member

    Joined:
    Feb 17, 2017
    Messages:
    4
    Likes Received:
    0
    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 (Text):
    1. command /taxeveryone:
    2.     trigger:
    3.         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."
    4.         broadcast "Taxes go to the treasury and is distributed to pay for healthcare, transport, welfare amongst other government-run programmes!"
    5.         loop {newlogins::*}:
    6.             set {_bal} to balance of loop-value
    7.             # A 1% tax, you can make it whatever you want
    8.             set {_tax} to {_bal}*0.03
    9.             remove {_tax} from loop-value's balance
    10.             if loop-value is not online:
    11.                 set {_newbal} to balance of player data of loop-value
    12.                 send "Old balance %{_newbal}%"
    13.                 set {_newtax} to {_newbal}*0.03
    14.                 send "Tax removed from player %{_newtax}%"
    15.                 remove {_newtax} from balance of player data of loop-value
     
  4. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    777
    Likes Received:
    50
    Medals:
    Maybe set a local variable to the player data, and using that?
     
  5. a

    aliano99 Member

    Joined:
    Feb 17, 2017
    Messages:
    4
    Likes Received:
    0
    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:
     
  6. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    777
    Likes Received:
    50
    Medals:
    Try
    Code (Text):
    1. set {_p} to player data of loop-value
    2. set {_newbal} to balance of {_p}
    3. message "%{_p}% (%loop-value%): %{_newbal}%"
    and tell me which of the three are <none>
     
Loading...