Get players with highest frags on each team
Hello there,
i've run into the problem that i dont know how to code this: i want to get a specific player id from a specific team. i try to explain a bit more. let us say my server runs with 6:6 players on 6 are on ct side and 6 on terror side so now i use in my plugin some functions to check things on function checks the score for each team and log this to MySQL now i want it so that the first or the first 2 players for a specific team should be checked with some other stuffs. but not randomly. need the exact first 2 player id's maybe more with a cvar like: amx_check_teamplayers 1 but this is not important i know that kind of code. i need just help to getting the first 1 till X amount of players with the highest frags (like in scoreboard) for specific team that the function will return (like: CT or T but this can change everyround) hope u understand what i try to explain here lol thanks |
Re: help getting specific player id
I have an idea of how to do it but the number of players per team that you want to retrieve would be hard coded (one would be easiest :)).
|
Re: help getting specific player id
Quote:
get this running lol |
Re: help getting specific player id
This should work, let me know if you have any questions. This will place player id's in order from highest frag count to lowest in order for each team. T_Frags holds terrorist while CT_Frags holds counter-terrorist. T_Frags[ # ][ 0 ] holds player id while T_Frags[ # ][ 1 ] holds the number of frags for that player. Remember, array index starts at 0 so T_Frags[ 0 ][ 0 ] holds the first (highest frag) player id and T_Frags[ 0 ][ 1 ] holds his frags.
If you are not using cstrike module, add the below code and replace cs_get_user_team with get_user_team. PHP Code:
PHP Code:
|
Re: help getting specific player id
thank you, but i have some questions just to know if im right:
for this loop PHP Code:
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 and if i just want the #1 ranked player so i can use just: PHP Code:
|
Re: help getting specific player id
Quote:
Quote:
Quote:
Use: PHP Code:
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. |
Re: help getting specific player id
well, exactly what i searched for, thank u!
|
| All times are GMT -4. The time now is 13:43. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.