Raised This Month: $ Target: $400
 0% 

[Help] top15 fvault


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BhK
Junior Member
Join Date: Dec 2014
Location: India
Old 12-17-2014 , 21:39   [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 :-


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
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-18-2014 , 07:49   Re: [Help] top15 fvault
Reply With Quote #2

idk maybe motd size
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-18-2014 , 08:25   Re: [Help] top15 fvault
Reply With Quote #3

Maybe, by increasing the array sizes:
Code:
    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 ];
zmd94 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-18-2014 , 09:19   Re: [Help] top15 fvault
Reply With Quote #4

There is a good chance that you are hitting the 1536 character limit of the MOTD. If you wish to exceed that limit, you will need to host the page on a web server and then link to that instead
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
BhK
Junior Member
Join Date: Dec 2014
Location: India
Old 12-18-2014 , 09:21   Re: [Help] top15 fvault
Reply With Quote #5

Nope, not working ! same problem @zmd94.

Last edited by BhK; 12-18-2014 at 09:23.
BhK is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 12-18-2014 , 09:41   Re: [Help] top15 fvault
Reply With Quote #6

Quote:
Originally Posted by BhK View Post
Nope, not working ! same problem @zmd94.
Quote:
Originally Posted by YamiKaitou View Post
There is a good chance that you are hitting the 1536 character limit of the MOTD. If you wish to exceed that limit, you will need to host the page on a web server and then link to that instead
The another solution would be to clear up the html code ( remove spaces, tabs what ever )
make the code shorter.
.Dare Devil. is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-18-2014 , 10:13   Re: [Help] top15 fvault
Reply With Quote #7

Quote:
Originally Posted by YamiKaitou View Post
There is a good chance that you are hitting the 1536 character limit of the MOTD. If you wish to exceed that limit, you will need to host the page on a web server and then link to that instead
how can make the motd character more... like 4000
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-18-2014 , 10:21   Re: [Help] top15 fvault
Reply With Quote #8

Quote:
Originally Posted by YamiKaitou View Post
There is a good chance that you are hitting the 1536 character limit of the MOTD.
This is more acceptable.

Other suggestion is maybe by reducing the column width:
Code:
    <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" )
zmd94 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-18-2014 , 10:29   Re: [Help] top15 fvault
Reply With Quote #9

Quote:
Originally Posted by Natsheh View Post
how can make the motd character more... like 4000
You cannot increase the limit. If you have a need for more characters, then the page must be hosted on a web server
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 02:00.


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