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









Join the forum, it's quick and easy

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







Augustine: Despondent
Would you like to react to this message? Create an account in a few clicks or log in to continue.
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

+4
DukeInstinct
thock321
jukki
Mexicouger
8 posters

Go down  Message [Page 1 of 1]

Mexicouger

Mexicouger
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]

https://augustine.forumotion.com

jukki

avatar
Warrant Officer Grade 3
Warrant Officer Grade 3

Try to make it so it prints the name top of the player (engine)

Mexicouger

Mexicouger
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

https://augustine.forumotion.com

thock321

avatar
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

Mexicouger
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.

https://augustine.forumotion.com

thock321

avatar
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

Mexicouger
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.

https://augustine.forumotion.com

thock321

avatar
Hero
Hero

ah, i see. good job anyway!

DukeInstinct

DukeInstinct
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.

Mexicouger

Mexicouger
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

https://augustine.forumotion.com

drmabuse1981

drmabuse1981
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...

mrgreezy3

avatar
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

drmabuse1981

drmabuse1981
Commander
Commander

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


%ERROR%

%ERROR%
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/

Supermario641996

Supermario641996
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.

https://augustine.forumotion.com/

Sponsored content



Back to top  Message [Page 1 of 1]

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