Prop Hunt - Red Name Shows When Looking At Props - Fixed!

Forgive me if I’m not the first to come up with this, but I’ve searched all over Google trying to find another reference to a fix for this. I’m going to assume it’s not been done before. At any rate, running the Classic Prop Hunt gamemode from xspacesoft yields a problem most of you are all too familiar with: When a hunter’s crosshairs are directly on a player who is a prop, the name and health level show up. This can sometimes cause the name to briefly flash on the screen and potentially give a prop’s position away. I’ve implemented a hotfix for this issue on my own server.

The problem lies in the base gamemode (which I believe is the coding for sandbox mode) where it draws “target IDs” on the screen for every player. In garrysmod/gamemodes/base/gamemode/cl_targetid.lua, line 17 reads:

if (trace.Entity:IsPlayer()) then

Simply adding an additional test after trace.Entity:IsPlayer() determining which team the player is on, it will prevent the code from returning a trace.Entity:Nick() name for the target if the target is not on the specified team.

if (trace.Entity:IsPlayer() and trace.Entity:Team() == TEAM_HUNTERS) then

As I said, it is implemented on my server and appears to be fully-functioning under every conceivable circumstance. I know I’ve been searching for a solution to this problem for months, to no avail, so I hope this is helpful!

Thanks for this! This sounds exactly what I’m looking for! Unfortunately, it’s no exaggeration to say that I have zero knowledge on how to do coding, so if you could do me an exact step-by-step on how to do this in a new game I create, I would be hugely grateful!