Raised This Month: $180 Target: $400
 45% 

nvault_prune : Output all removed keys


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ish12321
Veteran Member
Join Date: May 2016
Old 05-17-2018 , 13:25   nvault_prune : Output all removed keys
Reply With Quote #1

Hey,
I'm using nvault_prune to remove entries. Is it possible to know the key of all those entries which got removed ?
__________________
['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-17-2018 , 18:40   Re: nvault_prune : Output all removed keys
Reply With Quote #2

Not with built-in nvault functions. You would need to read all using nvault utility, checking the timestamp of each to see if they are within the prune window, and then do your prune.
__________________
Bugsy is offline
ish12321
Veteran Member
Join Date: May 2016
Old 05-17-2018 , 20:08   Re: nvault_prune : Output all removed keys
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Not with built-in nvault functions. You would need to read all using nvault utility, checking the timestamp of each to see if they are within the prune window, and then do your prune.
How do we read all nvault keys? I didn't find a function for this. Also, do nvault_prune uses same logic or it uses some better logic, which might be faster ?
__________________
['O|s|G'] | Death Wins a.k.a Ish Chhabra was here
ish12321 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-18-2018 , 15:58   Re: nvault_prune : Output all removed keys
Reply With Quote #4

By using nVault Utility, which is a separate module, aka you need to download it.
__________________

Last edited by OciXCrom; 05-18-2018 at 15:58.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
ish12321
Veteran Member
Join Date: May 2016
Old 05-18-2018 , 23:32   Re: nvault_prune : Output all removed keys
Reply With Quote #5

Does it works with amxmodx latest dev build @bugsy?
__________________
['O|s|G'] | Death Wins a.k.a Ish Chhabra was here
ish12321 is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old 05-19-2018 , 03:31   Re: nvault_prune : Output all removed keys
Reply With Quote #6

Quote:
Originally Posted by ish12321 View Post
Does it works with amxmodx latest dev build @bugsy?
Short answer: Yes

It's reading from the vault as a file directly. If the natives exists in the version of AMXX, it works.
__________________
Black Rose is offline
Send a message via Skype™ to Black Rose
ish12321
Veteran Member
Join Date: May 2016
Old 05-19-2018 , 13:30   Re: nvault_prune : Output all removed keys
Reply With Quote #7

So, to use nvault_utility do I need replace all functions of nvault_open, nvault_lookup to those of nvault_util like nvault_util_open nvault_util_read or just use those of nvault_util which are needed by me.
__________________
['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-19-2018 , 13:41   Re: nvault_prune : Output all removed keys
Reply With Quote #8

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

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
Reply


Thread Tools
Display Modes

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 15:37.


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