Raised This Month: $ Target: $400
 0% 

Get 3 names


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Starsailor
horrible hahah
Join Date: Aug 2008
Location: Buenos Aires
Old 12-16-2008 , 10:21   Get 3 names
Reply With Quote #1

hello ..

I would like to know how to get the names of the 3 who finish first in each team .. or

1st, 2nd and 3rd Team CT
1st, 2nd and 3rd of the team TERR

thanks!
__________________
Find my plugins here..

Ex - Spanish Moderator.
Starsailor is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 12-16-2008 , 11:08   Re: Get 3 names
Reply With Quote #2

"Finish first", maybe you should explain little better what they "finish"?
SnoW is offline
Send a message via MSN to SnoW
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 12-17-2008 , 03:30   Re: Get 3 names
Reply With Quote #3

He's asking how to get the names belonging to the top three scores for each team at the end of the round, I think.
Spunky is offline
Send a message via AIM to Spunky
MPNumB
Veteran Member
Join Date: Feb 2007
Location: Lithuania
Old 12-17-2008 , 06:03   Re: Get 3 names
Reply With Quote #4

Stupid idea, cuz if frags are the same they are puted by player id (not by playing time).

Ontopic: just loop players and get best 3 with highest frags.
__________________
Skill and no annoying bugs with fixed balance issues is my goal!
My approved plugins what don't show up in Approved List:
* Bomb/Death/CSS Radar
* HotVision
___
Need help? Please check this documentation first.
MPNumB is offline
Send a message via Skype™ to MPNumB
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 12-17-2008 , 07:59   Re: Get 3 names
Reply With Quote #5

I thought about something like this.
Code:
new i1st, i2nd, i3rd;   for (new i = 1; i <= get_maxplayers(); i++) {         if (get_user_frags(i) > i1st)         {                 i2nd = i1st;                 i1st = i;         }         else if (i1st >= get_user_frags(i) > i2nd)         {                 i3rd = i2nd;                 i2nd = i;         }         else if (i2nd >= get_user_frags(i) > i3rd)                 i3rd = i; }   new sz1st[32], sz2nd[32], sz3rd[32]; get_user_name(i1st, sz1st, 31); // Name of the 1st get_user_name(i2nd, sz2nd, 31); // Name of the 2nd get_user_name(i3rd, sz3rd, 31); // Name of the 3rd

But IMO players' deaths also should play a role here.
__________________

Last edited by hleV; 12-17-2008 at 08:03.
hleV is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-17-2008 , 11:05   Re: Get 3 names
Reply With Quote #6

Why are you comparing the player indexes with the frags?

EDIT:

Code:
new bestClient[3], bestFrags[3], frags; for( new client = 1; client <= g_max_clients; client++ ) {     if( !is_user_connected(client) ) continue;         frags = get_user_frags(client);         for( new i = 0; i < 3; i++ )     {         if( frags > bestFrags[i] )         {             for( new j = i + 1; j < 3; j++ )             {                 bestFrags[j] = bestFrags[j - 1];                 bestClient[j] = bestClient[j - 1];             }                         bestFrags[i] = frags;             bestClient[i] = client;                         break;         }     } } new name[3][32], client; for( new i = 0; i < 3; i++ ) {     if( (client = bestClient[i]) )     {         get_user_name(client, name[i], sizeof(name[]) - 1);     } }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 12-17-2008 at 11:30.
Exolent[jNr] is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode