Raised This Month: $ Target: $400
 0% 

How can i read all data in a fvault file?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-17-2010 , 16:48   Re: How can i read all data in a fvault file?
Reply With Quote #6

You will need to use nvault utility for this. I posted 2 methods, one allows you to have a for loop to iterate through all or you can use the readall method where everything is done for you.

nvault_util

PHP Code:
#include <amxmodx>
#include <nvault_util>

new g_szKeys512 ] , g_iKeyPos;
new 
g_szValues512 ] , g_iValPos;
new 
g_iVault;

public 
plugin_init()
{
    
g_iVault nvault_util_open"YourVaultFile" );
    
    
UsingLoop();
    
//UsingForward();
    
    
new iNumSaved nvault_util_countg_iVault );
    
    
server_print"Total items=%d" iNumSaved )
    
server_printg_szKeys );
    
server_printg_szValues );
    
    
nvault_util_closeg_iVault );
}

public 
UsingForward() 
{
    
g_iKeyPos 0;
    
g_iValPos 0;

    
nvault_util_readallg_iVault "fw_Nvault_ReadAll" );
}

public 
UsingLoop()
{
    new 
iPos iNumSaved nvault_util_countg_iVault );
    new 
szKey32 ] , szVal10 ] , iTS;
    
    
g_iKeyPos 0;
    
g_iValPos 0;

    for ( new 
iNumSaved i++ )
    {
        
iPos nvault_util_readg_iVault iPos szKey charsmaxszKey ) , szVal charsmaxszVal ) , iTS );
    
        
g_iKeyPos += formatexg_szKeysg_iKeyPos ] , charsmaxg_szKeys ) - g_iKeyPos "%s - " szKey );
        
g_iValPos += formatexg_szValuesg_iValPos ] , charsmaxg_szValues ) - g_iValPos "%s - " szVal );
    }
}

public 
fw_Nvault_ReadAlliCurrent iTotal , const szKey[] , const szVal[] , iTimeStamp )
{
    
g_iKeyPos += formatexg_szKeysg_iKeyPos ] , charsmaxg_szKeys ) - g_iKeyPos "%s - " szKey );
    
g_iValPos += formatexg_szValuesg_iValPos ] , charsmaxg_szValues ) - g_iValPos "%s - " szVal );

__________________

Last edited by Bugsy; 10-17-2010 at 17:00.
Bugsy is offline
 



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:25.


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