Help for options

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

CrazyCreator

Member
Apr 12, 2020
2
0
0
24
Hello good people, I need little help regarding my new skript which will contain selling items.
So I want to create options like you see on some bigger plugins involving player to just write infinite amount of items and next to it price for that item for which it will be sold.

So I imagined this:

Options:

item_id:emoji_stuck_out_tongue:rice_for_that_item
item_id2:emoji_stuck_out_tongue:rice_for_that_item2
item_id2:emoji_stuck_out_tongue:rice_for_that_item2


Item_id is item type which player will type for example (stone).
item_price_for_that_item is price for that item for example (10).

So for this first item stone will be price 10$

So player will just type stone:10 and that's it


How can I do that? I know I can just put in options and make skript but my code will be pretty large and I want smaller one which will loop all of them so I don't have to add new item in every part of my code.


Thanks for helping me. :emoji_grinning:
 
You should set up all the different materials for sale and include this in the code
Code:
{@stone} is set
This will make sure that the user of the skript wrote down that @stone option is equal to something
Next, you have to make sure that it is a number, so
Code:
{@stone} is an integer # or number if you don't mind decimals

Then there is a different way, which would require the player to write a command with the item id as the argument.
Then the code would make sure that the argument is a valid ID in the option list, like this:
Code:
{@%arg-1%} is set
and then would sell it for the price, but it has to also check that it is a number (or integer, depending on what you want), to verify that the plugin user has defined the price correctly, so:
Code:
{@%arg-1%} is an integer
I've never tried this, so let me know if it works!
 
You should set up all the different materials for sale and include this in the code
Code:
{@stone} is set
This will make sure that the user of the skript wrote down that @stone option is equal to something
Next, you have to make sure that it is a number, so
Code:
{@stone} is an integer # or number if you don't mind decimals

Then there is a different way, which would require the player to write a command with the item id as the argument.
Then the code would make sure that the argument is a valid ID in the option list, like this:
Code:
{@%arg-1%} is set
and then would sell it for the price, but it has to also check that it is a number (or integer, depending on what you want), to verify that the plugin user has defined the price correctly, so:
Code:
{@%arg-1%} is an integer
I've never tried this, so let me know if it works!
Hello TenToTu Sho, unfortunatelly I can't use this as part of my skript because it will be to large code for me to define every sellable items, I want something simple like maybe when player define items and price in options of skript like stone:10 on skript load it will loop that options and adapt acording them, with like 1 or two variables at most, thanks for trying to help me, I really appreciete it
 
Status
Not open for further replies.