Quote:
Originally Posted by platzpatrone
thank you, but i have some questions just to know if im right:
for this loop
PHP Code:
for ( new p = 0 ; p < 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
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
and if i just want the #1 ranked player so i can use just:
PHP Code:
client_print( 0 , print_chat , "%s has %d frags. and is the best ranked player on his team." , szName , T_Frags[ 1 ][ 1 ] );
|
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 szName[ 33 ];
get_user_name( T_Frags[ 0 ][ 0 ] , szName , 32 );
client_print( 0 , print_chat , "%s has %d frags. and is the best ranked player on his team." , szName , T_Frags[ 0 ][ 1 ] );
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.
__________________