#player id method

1 messages · Page 1 of 1 (latest)

bleak scroll
#

I used your player id method but I have no idea on how do use it, how do I check someones id and how can I use it in commands?

thorn cliffBOT
#

<@&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

near zenith
#

It is in the message - at least an example is given at the bottom

small fogBOT
#

Player Id System

    >>> ## Give each player a unique ID

Create a scoreboard in a load function that runs on /reload

# namespace:load
scoreboard objectives add playerid dummy

Create a function to assign a unique id to the player

# namespace:assign_id
scoreboard players add .global playerid 1
scoreboard players operation @s playerid = .global playerid

Create a tick advancement to assign an id to a player when they first join

{
  "criteria": { "requirement": { "trigger": "minecraft:tick" }},
  "rewards": { "function": "namespace:assign_id" }
}

Check if an entity has the same ID as the player

Create a predicate that compares the id

// namespace:match_id
{ "condition": "minecraft:entity_scores", "entity": "this", "scores": {
  "playerid": {
    "min": { "type": "minecraft:score", "target": { "type": "minecraft:fixed", "name": "#this" }, "score": "playerid" },
    "max": { "type": "minecraft:score", "target": { "type": "minecraft:fixed", "name": "#this" }, "score": "playerid" }
  }}
}

To use it in a function, you can do that following

scoreboard players operation #this playerid = @s playerid
say @e[predicate=namespace:match_id] HAVE THE SAME PLAYERID
bleak scroll
near zenith
bleak scroll
near zenith
#

? It’s a scoreboard value

#

If you want to look at it you can scoreboard objectives setdisplay sidebar playerid or scoreboard players get @s playerid

thorn cliffBOT
# thorn cliff <@&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)