Raised This Month: $ Target: $400
 0% 

Sort all arrays with one func


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 01-28-2017 , 16:17   Re: Sort all arrays with one func
Reply With Quote #3

No, I mean ALL ARRAYS with just one SortCustom. And I meant not the ShortCustom1D, its not possible, I mean another custom function for it. As I said.

PHP Code:
enum PlayerDatas
{
       
arItemsBought,
       
arShoots,
       
arKills,
}

new 
PlayerData[33][PlayerDatas
PHP Code:

GetTop
(PlayerData[id][arKills])

GetTop(arArray[])
{
    new 
iPlayers[32], iPlayersnumPlayer;
    
    
get_players(iPlayersiPlayersnum)
    
    for(new 
i;iPlayersnum;i++)
    {
        
Player iPlayers[i]
        
        
SortCustom(PlayeriPlayersnumarArray)
    }
    return 
Player[0]
}

SortCustom(elem1elem2arArray[]) 
{
    if(
arArray[elem1] > arArray[elem2])
        return -
1
        
    
else if(arArray[elem1] < arArray[elem2])
        return 
1
        
    
return 0

I want return the player's index that have the most array's size. Example:

PHP Code:
for(new i;get_maxplayers();i++)
      
checkChance(ev_BestKillsGetTop(PlayerData[i][arKills]) 
the GetTop should return the player's index that have the most kills. You understand ? Because on the checkChance(), the second parameter is the player's index, I have it there:

PHP Code:
if(iIndex)
{
     new 
userName[32]
     
get_user_name(iIndexuserNamecharsmax(userName))

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 01-28-2017 at 16:53.
EFFx is offline
 



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 20:58.


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