Sauerworld Forum

Show Best Player

Quality

  • *
  • 34
  • +0/-0
  • Guitarthusiest :P
Show Best Player
« on: September 07, 2014, 03:44:04 PM »
I'm was using Supersauer Client for very Long, so when i stepped on to other Clients, i always missed one Feature the most: Show me who is the best Player! so i looked at the src of supersauer and took it to my own Client, also changing it a Little bit, so this came out:
Code: [Select]

    VARP(bestplayerhud, 0, 1, 1);
    VARP(bestplayerscale, 3, 10, 18);
    SVARP(bestplayercol, "1");
    VARP(bestplayerautocol, 0, 1, 1);

    void drawbestplayer(int w, int h, int posx, int posy)
    {
        if(!bestplayerhud) return;
        fpsent *f = followingplayer();
        if(!f) f = player1;
        fpsent *first = NULL;
        loopv(players)
        {
            fpsent *p = players(i); // <- those brackets are to be [], but else html would see it as italic command
            if(!p || p->state == CS_SPECTATOR) continue;
            if(!first) first = p;
            else if(p->frags > first->frags || (p->frags == first->frags && p->deaths < first->deaths)) first = p;
        }
        int tw, th;
        text_bounds(" ", tw, th);


        if(bestplayerautocol) {
        glPushMatrix();
        glTranslatef(posx, posy, 0);
        glScalef(bestplayerscale * 0.1f, bestplayerscale * 0.1f, 1);
        glTranslatef(-posx, -posy, 0);
        draw_textf("\f%s1. %s %d", posx, posy, strcmp(first->team, player1->team) ? "O" : "U", first->name, first->frags);
        }
        else
        {
            glPushMatrix();
            glTranslatef(posx, posy, 0);
            glScalef(bestplayerscale * 0.1f, bestplayerscale * 0.1f, 1);
            glTranslatef(-posx, -posy, 0);
            draw_textf("\f%s1. %s %d", posx, posy, bestplayercol, first->name, first->frags);
        }
glPopMatrix();
    }
   
add it to fpsgames/fps.cpp and add to void gameplayhud(int w, int h):
Code: [Select]
drawbestplayer(w, h,  1000, 1550);
it then should look (after recompiling) like this:
(Image attached)


PS: insert for the "O" and "U" Colors "1" and "3", as "O" and "U" are only Colors of my Clients :P ... hope it helped ... i'd like to see something similar in comed, as i really like this ..
« Last Edit: September 08, 2014, 02:57:19 PM by Quality »

Quality

  • *
  • 34
  • +0/-0
  • Guitarthusiest :P
Re: Show Best Player
« Reply #1 on: September 07, 2014, 04:49:39 PM »
i'm  not quite sure if the Auto Color works, maybe i made the wrong way, but here is the concept..

star

  • *****
  • 310
  • +19/-5
Re: Show Best Player
« Reply #2 on: September 08, 2014, 02:35:31 PM »
so this code just displays a single line of who has constantly the most frags on the hud? i find this rather distracting and it doesn't reflect who is the best in my opinion.

frosty

Re: Show Best Player
« Reply #3 on: September 08, 2014, 05:23:11 PM »
so this code just displays a single line of who has constantly the most frags on the hud? i find this rather distracting and it doesn't reflect who is the best in my opinion.


100% agree! flags not frags! if you want to calculate best player you would have to make a really complex formula incorporating everything from kills, deaths, damage dealt, flags, returns, and so on...

Quality

  • *
  • 34
  • +0/-0
  • Guitarthusiest :P
Re: Show Best Player
« Reply #4 on: September 08, 2014, 05:58:52 PM »
i know, the scoreboard goes for flags. but i personally am not that much of a flagrunner, so i'd rather Count kills. anyways, you could also just give the Player the Option what Award he is aiming for, or where he wants to be the best, so you could go away from only frags and flags to e.g. accuracy, flags returned, ...