Raised This Month: $ Target: $400
 0% 

Get players with highest frags on each team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-22-2009 , 23:51   Re: help getting specific player id
Reply With Quote #1

Quote:
Originally Posted by platzpatrone View Post
thank you, but i have some questions just to know if im right:

for this loop
PHP Code:
for ( new 15 p++ ) 
the 15 is for players currently playing on server or is it for max players the server can handle ?
I just used 15 as an example, replace it with whatever number of players for that team you want to display\manipulate. If you want to manipulate\display all players connected to the server then use get_maxplayers() value instead of 15 and if you want it to display only the top 3, change it to 3.

Quote:
Originally Posted by platzpatrone View Post
like if i run a 20 slot server i have to change it to 19 or is it like
i run a 20 slot server but 16 are playing on it so i have to set it to 15 ?

very confusing lol
Again, 15 is just a random number I used for example. You can leave it at fifteen and it will display from 1-15 players on each team; if there are less than 15 then it will display only that many (if you make sure to check if a player id is held in the [C]T_Frags[ X ][ 0 ] array element, break\exit loop otherwise). If there are more than 15 players on a given team then players 16+ will not get recognized\displayed.

Quote:
Originally Posted by platzpatrone View Post
and if i just want the #1 ranked player so i can use just:

PHP Code:
client_printprint_chat "%s has %d frags. and is the best ranked player on his team." szName T_Frags][ ] ); 
Make sure you check that a player id is held in the [C]T_Frags[][] array before attempting to use get_user_name, get_user_authid, etc. Example, suppose there are only 2 Terrorists currently playing and you attempt to do get_user_name( T_Frags[ 2 ][ 0 ] , szName , 32 ) then you will get an error because that value will be 0 which means there is no player id held in that slot. If you do a simple if ( T_Frags[ X ][ 0 ] ) check then you will be good to go. Refer to my code above where you see if ( id ). I added a more thorough explanation to help you understand.

Use:
PHP Code:
new szName33 ];
get_user_nameT_Frags][ ] , szName 32 );
client_printprint_chat "%s has %d frags. and is the best ranked player on his team." szName T_Frags][ ] ); 
Rank 1 Terrorist
id = T_Frags[ 0 ][ 0 ]
frags = T_Frags[ 0 ][ 1 ]

Rank 1 CT
id = CT_Frags[ 0 ][ 0 ]
frags = CT_Frags[ 0 ][ 1 ]

I hope this helps, if you are unsure of anything let me know.
__________________

Last edited by Bugsy; 11-23-2009 at 00:06.
Bugsy is offline
platzpatrone
Veteran Member
Join Date: Apr 2007
Location: Germany
Old 11-23-2009 , 00:14   Re: help getting specific player id
Reply With Quote #2

well, exactly what i searched for, thank u!
platzpatrone 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 13:43.


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