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-30-2017 , 12:45   Re: Sort all arrays with one func
Reply With Quote #8

Sorry about the cl_buy, I tought you knew where to download it - https://forums.alliedmods.net/showthread.php?t=149380

About the debug, that's what I was doing, Bugsy already told me to always do it when something return a invalid value:

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

enum Settings
{
    
arPlayerKills,
}

new 
PlayerData[33][Settings]

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("DeathMsg","death","a")
    
    
set_task(1.0,"showHud",. flags "b")
}

public 
death()
{
    
PlayerData[read_data(1)][arPlayerKills]++
}
public 
showHud()
{
    new 
iMostSays GetTop(arPlayerKills)
    
    new 
UserName[32]
    
get_user_name(iMostSaysUserName31)
    
set_hudmessage(0,255,0, -1.00.001.01.0)
    
show_hudmessage(0,"First Player: %s, Kills: %d",UserNamePlayerData[iMostSays][arPlayerKills])
}

GetTop(Settings:arOffset)
{
    new 
Players[32], iPlayersnumdata[1]

    
data[0] = any:arOffset
    
    get_players
(PlayersiPlayersnum)
    
SortCustom1D(PlayersiPlayersnum"SortCustom"data1)

    return 
Players[0]
}

public 
SortCustom(elem1elem2, array[], data[], datasize
{
    new 
Settings:arOffset

    
if(!datasize)
        
arOffset Settings:data[0]

    if(
PlayerData[elem1][arOffset] > PlayerData[elem2][arOffset])
        return -
1

    
else if(PlayerData[elem1][arOffset] < PlayerData[elem2][arOffset])
        return 
1

    
return 0

I have 7 kills and the bot have 4, it shows the bot's name, not mine.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

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

Last edited by EFFx; 01-30-2017 at 12:46.
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