Raised This Month: $51 Target: $400
 12% 

nvault_prune : Output all removed keys


Post New Thread Reply   
 
Thread Tools Display Modes
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 #11

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 #12

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
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-26-2018 , 16:01   Re: nvault_prune : Output all removed keys
Reply With Quote #13

You are good with the above code
__________________
Bugsy 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 14:01.


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