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.

Skript variable with Vault economy API

Discussion in 'Skript' started by ERKO901, May 24, 2023.

  1. ERKO901

    ERKO901 Member

    Joined:
    May 24, 2023
    Messages:
    3
    Likes Received:
    0
    Hello,
    I want to ask you how can I use a Skript variable as Vault economy API.
    I tried many ways but anyone didn't work.
     
  2. lotzy

    lotzy Active Member

    Joined:
    Mar 15, 2022
    Messages:
    185
    Likes Received:
    28
    explain what exactly you are trying to do?
     
  3. ERKO901

    ERKO901 Member

    Joined:
    May 24, 2023
    Messages:
    3
    Likes Received:
    0
    When I want to use some plugin something like shop, it texts me that I need some economy plugin. If you execute /vault-info, it will text you that here is no economy. And I want to use my Skript variable that I use for coins.
     
  4. Maxgamer9473

    Maxgamer9473 New Member

    Joined:
    Mar 18, 2023
    Messages:
    7
    Likes Received:
    0
    Just make the shop and currency with skript
     
  5. lotzy

    lotzy Active Member

    Joined:
    Mar 15, 2022
    Messages:
    185
    Likes Received:
    28
    I think this can be solved with skript-reflect if Skript's hook to vault doens't work , idk

    Code (Text):
    1. import:
    2.     org.bukkit.Bukkit
    3.     net.milkbowl.vault.economy.Economy
    4.  
    5. on load:
    6.     set {_rsp} to Bukkit.getServer().getServicesManager().getRegistration(Economy.class)
    7.     set {vault::economy} to {_rsp}.getProvider()
    8.  
    9. #check if player registered in economy
    10. function hasAccount(player: offlineplayer) :: boolean:
    11.     return {vault::economy}.hasAccount({_player})
    12.  
    13. # get balance of player
    14. function balance(player : offlineplayer) :: number:
    15.     return {vault::economy}.getBalance({_player})
    16.  
    17. # add money to player's balance
    18. function deposit(player : offlineplayer, amount: number) :: boolean:
    19.     if {_amount} > 0 :
    20.         set {_response} to {vault::economy}.depositPlayer({_player}, {_amount})
    21.         return {_response}.transactionSuccess()
    22.     return false
    23.  
    24. #remove money from player's balance
    25. function withdraw(player: offlineplayer, amunt: number) :: boolean:
    26.     if {_amount} > 0:
    27.         set {_response} to {vault::economy}.withdrawPlayer({_player}, {_amount})
    28.         return {_response}.transactionSuccess()
    29.     return false
    ALERT Im not tested this due to not using vault
     
    #5 lotzy, May 25, 2023
    Last edited: May 25, 2023
  6. ERKO901

    ERKO901 Member

    Joined:
    May 24, 2023
    Messages:
    3
    Likes Received:
    0
    Should I paste my variable {coins. %player%} somewhere?
     

Share This Page

Loading...