2

Need help on test and clear commands.

ranger_unnown's Avatar ranger_unnown4/15/19 9:39 am
2 emeralds 316 9
5/23/2019 5:16 pm
ranger_unnown's Avatar ranger_unnown
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 ranger_unnown's Avatar
ranger_unnown
Level 4 : Apprentice Miner
3

Create an account or sign in to comment.

9

1
05/23/2019 5:16 pm
Level 4 : Apprentice Miner
ranger_unnown
ranger_unnown's Avatar
anyone had any luck?
1
04/15/2019 2:55 pm
Level 59 : Grandmaster Artist
lazaros28
lazaros28's 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 4 : Apprentice Miner
ranger_unnown
ranger_unnown's Avatar
1.13.2
I cant change the versions as its on realms
1
04/15/2019 4:39 pm
Level 59 : Grandmaster Artist
lazaros28
lazaros28's 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 4 : Apprentice Miner
ranger_unnown
ranger_unnown's 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 pmhistory
Level 36 : Artisan Engineer
DavidCZ2051
DavidCZ2051's 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 4 : Apprentice Miner
ranger_unnown
ranger_unnown's 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 36 : Artisan Engineer
DavidCZ2051
DavidCZ2051's 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 4 : Apprentice Miner
ranger_unnown
ranger_unnown's 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

Website

© 2010 - 2024
www.planetminecraft.com

Welcome