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

Nvault Issues


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 03-14-2012 , 10:25   Nvault Issues
Reply With Quote #1

Am not sure if this is the right section to post this , but anyways....

If i use Nvault to save data and the server crashes , does it reset the data stored?
EpicMonkey is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-14-2012 , 10:29   Re: Nvault Issues
Reply With Quote #2

It might if the vault was still open. Why don't you try just ending the server's process after you did something that should change the vault data, then check if the data was saved?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 03-14-2012 , 10:29   Re: Nvault Issues
Reply With Quote #3

If the vault file is opened at map start and closed at map end and the server crashes you will loose those data. If you open / close each time when your function is called, your data will remain.
killergirl is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 03-14-2012 , 10:33   Re: Nvault Issues
Reply With Quote #4

Quote:
Originally Posted by Exolent[jNr] View Post
It might if the vault was still open. Why don't you try just ending the server's process after you did something that should change the vault data, then check if the data was saved?
I did and it works

Quote:
Originally Posted by killergirl View Post
If the vault file is opened at map start and closed at map end and the server crashes you will loose those data. If you open / close each time when your function is called, your data will remain.
Similar to what Bugsy said , Ill try it : http://forums.alliedmods.net/showthr...=nvault+issues

Edit : I open nvault when player connects and load his data then close it asap , similar case when he disconnects

Last edited by EpicMonkey; 03-14-2012 at 10:38.
EpicMonkey is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 03-14-2012 , 10:55   Re: Nvault Issues
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>

new g_Vault

public plugin_init(){
    
register_plugin("_""_""_")

    
set_task(10.0"addf")
}

public 
plugin_cfg() { g_Vault nvault_open("vault_test"); }
public 
plugin_end() { g_Vault nvault_close(g_Vault); }

public 
addf(){
    static 
data[32], md5b[34], val[5]
    
    
formatex(data31"%d"random(99) + random(99))
    
formatex(val4"%d"random(100))
    
    
md5(datamd5b)
    
    new 
20k
    
    
while(n){
        
nvault_set(g_Vaultmd5bval)
        
k++
    }
    
    
server_print("Crash...")
    
set_task(0.1"A"___"a"3000)
}

public 
A() { set_task(0.1"A"___"b"); } 
killergirl is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 03-15-2012 , 03:40   Re: Nvault Issues
Reply With Quote #6

Here is what am talking about , Its just an example

PHP Code:
public client_disconnect(id)
{
    
Save(id);
}

public 
client_putinserver(id)
{
    
Load(id);
}

public 
Loadid 
{
    new 
vault nvault_open("Test")
    
    new 
AuthID[33];
    new 
vaultkey[64], vaultdata[64];

    
get_user_authid(idAuthID32);
    
    
format(vaultkey63"Example%s"AuthID);
    
    
nvault_get(vaultvaultkeyvaultdata63);
    
nvault_close(vault);
    
    return 
str_to_num(vaultdata);
}

public 
Save(id,PlayedTime)
{
    new 
vault nvault_open("Test")
    
    if(
vault == INVALID_HANDLE)
        
set_fail_state("nVault returned invalid handle")
    
    new 
szAuthID[33];
    new 
vaultkey[64], vaultdata[64];
    
    
get_user_authid(idAuthID32)
    
    
format(vaultkey63"Example%s"AuthID); 
    
format(vaultdata63"%d"XXXData); 
    
    
nvault_set(vaultvaultkeyvaultdata);
    
nvault_close(vault);


Last edited by EpicMonkey; 03-16-2012 at 04:11.
EpicMonkey is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-15-2012 , 09:36   Re: Nvault Issues
Reply With Quote #7

Then no, unless it crashes during loading before it can close the vault.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 03-15-2012 , 10:55   Re: Nvault Issues
Reply With Quote #8

Hmm , then would it be better to use sql? or is it gonna have the same result?
EpicMonkey 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 01:45.


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