AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   nvault_prune : Output all removed keys (https://forums.alliedmods.net/showthread.php?t=307603)

ish12321 05-17-2018 13:25

nvault_prune : Output all removed keys
 
Hey,
I'm using nvault_prune to remove entries. Is it possible to know the key of all those entries which got removed ?

Bugsy 05-17-2018 18:40

Re: nvault_prune : Output all removed keys
 
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.

ish12321 05-17-2018 20:08

Re: nvault_prune : Output all removed keys
 
Quote:

Originally Posted by Bugsy (Post 2592611)
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 ?

OciXCrom 05-18-2018 15:58

Re: nvault_prune : Output all removed keys
 
By using nVault Utility, which is a separate module, aka you need to download it.

ish12321 05-18-2018 23:32

Re: nvault_prune : Output all removed keys
 
Does it works with amxmodx latest dev build @bugsy?

Black Rose 05-19-2018 03:31

Re: nvault_prune : Output all removed keys
 
Quote:

Originally Posted by ish12321 (Post 2592733)
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.

ish12321 05-19-2018 13:30

Re: nvault_prune : Output all removed keys
 
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.

Bugsy 05-19-2018 13:41

Re: nvault_prune : Output all removed keys
 
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.

ish12321 05-19-2018 14:43

Re: nvault_prune : Output all removed keys
 
Quote:

Originally Posted by Bugsy (Post 2592790)
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()

ish12321 05-24-2018 18:36

Re: nvault_prune : Output all removed keys
 
Bump


All times are GMT -4. The time now is 04:39.

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