#Shop

1 messages · Page 1 of 1 (latest)

meager crescent
#

I would like to create a shop where you pay per level and that every player can use

cinder hornetBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

#
⚠️ You already have a question open!

Don't forget to close or resolve your old questions once you're done with them. It makes our lives much easier! :D

Open question: #1268222114406727740

meager crescent
#

I made a shop with the help of a book and when you press a certain block in the book a /function command is executed but I didn't consider that it wouldn't work on a server because not everyone there has an op

cinder hornetBOT
# cinder hornet <@&1201956957406109788>

<@&1166082198152159386> <@&1202694677766348840>

🙇 Helpers Arise!

Please note that you still might not immediately get a response since all helpers are human beings and volunteers (and also might be sleeping right now)

gritty river
# meager crescent I made a shop with the help of a book and when you press a certain block in the ...
  1. Create a trigger scoreboard objective.
    -# load.mcfunction
scoreboard objectives add mytrigger trigger
  1. Enable the objective for all players.
    -# tick.mcfunction
scoreboard players enable @a mytrigger
  1. Execute as all players and check if a player has used it, then execute run your function.
    -# tick.mcfunction
scoreboard players enable @a mytrigger

execute as @a[scores = {mytrigger = 1..}] run function mynamespace:myfunction
#

Remember to reset the trigger after running your function.
-# myfunction.mcfunction

scoreboard players reset @s mytrigger

# ...
meager crescent
#

I have to do the last thing in every function where you should have access

gritty river
meager crescent
#

i have 50 functions

meager crescent
#

So do I have to do each of these commands 50 times?

gritty river
#

pretty much

meager crescent
#

execute if score @s Level matches 500.. run experience add @p -500 levels

execute if score @s Level matches 500.. run give @a enchanted_book[stored_enchantments={levels:{swift_sneak:3}}] is 1

gritty river
#
  1. Create trigger scoreboard objectives.
    -# load.mcfunction
scoreboard objectives add mytrigger1 trigger
scoreboard objectives add mytrigger2 trigger
scoreboard objectives add mytrigger3 trigger
# ...
  1. Enable the objectives for all players.
    -# tick.mcfunction
scoreboard players enable @a mytrigger1
scoreboard players enable @a mytrigger2
scoreboard players enable @a mytrigger3
# ...
  1. Execute as all players and check if a player has used one of the triggers, then execute run your corresponding function.
    -# tick.mcfunction
scoreboard players enable @a mytrigger1
scoreboard players enable @a mytrigger2
scoreboard players enable @a mytrigger3
# ...

execute as @a[scores = {mytrigger1 = 1..}] run function mynamespace:myfunction1
execute as @a[scores = {mytrigger2 = 1..}] run function mynamespace:myfunction2
execute as @a[scores = {mytrigger3 = 1..}] run function mynamespace:myfunction3
# ...
meager crescent
#

Do I also have to change the commands in the books?

meager crescent
#

this dosent work

gritty river
meager crescent
#

thank you

cinder hornetBOT
cinder hornetBOT
#

Re-opened the channel. Make sure to close it again once you're done.

cinder hornetBOT