Flagging Player with High Score


Posted by Maj.Bitch (12.145.208.*) at 11:56 AM, 3/6/2001:


During the game, sometimes I would get frustrated because I never really knew (or very rarely knew) which player in the game was on top of the scoreboard. Well, with this little utility, a tiny red particle fountain will appear above the head of the player currently with the most frags! Now the current high scorer can be readily identified during gameply so you can go after the bastard! It's a simple modification to make.

Add this code right above your ClientThink() function in your p_client.c file.


edict_t *HighEnt=NULL; // Global for ClientThink

//==================================================
void GetHighScorer(void) {
int i,topscore=0;
edict_t *player;

  if ((int)level.time%10!=0) return; // update every 1 second

  HighEnt=NULL; // turn off

  // Who has highest score?
  for (i=0;i<ga.maxclients;i++) {
    player=g_edicts+i+1;
    // Skip dead, respawners, and spectators
    if (!G_ClientInGame(player)) continue;
    if (player->client->resp.score > topscore)
      topscore=player->client->resp.score; }

  if (!topscore) return;

  HighEnt=player; // Flag this guy!
}

Now, add these lines to the very bottom of your ClientThink() function:

  GetHighScorer(); // update high scorer every 1 second

  if (HighEnt==ent) { // is high scorer this guy?
    vec3_t v;
    VectorCopy(ent->s.origin,v);
    v[2] += 64; // Show particles above this guy's head - ADJUSTABLE
    G_Spawn_Splash(TE_LASER_SPARKS,8,0xe2e5e3e6,v,zvec); }

 

That's it! Simple but very cool addition to your mod..

Maj.Bitch