AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] top15 fvault (https://forums.alliedmods.net/showthread.php?t=253213)

BhK 12-17-2014 21:39

[Help] top15 fvault
 
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

Natsheh 12-18-2014 07:49

Re: [Help] top15 fvault
 
idk maybe motd size

zmd94 12-18-2014 08:25

Re: [Help] top15 fvault
 
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 ];


YamiKaitou 12-18-2014 09:19

Re: [Help] top15 fvault
 
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

BhK 12-18-2014 09:21

Re: [Help] top15 fvault
 
Nope, not working ! same problem @zmd94.

.Dare Devil. 12-18-2014 09:41

Re: [Help] top15 fvault
 
Quote:

Originally Posted by BhK (Post 2236794)
Nope, not working ! same problem @zmd94.

Quote:

Originally Posted by YamiKaitou (Post 2236793)
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.

Natsheh 12-18-2014 10:13

Re: [Help] top15 fvault
 
Quote:

Originally Posted by YamiKaitou (Post 2236793)
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

zmd94 12-18-2014 10:21

Re: [Help] top15 fvault
 
Quote:

Originally Posted by YamiKaitou (Post 2236793)
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" )


YamiKaitou 12-18-2014 10:29

Re: [Help] top15 fvault
 
Quote:

Originally Posted by Natsheh (Post 2236808)
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


All times are GMT -4. The time now is 15:20.

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