Script currency

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

Vkzo

Member
Jan 22, 2020
1
0
0
24
My vision is to have a custom made currency in game that players can earn to buy things with it like commands and ranks. I have finished the process of creating the currency. Players are able to pay each other with it. ops, and console are able to run the commands to add/remove the said currency to players balance. My only problem is when players attempt to buy something with the currency in the GUI I have created. They can purchase it as much as they want without any cost of the currency. I want the command/rank that they purchase from the GUI to be able to check if they have the correct amount of currency. Otherwise players are able to use it as if its free.

Example: I have a GUI set up so it acts as a shop for this currency. I want all items in this GUI to have a cost of the currency I have made(This isn't the issue). (This is the issue)But If a player goes to buy an item in this GUI. It requires none of this currency, because of the fact that there is no way to check to players balance of the currency to see if they have enough to make the purchase. With that being said players can purchase anything in this GUI without any of this currency.

I will post the script down below if anyone has any answers or codes I can use to make this possible. Please help me out it would be much appreciated!
 

Attachments

  • currency.sk
    2.2 KB · Views: 519
You can check if the player has enough bits to make a purchase with this line of code:

Code:
if {balance::%player%} >=  500
# change the "500" with whatever amount you want it to cost
# the >= checks if the player's balance is equal to or greater than the specified amount

By the way, I suggest you use %player's uuid% instead of %player%, because otherwise your player would lose all their bits upon changing their name.
 
Status
Not open for further replies.