If you're talking about TF2, you can use the
"show_annotation" event... just be aware that these ARE visible through walls and such.
In this event:
- "follow_entindex" is the index of the entity it should follow. Alternately, use "worldPosX", "worldPosY", and "worldPosZ". Remember that client indexes are also entity indexes.
- "id" should be something unique. If you need to hide an annotation early, you can use this id with the hide_annotation event.
- "lifetime" is the number of seconds until it should go away. Since it's a float, you can set it to under 1 second.
- "visibilityBitfield" is a bitfield that stores the players who should be able to see it. SourcePawn will have issues with this field on 32+ player servers as you can never add players 32 and above. new visibile = (1 << client) | (1 << otherclient); would make it visible to two clients.
- "play_sound" has to be set to something, even if it's just "misc/null.wav" (which exists for purposes like these).
The code for the Gravestones plugin is a good reference on how to use this. It uses distance to determine if a player should be able to see the annotation when its created. Alternately, you can use tracerays to do it.
Be aware that if you're attaching an annotation to a moving entity, you should set the "lifetime" fairly short and recalculate who should be able to see it using a timer.
If this is a player, you will want to check if they go into one of the cloaking or cloaked conditions and remove the annotation if they do.
__________________