Quote:
Originally Posted by hornet
There's no other way to read all entries than nvault_util_readall().
|
ok ive been looking into this and so far ive managed to get this.
and the code to get this is
Code:
public test( id )
{
new iPos , szKey[ 32 ] , szVal[ 64 ] , iTimeStamp;
new iVault = nvault_util_open( "Last_Man" );
new iCount = nvault_util_count( iVault );
for ( new iCurrent = 1 ; iCurrent <= iCount ; iCurrent++ )
{
iPos = nvault_util_read( iVault , iPos , szKey , charsmax( szKey ) , szVal , charsmax( szVal ) , iTimeStamp );
server_print( "[%d of %d] Name: %s LMS Count: %s" , iCurrent , iCount , szKey , szVal );
}
nvault_util_close( iVault );
}
how do i edit it so i can use this in my Top15?
Code:
public ShowTop15( id )
{
static Sort[ 33 ][ 2 ];
new players[ 32 ], num, count, index;
get_players( players, num );
// This Only Shows Online Players In Top15
for( new i = 0; i < num; i++ )
{
index = players[ i ];
Sort[ count ][ 0 ] = index;
Sort[ count ][ 1 ] = g_iLastManCount[ index ];
count++;
}
SortCustom2D( Sort, count, "compare_lms");
new motd[ 1501 ], iLen;
iLen = format( motd, charsmax( motd ), "<body background='http://i.snapthat.net/cXiy.png'><font color=#98f5ff size=4><b><pre>");
iLen += format( motd[ iLen ], ( charsmax( motd ) ) - iLen,"%s %-22.22s %3s^n", "#", "Name", "LMS Count");
new y = clamp( count, 0, 15 );
new name[ 32 ], kindex;
for( new x = 0; x < y; x++ )
{
kindex = Sort[ x ][ 0 ];
get_user_name( kindex, name, charsmax( name ) );
iLen += format( motd[ iLen ], ( charsmax( motd ) ) - iLen,"%d %-22.22s %d^n", x + 1, name, Sort[ x ][ 1 ]);
}
iLen += format( motd[ iLen ], ( charsmax( motd ) ) - iLen, "</body></font></b></pre>" );
show_motd( id, motd, "Last Man Standing Top15" );
}
public compare_lms( elem1[], elem2[] )
{
if(elem1[ 1 ] > elem2[ 1 ])
return -1;
else if(elem1[ 1 ] < elem2[ 1 ])
return 1;
return 0;
}
__________________