Raised This Month: $ Target: $400
 0% 

[SOLVED]catch top point


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-30-2011 , 10:07   [SOLVED]catch top point
Reply With Quote #1

hi,

i have no idea how can i catch the best players points.

every user get every round X AGs ( set by speed )
example :
when user has 1000 units/s = 1 AG
when more than 1200 & less 1400 = 2 AGs

so i want to have a loop on round end and print which player got the most AGs in this/last round.
but i have no idea how to catch it.
i hope you know what i mean
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 03-30-2011 , 11:20   Re: catch top point
Reply With Quote #2

Code:
new iBest, iPlayer; [ insert loop for players here ] {     if( g_iPoints[ id ] > iBest )     {         iBest = g_iPoints[ id ];         iPlayer = id;     } } if( iPlayer ) {     // iPlayer == best player     // iBest == his points }
__________________
xPaw is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-30-2011 , 18:16   Re: catch top point
Reply With Quote #3

hmmm....
ty but how is it when 2 or more users are the top scorer?
and how to catch top 5?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
gladius
Veteran Member
Join Date: Jul 2008
Location: Santiago, Chile
Old 03-30-2011 , 18:20   Re: catch top point
Reply With Quote #4

sort?
__________________
Proyects
Kreedz Chile Mod [100%] (Fixing some details).

gladius is offline
Send a message via MSN to gladius Send a message via Skype™ to gladius
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-30-2011 , 18:50   Re: catch top point
Reply With Quote #5

hehe the question is how to sort?!
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
gladius
Veteran Member
Join Date: Jul 2008
Location: Santiago, Chile
Old 03-30-2011 , 18:58   Re: catch top point
Reply With Quote #6

you can see:

https://forums.alliedmods.net/showth...ight=arraysort
https://forums.alliedmods.net/showth...ht=sort&page=2
https://forums.alliedmods.net/showth...highlight=sort
__________________
Proyects
Kreedz Chile Mod [100%] (Fixing some details).

gladius is offline
Send a message via MSN to gladius Send a message via Skype™ to gladius
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-01-2011 , 15:14   Re: catch top point
Reply With Quote #7

hmmm...
ok this works but what i want is complicated.

the rank must be sort by Received AGs and Maxspeed and lower fps.

For example :

there are 2 users which got 3 AGs.
both have 100 fps_max
but user 1 got 1250 units/s and user 2 got 1270 units/s.

so rank 1 willbe user 2 and rank 2 willbe user 1.

Example with names :

Xpaw got 4 AGs and his fps_max is on 100. his max speed 1420 units/s.
One got 4 AGs and his fps_max is on 100 too. his max speed 1534 units/s.

Rank :

1. One ( 4 AGs )
2. Xpaw ( 4 AGs )


what i have :

users_AG[id] = users AG
users_maxspeed_round[id] = maxspeed which user got in the round

i tried to sort it with AGs and maxspeed but like ever .... only errors.
so i didnt try to catch users fps_max.


i have realy no idea how to sort it.
i hope anyone has time and can give a start.for sure i give credit in release topic.

ty in advance
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
gladius
Veteran Member
Join Date: Jul 2008
Location: Santiago, Chile
Old 04-01-2011 , 15:56   Re: catch top point
Reply With Quote #8

I have a doubt.

What happens if Player 1 has 5 points, 90 fps and 1250 units / s and Player 2 has 10 points, 100 fps and 1150 units / s ??

Which is the order of priority?
__________________
Proyects
Kreedz Chile Mod [100%] (Fixing some details).


Last edited by gladius; 04-01-2011 at 15:59.
gladius is offline
Send a message via MSN to gladius Send a message via Skype™ to gladius
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-01-2011 , 16:56   Re: catch top point
Reply With Quote #9

for sure player 2.
player 2 has more AGs.then you have to know you get more points/AGs when you are faster.
what i meant was if both/more users have the same points/AGs. then it willbe sorted by fps. if both have the same fps_max, it willbe sorted by speed.

maybe we can ignore the fps.
for first Points and after this speed.
__________________

Last edited by One; 04-01-2011 at 17:00.
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-01-2011 , 17:33   Re: catch top point
Reply With Quote #10

Code:
#include <amxmodx> #define MAX_PLAYERS 32 new g_points[MAX_PLAYERS + 1]; // your points variable for players new g_fps[MAX_PLAYERS + 1]; // your fps variable for players new g_speed[MAX_PLAYERS + 1]; // your speed variable for players GetTopPlayers(players[32], &pnum, const flags[]="", const team[]="") {     get_players(players, pnum, flags, team);         SortCustom1D(players, pnum, "SortPlayers"); } public SortPlayers(item1, item2) {     new diff = g_points[item2] - g_points[item1];         if( !diff )     {         diff = g_fps[item2] - g_fps[item1];                 if( !diff )         {             diff = g_speed[item2] - g_speed[item1];         }     }         return clamp(diff, -1, 1); }

Usage:
Code:
new players[32], pnum; GetTopPlayers(players, pnum, "ch"); // no bots or hltv new id; for( new i = 0; i < pnum; i++ ) {     id = players[i];         // player rank = i + 1     // player id = id } // #1 player = players[0] // #2 player = players[1] // ...
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
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 14:37.


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