Raised This Month: $ Target: $400
 0% 

[Help] top15 fvault


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff       
BhK
Junior Member
Join Date: Dec 2014
Location: India
Old 12-17-2014 , 21:30   [Help] top15 fvault
Reply With Quote #1

I have got the code to show fvault top 10 players, i want the plugin to show top 15 players, changes done in the code :-
PHP Code:

#define MAX_BUFFER_LENGTH       3047

new g_Top15MotdMAX_BUFFER_LENGTH ]

enum _:FvaultData {
    
gSteamID450 ],
    
gPointsData750 ]
}


public 
MakeTop15id )
{
    new 
iLen
    iLen 
formatexg_Top15MotdMAX_BUFFER_LENGTH,
    
"<html><head><meta charset=^"UTF-8^">\
    <body bgcolor=#242424 style=^"
color:#FFF^">\
    
<table width=100%% cellspacing=0 border=0>\
    <
tr align=center bgcolor=#444444>\
    
<th width=4%%>#\
    
<th width=30%% align=left>Player\
    <
th width=8%%>Kills\
    <
th width=8%%>Deaths\
    <
th width=8%%>HS\
    <
th width=8%%>Knife\
    <
th width=8%%>Grenade\
    <
th width=8%%>Bombs\
    <
th width=8%%>Defuses" )
    
    new Array:aKey = ArrayCreate(   450 )
    new Array:aData = ArrayCreate( 750 )
    new Array:aAll = ArrayCreate( FvaultData )
    
    fvault_load( g_VaultData, aKey, aData )
    
    new iArraySize = ArraySize( aKey )
    
    new Data[ FvaultData ]
    
    new i
    for( i = 0; i < iArraySize; i++ )
    {
        ArrayGetString( aKey, i, Data[ gSteamID ], sizeof Data[ gSteamID ] - 1 )
        ArrayGetString( aData, i, Data[ gPointsData ], sizeof Data[ gPointsData ] - 1 )
        
        ArrayPushArray( aAll, Data )
    }
    
    ArraySort( aAll, "
SortData" )
    
    new szKills[ 10 ];
    new szDeaths[ 10 ];
    new szHeadShots[ 10 ];
    new szKnifeKills[ 10 ];
    new szKnifeDeaths[ 10 ];
    new szGrenadeKills[ 10 ];
    new szGrenadeDeaths[ 10 ];
    new szBombPlanted[ 10 ];
    new szBombExplosions[ 10 ];
    new szBombDefusions[ 10 ];
    new szBombDefused[ 10 ];
    new szWonRounds[ 10 ];
    new szShots[ 10 ];
    new szDamage[ 10 ];
    new szTeamKills[ 10 ];
    new szBestKills[ 10 ];
    new szBestDeaths[ 10 ];
    
    
    
    new szName[ 32 ]
    new iSize = clamp( iArraySize, 0, 15 )
    
    new j
    for( j = 0; j < iSize; j++ )
    {
        ArrayGetArray( aAll, j, Data )
        
        fvault_get_data( g_VaultNames, Data[ gSteamID ], szName, charsmax( szName ) )
        
        replace_all( szName, charsmax( szName ), "
<", "[" )
        replace_all( szName, charsmax( szName ), "
>", "]" )
        
        parse(Data[ gPointsData ],
        szKills, sizeof szKills,
        szDeaths, sizeof szDeaths,
        szHeadShots, sizeof szHeadShots,
        szKnifeKills, sizeof szKnifeKills,
        szKnifeDeaths, sizeof szKnifeDeaths,
        szGrenadeKills, sizeof szGrenadeKills,
        szGrenadeDeaths, sizeof szGrenadeDeaths,
        szBombPlanted, sizeof szBombPlanted,
        szBombExplosions, sizeof szBombExplosions,
        szBombDefusions, sizeof szBombDefusions,
        szBombDefused, sizeof szBombDefused,
        szWonRounds, sizeof szWonRounds,
        szShots, sizeof szShots,
        szDamage, sizeof szDamage,
        szTeamKills, sizeof szTeamKills,
        szBestKills, sizeof szBestKills,
        szBestDeaths, sizeof szBestDeaths);
        
        if(equal(g_iAuthData[ id ], Data[ gSteamID ]))
        {
            iLen += formatex( g_Top15Motd[ iLen ], MAX_BUFFER_LENGTH - iLen, "
<tr align=center bgcolor=#333333>" )
        
}
        else
        {
            
iLen += formatexg_Top15MotdiLen ], MAX_BUFFER_LENGTH iLen"<tr align=center>" )
        }
        
iLen += formatexg_Top15MotdiLen ], MAX_BUFFER_LENGTH iLen"<td>%i<td align=left>%s<td>%s<td>%s<td>%s<td>%s<td>%s<td>%s<td>%s",  1szNameszKillsszDeathsszHeadShotsszKnifeKillsszGrenadeKillsszBombExplosionsszBombDefused )
    }
    
    
iLen += formatexg_Top15MotdiLen ], MAX_BUFFER_LENGTH iLen"</table><center>The code added to check ***</center></body></html>" )
    
    
ArrayDestroyaKey )
    
ArrayDestroyaData )
    
ArrayDestroyaAll )
}


public 
SortData( Array:aArrayiItem1iItem2iData[ ], iDataSize )
{
    new 
Data1FvaultData ]
    new 
Data2FvaultData ]
    
    
ArrayGetArrayaArrayiItem1Data1 )
    
ArrayGetArrayaArrayiItem2Data2 )
    
    new 
szPoints_1]
    
parseData1gPointsData ], szPoints_1charsmaxszPoints_1 ) )
    
    new 
szPoints_2]
    
parseData2gPointsData ], szPoints_2charsmaxszPoints_2 ) )
    
    new 
iCount1 str_to_numszPoints_1 )
    new 
iCount2 str_to_numszPoints_2 )
    
    return ( 
iCount1 iCount2 ) ? -: ( ( iCount1 iCount2 ) ? )

The result i got :-
http://www.mediafire.com/convkey/afb....jpg?size_id=6

I have added the following html code to check if array size is enough !
PHP Code:
iLen += formatexg_Top15MotdiLen ], MAX_BUFFER_LENGTH iLen"</table><center>The code added to check ***</center></body></html>" 
It show's the top 12 players perfectly, but not 13 ,14 and 15
BhK is offline
BhK
Junior Member
Join Date: Dec 2014
Location: India
Old 12-17-2014 , 21:38   Re: [Help] top15 fvault
Reply With Quote #2

OOps ! posted on the wrong forum !
BhK 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 01:43.


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