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

nVault Tutorial


Post New Thread Reply   
 
Thread Tools Display Modes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-18-2012 , 22:48   Re: nVault
Reply With Quote #41

Quote:
Originally Posted by Bugsy View Post
That will delete all entries. start=0 with end=get_systime() would delete all; in addition you are adding excess days onto now which says delete everything from the start of time until 15 days from now. Change + to - and it is good, as I posted in #37.
Yeah, I wasn't thinking when I used the wrong operator.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 02-19-2012 , 06:07   Re: nVault
Reply With Quote #42

Wow thanks for your explanation bugsy.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
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
yan1255
Senior Member
Join Date: Jul 2011
Old 03-03-2013 , 13:35   Re: nVault
Reply With Quote #44

Why do you remove the vault?

Code:
public cmdGetMoney(id)
{
    //Retrieve a single item from vault
    //Example: STEAM_0:0:1234 16000

    new szKey[40];
    formatex( szKey , charsmax( szKey ) , "%sMONEY" , g_szAuthID[id] );
    new iMoney = nvault_get( g_Vault , szKey );

    //If our money key was found, set the users money to the value we read from vault and
    //delete the key so the player will not get the same money again.
    if ( iMoney )
    {
        cs_set_user_money( id , iMoney , 1 );
        nvault_remove( g_Vault , szKey );

        client_print( id , print_chat , "* Your money was loaded from vault: $%d" , iMoney );
    }
    else
    {
        client_print( id , print_chat , "* You have no money entry in vault." );
    }
}
__________________
yan1255 is offline
Old 03-03-2013, 18:03
hleV
This message has been deleted by hleV.
Killer zm
Senior Member
Join Date: Jun 2011
Old 03-06-2013 , 08:52   Re: nVault
Reply With Quote #45

if i have

key and value

and i want to remove all keys that having null value

if a key have value == 0 , remove that key ...

how to do this ?
Killer zm is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 10-31-2013 , 05:16   Re: nVault
Reply With Quote #46

Bugsy
Your example plugin is giving the wrong value, for example my current:
Score - 4
Death - 0

But output print is "* Your score was loaded: 4 0 kills, 0 deaths"

How to make it "* Your score was loaded: 4 kills, 0 deaths" ?

Last edited by yokomo; 10-31-2013 at 05:17.
yokomo is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-02-2013 , 10:11   Re: nVault
Reply With Quote #47

Did you modify the code at all? I'm 99.9999% sure I tested it before posting.
__________________
Bugsy is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 11-02-2013 , 10:41   Re: nVault
Reply With Quote #48

Quote:
Originally Posted by Bugsy View Post
Did you modify the code at all? I'm 99.9999% sure I tested it before posting.
No, i'm copy your code in 1st page and compile in my pc, tested and then it show that result. You can re-test it.
yokomo is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-02-2013 , 12:34   Re: nVault
Reply With Quote #49

Because you don't use parse native.
I'm also curious about str_to_num("4 0") result.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 11-02-2013 at 12:34.
ConnorMcLeod is offline
PreDominance
Member
Join Date: Jul 2014
Old 07-08-2014 , 01:22   Re: nVault
Reply With Quote #50

Is it better to use multiple nVaults (one for each player), where each player has 100+ kv pairs, or just one big one with 10k+ kv pairs?
PreDominance 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 16:58.


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