Putting a box around a player that is closest to your crosshair, but from a certain distance.

Is there a way I can put a box around a person, but only if I have a clear view on them (don’t want an esp)? I also want to code it to get the player from the player on my crosshair, and if there is no player on my crosshair, it will find players a certain distance from my crosshair and put the box around them, then if it still couldn’t find anyone it would just tell me “no players found” (but I can do that myself).

Easy, HUDPaint hook + surface.DrawRect or surface.DrawOutlinedRect, Vector:ToScreen(), util.Trace for the “closest player to scrosshair” + visibility

Thank you! That’s gonna be so useful for what I’m doing.

[editline]15th February 2015[/editline]

wait, does the code that you gave me make the box follow the player, or does the box stay in one place?

I didn’t give you any code, I gave you the functions you gotta use to achieve what you want.

Okay, (I consider everything code) so how would I make the box follow the player? I have to enter coordinates, but I don’t know how to make the coordinates change and match a selected player.

Each player has Player.GetPos and Player.GetShootPos methods, they return player position on the world as a Vector.

Look up what each function does on the wiki and piece it together.

You’ll need a for-loop too, and player.GetAll()