Augustine: Despondent
Welcome to our Forums! Please login or register! You can introduce yourself here!







Augustine: Despondent

Welcome to the forums! We are the homeplace for Slender: Darkplaces, Augustine, Nightfall survival, and Revamped 1.


You are not connected. Please login or register

[Tutorial] Displaying another players Name

View previous topic View next topic Go down  Message [Page 1 of 1]

1 [Tutorial] Displaying another players Name on Tue Jan 11, 2011 9:46 pm

Mexicouger

avatar
Noble
Noble
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:

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:

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.
};
Now go down to Player_Pre_Think, And right after this piece:

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]

http://augustine.forumotion.com

2 Re: [Tutorial] Displaying another players Name on Tue Jan 11, 2011 11:35 pm

jukki


Warrant Officer Grade 3
Warrant Officer Grade 3
Try to make it so it prints the name top of the player (engine)

3 Re: [Tutorial] Displaying another players Name on Tue Jan 11, 2011 11:36 pm

Mexicouger

avatar
Noble
Noble
Heh. I wish I could. I might be able to later on though, Because I am leaving the Quake modding scene for a couple weeks to learn OSlib, which is solely C

http://augustine.forumotion.com

thock321


Hero
Hero
pretty good but this isnt much of a tut though because a newbie wouldnt even know what he is doing when adding the code.

Mexicouger

avatar
Noble
Noble
@thock321 wrote:pretty good but this isnt much of a tut though because a newbie wouldnt even know what he is doing when adding the code.

True, but this is more of just something to add to your game, and you can kinda feel out a traceline.

http://augustine.forumotion.com

thock321


Hero
Hero
@Mexicouger wrote:
@thock321 wrote:pretty good but this isnt much of a tut though because a newbie wouldnt even know what he is doing when adding the code.

True, but this is more of just something to add to your game, and you can kinda feel out a traceline.
so its basically an unimportant addon to the game that u dont exactly need to know about. Its still because you can tell if ppl are on ur team

Mexicouger

avatar
Noble
Noble
Well I remember a while back, I wanted to know how to code this really bad. Didn't know if others felt the same at all.

http://augustine.forumotion.com

thock321


Hero
Hero
ah, i see. good job anyway!

DukeInstinct

avatar
Commander Grade 3
Commander Grade 3
@thock321 wrote:pretty good but this isnt much of a tut though because a newbie wouldnt even know what he is doing when adding the code.

Just because it wouldn't help a beginner doesn't mean it wouldn't help a more intermediate coder that knows the basics but just doesn't quite yet know how to accomplish the task that was explained in this tutorial.

10 Re: [Tutorial] Displaying another players Name on Wed Jan 26, 2011 1:35 am

Mexicouger

avatar
Noble
Noble
Yep. If you are curious on how Tracelines work, this is a perfect tutorial. I commented the code too, If you all didn't notice.

Haha Duke, I remember when I used to goto your forums and ask for coding help. Thanks for the help in the past

http://augustine.forumotion.com

11 Re: [Tutorial] Displaying another players Name on Thu Nov 01, 2012 10:46 am

drmabuse1981

avatar
Commander
Commander
i tryed it but it i dont get it to compile...
Whats up with this line?

puff_org = trace_endpos - dir*4;

FrikQCC didnt compile that...

12 Re: [Tutorial] Displaying another players Name on Sat Nov 03, 2012 12:00 pm

mrgreezy3


Brigadier Grade 1
Brigadier Grade 1
i had coded this in revamp before for psp but jomart said it took away from fps imma try this code you have and see if it will do the same this code looks a little cleaner

13 Re: [Tutorial] Displaying another players Name on Thu Nov 08, 2012 7:39 am

drmabuse1981

avatar
Commander
Commander
i will keep it out then....
btw: is it just me or is this place dying?


14 Re: [Tutorial] Displaying another players Name on Thu Nov 08, 2012 7:42 am

%ERROR%

avatar
Legend
Legend
@drmabuse1981 wrote:i will keep it out then....
btw: is it just me or is this place dying?



This place dies all the time, then somehow gets back up again. It's the zombie forum, it's the living dead.



破壊衝動と生命についての考察
http://yourdoomed.canadian-forum.com/

15 Re: [Tutorial] Displaying another players Name on Thu Nov 08, 2012 11:36 am

Supermario641996

avatar
Reclaimer
Reclaimer
Exactly. Very Happy It will be dead from anywhere from a week to a month or 2. It's normal. It's not dead. It's just sleeping.

It's not dead till I stop coming to this site. And that will be never!

Oh, and one more thing. Make sure to stay on topic xD.




Shhh, it's Mario.  Don't forget to introduce yourself to our community here and our Discord group here. Very Happy
http://augustine.forumotion.com/

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum