Raised This Month: $51 Target: $400
 12% 

need help with level determine


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 05-15-2012 , 21:48   need help with level determine
Reply With Quote #1

Hi all, I'm confused how to determine there were the same level in the server.
e.g:

in the server, there were 32 players, and the level like
PHP Code:
level[32] = {1,1,1,2,2,3,3,3,3,12,12,9,8,5,5,14,14,15,15,13,13,20,25,25,42,42,32,32,20,20,20,21}; 
and I want to get the same level count and player index
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 05-15-2012 , 22:45   Re: need help with level determine
Reply With Quote #2

Code:
new count[100]
for(new i=0; i<32; i++)
{
new k = level[i]
count[k]++
}
like that? Counting how many people have each level.
Liverwiz is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 05-16-2012 , 00:31   Re: need help with level determine
Reply With Quote #3

you don't know what I mean,
I want to show a message like:

Level A: name1,name2
Level B: name3,name4
...
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 05-16-2012 , 07:45   Re: need help with level determine
Reply With Quote #4

Can you explain it better?
__________________
  • Point System with rank titles for sale [X] [100% private]
  • VIP Menu for sale [X] [100% private]
  • HnS shop more features for sale [X] [100% private]
Contact: Bilalzaandam1234, on steam if you are interested.
Bilal Pro is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-16-2012 , 09:44   Re: need help with level determine
Reply With Quote #5

Something like this:
Code:
#include <amxmodx> #define MAX_PLAYERS 32 // Global array holding each player's level new gLevel[MAX_PLAYERS + 1]; SomeFunction() {     // Get all players     new players[32], pnum;     get_players(players, pnum, "h");         // Sort all players with custom callback     SortCustom1D(players, pnum, "ComparePlayerLevels");         // Keep track of last level, default as no level found yet     new lastLevel = -1;         // Prepare level, name, and message variables for loop     new id, level, name[32], message[192], len;         // Loop through all players     for(new i = 0; i < pnum; i++) {         // Grab the player index         id = players[i];                 // Grab this player's level         level = gLevel[id];                 // Grab this player's name         get_user_name(id, name, charsmax(name));                 // Check if this level is different from last         if(level > lastLevel) {             // Check if there was a level already put in the message             if(len) {                 // Print the message                 client_print(0, print_chat, "%s", message);             }                         // Add the level name and first player to message             len = formatex(message, charsmax(message), "Level %d: %s", level, name);         } else {             // Add the player's name to the end of this level's message             len += formatex(message[len], charsmax(message) - len, ", %s", name);         }     }         // Check if there was message text left over     if(len) {         // Print the message         client_print(0, print_chat, "%s", message);     } } public ComparePlayerLevels(index1, index2, players[], data[], dataSize) {     // Grab levels for both players     new level1 = level[players[index1]];     new level2 = level[players[index2]];         // Give back proper return value from level comparisons     if(level1 < level2) return -1;     if(level1 > level2) return  1;         // Levels are the same     return 0; }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 05-17-2012 , 21:53   Re: need help with level determine
Reply With Quote #6

thx man(maybe I'm right), I have got you thinking !
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-18-2012 , 00:13   Re: need help with level determine
Reply With Quote #7

Quote:
Originally Posted by K.K.Lv View Post
thx man(maybe I'm right), I have got you thinking !
Yes, you're right. This didn't take much thinking
__________________
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 13:52.


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