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!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

/buy command

Discussion in 'Requests' started by Loose, Sep 2, 2020.

  1. Loose

    Loose Member

    Sep 2, 2020
    Likes Received:
    Category: Shop

    Suggested name: shop command

    Spigot/Skript Version: latest

    What I want:
    When i do /buy (Item name) it will take the money from my balance and give me the item(with commands if possible). If I don't have the amount, it will simply message me that I don't have enough. No GUI

    Ideas for commands:
    /buy (item name)

    Ideas for permissions:
    no permission

    When I'd like it by:

  2. GRRRilla_Ninja

    Sep 25, 2017
    Likes Received:
    If the item you want to buy costs 100...
    Code (Text):
    1. command /buy [<text>] [<text>]:
    2.     set {_buyitem} to arg 1
    3.     set {_amount} to arg 2
    4.     set {_bal::%player%} to balance of player
    5.     if {_bal::%player%} is larger than 99:
    6.         give player {_amount} of {_buyitem} to player
    7.         message "You bought %{_amount}% %{_buyitem}%!" to player
    8.         subtract 100 from balance of player
    9.         clear {_buyitem}
    10.         clear {_amount}
    11.         stop
    12.     else if {_bal::%player%} is smaller than 100:
    13.         message "You don't have enough money." to player
    14.         clear {_buyitem}
    15.         clear {_amount}
    16.         stop

Share This Page