forum Forumsplay_arrow Minecraft fiber_manual_record Help

2

Need help on test and clear commands.

2 emeralds8 replies86 views
created 04/15/2019 9:39 am by ranger_unnown
last reply 04/16/2019 3:53 pm
HI all,
Recently, I tried experimenting with something on my server:
For the station, I tried to make it so the player buys 2 tickets, and then as they walk through a gate, a ticket is removed.
Ive been able to give the player the ticket but im struggling to make the system detect and then clear.
Any help is appreciated.
Posted by avatar
ranger_unnown
Level 1 : New Miner
1

8 replies

1
04/15/2019 2:55 pm
Level 16 : Journeyman Artist
lazaros28
avatar
I know how to help you, I know a few things about commanding in minecraft but first I need you to tell me the minecraft version of the server so I can help you and tell what you need to do
1
04/15/2019 4:21 pm
Level 1 : New Miner
ranger_unnown
avatar
1.13.2
I cant change the versions as its on realms
1
04/15/2019 4:39 pm
Level 16 : Journeyman Artist
lazaros28
avatar
ok good. To detect an item of players inventory you will need to use a execute command. The command will be: /execute as @s if entity @s[nbt={Inventory:[{id:"ITEM_ID"}]}]

You will have to replace the ITEM_ID in the command I wrote with the id of the ticket

for example: /execute as @s if entity @s[nbt={Inventory:[{id:"Paper"}]}]

you can use a button to activate the command.

Then to remove the ticket from the players inventory you can use the following command:
/clear @p
that command will clear everything from player's inventory

I hope that I was helpful :)
1
04/15/2019 5:01 pm
Level 1 : New Miner
ranger_unnown
avatar
Hi
Looks good but can i use this to only work on a certain player when they walk through an areas.
Thanks
1
04/15/2019 12:00 pm
Level 18 : Journeyman Engineer
David200510
avatar
Hi, please give me more information about the tickets like what items they are and how are they named... If so I think I can help You.
2
04/15/2019 1:07 pm
Level 1 : New Miner
ranger_unnown
avatar
Hi,
Well i don't know how much just the commands will help, but this is the command to give the player a ticket.
/give @p minecraft:name_tag{HideFlags:4,display:{Lore:["Used at a gate twice."],Name:"{\"text\":\"Train Ticket\"}"}} 2

So its basically a nametag with the lore "used at a gate twice" and the name "train ticket"
Many thanks
1
04/16/2019 8:34 am
Level 18 : Journeyman Engineer
David200510
avatar
I think this should help:

/clear @p minecraft:name_tag{HideFlags:4,display:{Lore:["Used at a gate twice."],Name:"{\"text\":\"Train Ticket\"}"}}  (this will remove all the tickets from the nearest player)

or


/clear @p minecraft:name_tag{HideFlags:4,display:{Lore:["Used at a gate twice."],Name:"{\"text\":\"Train Ticket\"}"}} 1  (this will remove 1 ticket from the nearest player)

or

/clear @p minecraft:name_tag{HideFlags:4,display:{Lore:["Used at a gate twice."],Name:"{\"text\":\"Train Ticket\"}"}} 2  (this will remove 2 tickets from the nearest player)

2
04/16/2019 3:53 pm
Level 1 : New Miner
ranger_unnown
avatar
Is there a way for this be set off automatically when the player walks through the gate or an area of blocks?
Thanks

Planet Minecraft

Browse

Site

© 2010 - 2019
planetminecraft.com

Welcome