This tutorial will enable you to display another players name directly on the screen if you are looking at him/her/it.
First off, open up defs.qc, and scroll all the way to the bottom, and add this:
Save and close. Now open up client.qc and scroll down to the function Player_Pre_Think
Right above that function, Add this:
Add this:
And that is it! Go look at a bot or player, And It will tell you who that guy is. [Tut Fixed]
First off, open up defs.qc, and scroll all the way to the bottom, and add this:
float display_time;
Save and close. Now open up client.qc and scroll down to the function Player_Pre_Think
Right above that function, Add this:
Now go down to Player_Pre_Think, And right after this piece:void() Display_Name =
{
local vector src, dir;
dir = aim (self, 1000); //make sure it is coming out face forward
makevectors(self.v_angle); //And it is in the players view
src = self.origin + v_forward*10;
src_z = self.absmin_z + self.size_z * 0.7;
traceline (src, src + dir*1000, FALSE, self); //Send out a line
puff_org = trace_endpos - dir*4;
if (trace_ent.takedamage) //return what the line hit. (something that has health, obviously)
{
if (trace_ent.classname == "player") //Make sure it is a player you are targeting
centerprint (self, trace_ent.netname);
}
display_time = time + 0.2; //Update time.
};
if (self.deadflag >= DEAD_DEAD)
{
PlayerDeathThink ();
return;
}
if (self.deadflag == DEAD_DYING)
return; // dying, so do nothing
Add this:
if (self.ishuman == TRUE) //Check is only necesary if you have bots. It saves memory so that bots dont do it
if (display_time < time)
Display_Name();
And that is it! Go look at a bot or player, And It will tell you who that guy is. [Tut Fixed]