Raised This Month: $ Target: $400
 0% 

Top15 Sorting From nVault


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 04-30-2013 , 00:50   Re: Top15 Sorting From nVault
Reply With Quote #1

There's no other way to read all entries than nvault_util_readall().
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 05-10-2013 , 00:13   Re: Top15 Sorting From nVault
Reply With Quote #2

Quote:
Originally Posted by hornet View Post
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; }
__________________
Blizzard_87 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 10:47.


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