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_szKeys[ 512 ] , g_iKeyPos;
new g_szValues[ 512 ] , g_iValPos;
new g_iVault;
public plugin_init()
{
g_iVault = nvault_util_open( "YourVaultFile" );
UsingLoop();
//UsingForward();
new iNumSaved = nvault_util_count( g_iVault );
server_print( "Total items=%d" , iNumSaved )
server_print( g_szKeys );
server_print( g_szValues );
nvault_util_close( g_iVault );
}
public UsingForward()
{
g_iKeyPos = 0;
g_iValPos = 0;
nvault_util_readall( g_iVault , "fw_Nvault_ReadAll" );
}
public UsingLoop()
{
new iPos , iNumSaved = nvault_util_count( g_iVault );
new szKey[ 32 ] , szVal[ 10 ] , iTS;
g_iKeyPos = 0;
g_iValPos = 0;
for ( new i = 0 ; i < iNumSaved ; i++ )
{
iPos = nvault_util_read( g_iVault , iPos , szKey , charsmax( szKey ) , szVal , charsmax( szVal ) , iTS );
g_iKeyPos += formatex( g_szKeys[ g_iKeyPos ] , charsmax( g_szKeys ) - g_iKeyPos , "%s - " , szKey );
g_iValPos += formatex( g_szValues[ g_iValPos ] , charsmax( g_szValues ) - g_iValPos , "%s - " , szVal );
}
}
public fw_Nvault_ReadAll( iCurrent , iTotal , const szKey[] , const szVal[] , iTimeStamp )
{
g_iKeyPos += formatex( g_szKeys[ g_iKeyPos ] , charsmax( g_szKeys ) - g_iKeyPos , "%s - " , szKey );
g_iValPos += formatex( g_szValues[ g_iValPos ] , charsmax( g_szValues ) - g_iValPos , "%s - " , szVal );
}
__________________