This is a HIGHSCORE patch which I thought up one day. Its makes your server like a pinball machine in the old days, it saves the highscore and the person who got it in a text file on your server. The highscore will be saved throughout ALL level changes, and server restarts. I'm releasing this code in hopes that people will intergrate it into thier mods. The Highscore.txt file is saved to your Quake2 directory, of course you can edit that and save it anywhere you please. At level end, the highscore is compared to the highest frag count for that particular level. If its beat, it will update the highscore.txt file with the new score and persons name who got it, as well as update 2 server rules: highscore highholder These 2 rules will be displayed in Gamespy when you update a server thats running this patch. Its most important to include this so your servers can be filtered out as highscore enabled. Not only that, but websites can be updated with server listings and sort by highscore fields. This will make for an interesting ALL TIME BEST HIGHSCORE web page. If anyone is interested in making one up using Qstat or the like, please contact me. //------------------------------------------------- // // Find void MoveClientToIntermission (edict_t *ent) in p_hud.c file // Insert this code after //add the layout remark // You will be REPLACING the current code starting at "if (deathmatch->value || coop->value)" // //------------------------------------------------- if (deathmatch->value || coop->value) { //ku - lets calc all the scores and find the highest score int highscore; char in_netname[16]; char command [256]; { int i; int count; char large[1280]; int index[256]; edict_t *cl_ent; count = 0; for (i = 0 ; i < maxclients->value ; i++) { cl_ent = g_edicts + 1 + i; if (!cl_ent->inuse) continue; { index[count] = i; count++; } } // sort by frags qsort (index, count, sizeof(index[0]), PlayerSort2); large[0] = 0; i = count; // Lets read in the current highscore from the highscore.txt file in Quake2 directory { FILE *inFile; int in_Line; inFile = fopen("highscore.txt", "r"); if (inFile == NULL) return; fscanf(inFile, "%i", &in_Line); // Lets read in the highscore as an integer fscanf(inFile, "%s", &in_netname); // Lets read in the players name as a string highscore = in_Line; fclose(inFile); } //ku if highscore was beat, update the file, happens once for first client who hits this. if (game.clients[index[count-1]].ps.stats[STAT_FRAGS] > highscore) { FILE *outFile; highscore = game.clients[index[count-1]].ps.stats[STAT_FRAGS]; outFile = fopen("highscore.txt", "w"); fprintf(outFile, "%i\n", highscore); fprintf(outFile, "%s\n", game.clients[index[count-1]].pers.netname); fclose(outFile); //ku update highscore server info for Gamespy and Webpage server lists Com_sprintf (command, sizeof(command), "set highholder \"%s\" s\n", game.clients[index[count-1]].pers.netname); gi.AddCommandString (command); Com_sprintf (command, sizeof(command), "set highscore \"%i\" s\n", highscore); gi.AddCommandString (command); } else { gi.cprintf (ent, PRINT_HIGH, "HIGHSCORE set by %s is Undefeated: %i\n",in_netname,highscore); //ku update highscore server info for Gamespy and Webpage server lists Com_sprintf (command, sizeof(command), "set highholder \"%s\" s\n", in_netname); gi.AddCommandString (command); Com_sprintf (command, sizeof(command), "set highscore \"%i\" s\n", highscore); gi.AddCommandString (command); } } //ku I wanted some cool music in the intermission end of level screen gi.sound (ent, CHAN_BODY, gi.soundindex ("world/xian1.wav"), 1, ATTN_NORM, 0); DeathmatchScoreboardMessage (ent, NULL); gi.unicast (ent, true); } //------------------------------------ // // Now we want to display the highscore on the scoreboard. // // Find: Void DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer) in p_hud.c file // //------------------------------------ // Add these lines just below the: "int x, y;" line int in_Line; int highscore; char s[1024]; char in_netname[16]; // ------------------------------- // Find this section a few lines down: "// print level name and exit rules" // // ------------------------------- // Add this to read in the current highscore when displaying the scoreboard. { FILE *inFile; inFile = fopen("highscore.txt", "r"); if (inFile == NULL) return; fscanf(inFile, "%i", &in_Line); fscanf(inFile, "%s", &in_netname); highscore = in_Line; fclose(inFile); } // -------------------------------- // Find: "gi.WriteByte (svc_layout);" near the end of this routine. // // -------------------------------- // Just ABOVE this line, add the following sprintf(s, "xv 0 yv 0 string2 \" Highscore Holder: %s\"", in_netname); j = strlen(s); strcpy (string + stringlength, s); stringlength += j; sprintf(s, "xv 0 yv 15 string2 \" Highscore: %i\"", highscore); j = strlen(s); strcpy (string + stringlength, s); stringlength += j; // --------------------------------- Thats it. I hope everyone adds this as a toggle feature in thier mods. Its great and brings players back to your server to keep thier name on that scoreboard. You can add this to any mod that doesnt require a FRAGLIMIT to play. Simply type FRAGLIMIT 0 at the console of your server, and set set a TIMELIMIT 15 or whatever you want. If anyone expands on this code, please email me with the source, I'd like to see what becomes of it. You can download a fully patched .DLL for DM and CTF at my website. - Email: kunani@planetquake.com - Website: www.planetquake.com/kunani