2
Need help on test and clear commands.
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.
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.
Create an account or sign in to comment.
9
1
anyone had any luck?
1
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
1.13.2
I cant change the versions as its on realms
I cant change the versions as its on realms
1
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 :)
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
Hi
Looks good but can i use this to only work on a certain player when they walk through an areas.
Thanks
Looks good but can i use this to only work on a certain player when they walk through an areas.
Thanks
1
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
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
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
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)
/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
Is there a way for this be set off automatically when the player walks through the gate or an area of blocks?
Thanks
Thanks