Thread: nVault Tutorial
View Single Post
Killer zm
Senior Member
Join Date: Jun 2011
Old 12-28-2012 , 09:48   Re: nVault
Reply With Quote #43

if i am closing nvault and reopen with an set task interval 120 .. this will be very laggy ?

#define AUTOSAVE_INTERVAL 120.0

public plugin_cfg()
{
set_task(AUTOSAVE_INTERVAL, "TaskAutoSave",_,_,_,"b")
}

and is saving like this

PHP Code:
public TaskAutoSave()
{
    for(new 
id 1id <= g_maxplayersid++)
    {       
        if(
is_user_connected(id) && flag_get(g_loadSuccess,id)) SaveAmmo(id);
    }
}

SaveAmmo(id)
{
   
    
gvault nvault_open(g_vault_name);
   
    if(!
flag_get(g_loadSuccess,id))
    {
        
server_print("[AutoSaveAmmoPack] User [%i] failed to save AP because it not loaded yet!"id)
        return
    }
   
    
g_ammo[id] = zp_get_user_ammo_packs(id)
   
    new 
authid[35]
    
get_user_authid(idauthidsizeof(authid) - 1)
   
    new 
data[16]
    
num_to_str(g_ammo[id], datasizeof(data) - 1)
   
    
nvault_set(gvaultauthiddata)
   
    
nvault_close(gvault);

i realy need this kind of saving for prevent losing data on crash ... i was using fvault system before and i knew that nvault is more faster ... but i was thinking if this kind of using nvault will be more laggy then fvault ?

Last edited by Killer zm; 12-28-2012 at 09:52.
Killer zm is offline