Raised This Month: $ Target: $400
 0% 

nvault_prune : Output all removed keys


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-19-2018 , 13:41   Re: nvault_prune : Output all removed keys
Reply With Quote #1

No, you will continue to use nvault natives to read/save etc. nvault utility has it's own 'open' function which is only used with nvault utility functions, they are not interchangeable.
__________________

Last edited by Bugsy; 05-19-2018 at 13:42.
Bugsy is offline
ish12321
Veteran Member
Join Date: May 2016
Old 05-19-2018 , 14:43   Re: nvault_prune : Output all removed keys
Reply With Quote #2

Quote:
Originally Posted by Bugsy View Post
No, you will continue to use nvault natives to read/save etc. nvault utility has it's own 'open' function which is only used with nvault utility functions, they are not interchangeable.
Code:
    new iNVaultUtilHandle = nvault_util_open("GagVault");     new iPos, iTimeStamp, szAuthID[34], iEntryCount = nvault_util_count(iNVaultUtilHandle);     for(new i = 0; i < iEntryCount; i++)     {         iPos = nvault_util_read(iNVaultUtilHandle, iPos, szAuthID, charsmax(szAuthID), "", 0, iTimeStamp);         if(get_systime() >= iTimeStamp)         {             client_print(0, print_chat, "TRUE %s", szAuthID);             nvault_remove(g_iNVaultHandle, szAuthID);             new iTarget = find_player("c", szAuthID);             if(iTarget)             {                 g_bIsGagged[iTarget] = false;             }         }     }     nvault_util_close(iNVaultUtilHandle);

This is the code I'm using but it ain't working. Could you please point out the error ? Not sure, but I doubt with nvault_util open, I'm unable to remove the entry using nvault_remove()

This function is run every 5 seconds using set_task()
__________________
['O|s|G'] | Death Wins a.k.a Ish Chhabra was here

Last edited by ish12321; 05-19-2018 at 14:45.
ish12321 is offline
ish12321
Veteran Member
Join Date: May 2016
Old 05-24-2018 , 18:36   Re: nvault_prune : Output all removed keys
Reply With Quote #3

Bump
__________________
['O|s|G'] | Death Wins a.k.a Ish Chhabra was here
ish12321 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-26-2018 , 10:09   Re: nvault_prune : Output all removed keys
Reply With Quote #4

Code looks ok, but if the gags are occurring in the current map then nvault utility will not have the latest/real-time data until map change. To address this you can try closing the vault and re-opening it before executing your code. Should also store get_systime() in a variable instead of calling it multiple times.
PHP Code:
    nvault_closeg_iNVaultHandle );
    
g_iNVaultHandle nvault_open"GagVault" );
    
    new 
iNVaultUtilHandle nvault_util_open("GagVault");
    new 
iPosiTimeStampszAuthID[34], iEntryCount nvault_util_count(iNVaultUtilHandle);
    new 
iSysTime get_systime();
    
    for(new 
0iEntryCounti++)
    {
        
iPos nvault_util_read(iNVaultUtilHandleiPosszAuthIDcharsmax(szAuthID), ""0iTimeStamp);

        if ( 
iSysTime >= iTimeStamp )
        {
            
client_print(0print_chat"TRUE %s"szAuthID);

            
nvault_remove(g_iNVaultHandleszAuthID);

            new 
iTarget find_player("c"szAuthID);
            
            if ( 
iTarget )
            {
                
g_bIsGagged[iTarget] = false;
            }
        }
    }

    
nvault_util_close(iNVaultUtilHandle); 
__________________
Bugsy is offline
ish12321
Veteran Member
Join Date: May 2016
Old 05-26-2018 , 14:19   Re: nvault_prune : Output all removed keys
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
Code looks ok, but if the gags are occurring in the current map then nvault utility will not have the latest/real-time data until map change. To address this you can try closing the vault and re-opening it before executing your code. Should also store get_systime() in a variable instead of calling it multiple times.
PHP Code:
    nvault_closeg_iNVaultHandle );
    
g_iNVaultHandle nvault_open"GagVault" );
    
    new 
iNVaultUtilHandle nvault_util_open("GagVault");
    new 
iPosiTimeStampszAuthID[34], iEntryCount nvault_util_count(iNVaultUtilHandle);
    new 
iSysTime get_systime();
    
    for(new 
0iEntryCounti++)
    {
        
iPos nvault_util_read(iNVaultUtilHandleiPosszAuthIDcharsmax(szAuthID), ""0iTimeStamp);

        if ( 
iSysTime >= iTimeStamp )
        {
            
client_print(0print_chat"TRUE %s"szAuthID);

            
nvault_remove(g_iNVaultHandleszAuthID);

            new 
iTarget find_player("c"szAuthID);
            
            if ( 
iTarget )
            {
                
g_bIsGagged[iTarget] = false;
            }
        }
    }

    
nvault_util_close(iNVaultUtilHandle); 
Should I use nvault_util_readall or the way I'm using ?
__________________
['O|s|G'] | Death Wins a.k.a Ish Chhabra was here
ish12321 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 04:39.


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