Quake DeveLS - ID command

Author: Reven
Difficulty: Easy

ID command!

Ok. Lets start! Inside the g_cmds.c file add this code before the ClientCommand function:


//Begin code
New function to print player name and dist
By Reven
void Cmd_id_f (edict_t *ent)
int j;
    char stats[500];
    vec3_t  start, forward, end;
trace_t tr;
    j = sprintf(stats, "     NAME              RANGE\n\n");

VectorCopy(ent->s.origin, start);
    start[2] += ent->viewheight;
    AngleVectors(ent->client->v_angle, forward, NULL, NULL);
    VectorMA(start, 8192, forward, end);
    tr = gi.trace(start, NULL, NULL, end, ent,
    if (tr.ent->client)
j += sprintf(stats + j, "%16s          %i\n",
tr.ent->client->pers.netname, (int)(tr.fraction * 512));
gi.centerprintf(ent, "%s", stats);      

// End code

And now, inside the ClientCommand function, add the parts with the "+" in between the current code:

        else if (Q_stricmp (cmd, "wave") == 0)
Cmd_Wave_f (ent);
+ // new command 'id'
+        else if (Q_stricmp (cmd, "id") == 0)
+        Cmd_id_f (ent);
+        // end new commdand
else if (Q_stricmp (cmd, "gameversion") == 0)

Now just bind a key to "cmd id" and there you go, a nice, neat ID command so you don't frag your friends during a DM.

Tutorial by Reven .

This site, and all content and graphics displayed on it,
are ©opyrighted to the Quake DeveLS team. All rights received.
Got a suggestion? Comment? Question? Hate mail? Send it to us!
Oh yeah, this site is best viewed in 16 Bit or higher, with the resolution on 800*600.
Thanks to Planet Quake for their great help and support with hosting.
Best viewed with Netscape 4