AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   clearing vault (https://forums.alliedmods.net/showthread.php?t=189500)

striker07 07-07-2012 17:32

clearing vault
 
How can i clear a vault on a efficient way?
nvault_prune, nvault_pset or both?

(is nvault_pset correct in this code block?)
PHP Code:

public clear_vault()
{
 if(
g_iVault) {
  
nvault_prune(g_iVault0get_systime())
  
nvault_pset g_iVault"0""0" 
  
client_printcolor(0"/gVault succesfully reset")
 }
 else
  
client_print(0print_chat"Failed to find the vault")



Bugsy 07-07-2012 18:37

Re: clearing vault
 
nvault_prune( vault , 0 , get_systime() )

This will not remove entries written with pset, for that you can use nvault_util include to read entries and delete them manually.

striker07 07-07-2012 19:37

Re: clearing vault
 
how do i do that?
can you show me how you code to clear the vault from all data

Santaaa 07-07-2012 21:03

Re: clearing vault
 
Just delete the file located in ur data folder.

Liverwiz 07-07-2012 23:22

Re: clearing vault
 
Quote:

Originally Posted by Santaaa (Post 1745715)
Just delete the file located in ur data folder.

THAT'S THE SPIRIT!
Do it the admin way. :D
or you can use delete_file ;)

Kreation 07-07-2012 23:28

Re: clearing vault
 
Quote:

Originally Posted by Santaaa (Post 1745715)
Just delete the file located in ur data folder.

What if he wants it to automatically reset after a period of time.

striker07 07-08-2012 06:36

Re: clearing vault
 
Yes, and also from my expierence deleting the vault doesnt nescsearely clear it.
I've done it before and also deleted the journal file and the plugin vault was bugged then idk why but it wasnt working anymore.

So like kreation said I need to know how to code it for like when i want to do it manually from ingame (wich is so much faster) or when i decide to add a function that clears all data in the vault after a period of time.

so can anyone tell me the best way to clear a vault effecient (through coding).

grtz

Liverwiz 07-08-2012 10:23

Re: clearing vault
 
don't use pset. just use nvault_set if you want to be able to clear all entries. pset is for more like identifiers, or notes or things that you don't want to get rid of. Hence p(ermanent)set

In answer to your original question. If your data is saved using nvault_set just use nvault_prune(g_iVault, 0, get_systime())

Bugsy 07-08-2012 11:10

Re: clearing vault
 
Quote:

Originally Posted by Bugsy (Post 1745650)
nvault_prune( vault , 0 , get_systime() )

This will not remove entries written with pset, for that you can use nvault_util include to read entries and delete them manually.

Delete everything in vault, including pset entries, with nvault_utility
PHP Code:

ClearVaultiVault , const szVault[] )
{
    
nvault_pruneiVault get_systime() );
    
    new 
iUtilVault;
    
    if ( ( 
iUtilVault nvault_util_openszVault ) ) )
    {
        new 
iCount iPos szKey256 ] , szVal] , iTS;
        
        if ( ( 
iCount nvault_util_countiUtilVault ) ) )
        {
            for ( new 
iCount i++ )
            {
                
iPos nvault_util_readiUtilVault iPos szKey charsmaxszKey ) , szVal charsmaxszVal ) , iTS );
                
nvault_removeiVault szKey );
            }
        }
        
nvault_util_closeiUtilVault );
    }



striker07 07-08-2012 13:56

Re: clearing vault
 
Quote:

Originally Posted by Liverwiz (Post 1746068)
don't use pset. just use nvault_set if you want to be able to clear all entries. pset is for more like identifiers, or notes or things that you don't want to get rid of. Hence p(ermanent)set

In answer to your original question. If your data is saved using nvault_set just use nvault_prune(g_iVault, 0, get_systime())

thanks but that doesnt clear the vault when the server does that, nothing happends.

I'm gonna try the code you gave bugsy, I hope it will work becous I cant delete my vault anymoer :s i deleted it 3times but it always seems to come back automaticly with all the data intact, very strange


All times are GMT -4. The time now is 15:20.

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