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

Solved [nVault] Invalid vault id: 0


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Catalinn
Junior Member
Join Date: Aug 2023
Old 08-11-2023 , 16:37   [nVault] Invalid vault id: 0
Reply With Quote #1

i am getting this error continuously and my eyes do not see the error, could you guide me a bit? thank you

PHP Code:
L 08/11/2023 20:11:21Start of error session.
L 08/11/2023 20:11:21Info (map "zm_vendetta") (file "addons/amxmodx/logs/error_20230811.log")
L 08/11/2023 20:11:21: [nVaultInvalid vault id0

L 08
/11/2023 20:11:21: [AMXXDisplaying debug trace (plugin "zombie_xp.amxx")
L 08/11/2023 20:11:21: [AMXXRun time error 10native error (native "nvault_set")
L 08/11/2023 20:11:21: [AMXX]    [0zombie_xp.sma::save_data (line 740)
L 08/11/2023 20:11:21: [AMXX]    [1zombie_xp.sma::fw_svshutdown (line 843
PHP Code:
public save_data(id)
{
        new 
vaultkey[40],vaultData[256];
               
        new 
g_selected_zclass[sizeof g_zclass_load[]] , g_selected_hclass[sizeof g_hclass_load[]] //bug fix for not showing menu if the user hasnt picked a zombie
        
if( g_hclass_showmenu[id] == true) { g_selected_hclass "-1"; } else { formatex(g_selected_hclasssizeof g_selected_hclass 1g_hclass_load[g_humanclassnext[id]]); }
        if( 
g_zclass_showmenu[id] == true) { g_selected_zclass "-1"; } else { formatex(g_selected_zclasssizeof g_selected_zclass -1g_zclass_load[g_zombieclassnext[id]]); }
       
        
formatexvaultkeysizeof vaultkey 1"%s_stats"userNameID[id]);
        
formatexvaultDatasizeof vaultData 1"0=%i;1=%s;2=%s;"userLevel[id], g_selected_hclassg_selected_zclass);
       
        
nvault_set(gvaultvaultkeyvaultData); // <--- line 740 error
    
log_to_file("NIVELES.txt""El jugador %s tiene nivel %i"userNameID[id], userLevel[id]);

PHP Code:
public fw_svshutdown(id)
{
    
// Save the data
        
save_data(id); // <---- line 843 next error

nvault was opened in plugin_init()
PHP Code:
gvault nvault_open(PLUGIN_NAME); 

Last edited by Catalinn; 08-14-2023 at 09:15.
Catalinn is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-12-2023 , 01:19   Re: [nVault] Invalid vault id: 0
Reply With Quote #2

Are you closing it somewhere in code? Are you ensuring it opens with a valid handle?
__________________

Last edited by Bugsy; 08-12-2023 at 01:20.
Bugsy is offline
Catalinn
Junior Member
Join Date: Aug 2023
Old 08-12-2023 , 12:41   Re: [nVault] Invalid vault id: 0
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Are you closing it somewhere in code? Are you ensuring it opens with a valid handle?
I have the only closure here, what else would I need ??

PHP Code:
public plugin_end()
{
        if( 
get_pcvar_num(cvar_removexp) == 0)
        {
                
// Save everyone's data first
                
server_print("%s Saving your clients XP."textHeader);
       
                for( new 
133o++)
                {
                        
//if ( !is_user_connected(o) || is_user_bot(o) ) continue;
                        
if ( !is_user_connected(o) ) continue;
                        if ( 
is_user_bot(o) ) continue;
                       
                        
save_data(o);
                }
        }
 
        
nvault_close(gvault)
       
        
//Bugfix:
        
if( (loadedZombies == false) && ( get_pcvar_num(cvar_removezombie) == ))
        {
                
set_pcvar_num(cvar_removezombie0);
                
set_cvar_num("zp_zombie_classes"0)   
        }


I've tried this way and I didn't get the error again, i'm not sure if it would be valid..


from this
PHP Code:
public fw_svshutdown(id)
{
    
// Save the data
        
save_data(id);

a
PHP Code:
public fw_svshutdown(id)
{
        for (new 
id 1id <= g_maxplayersid++) 
        if (
is_user_connected(id)) 
        
save_data(id)


Last edited by Catalinn; 08-12-2023 at 19:19. Reason: correct
Catalinn is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-12-2023 , 22:42   Re: [nVault] Invalid vault id: 0
Reply With Quote #4

Just call save_data() at client_disconnect, this will handle all scenarios (disconnect, server shutdown, map change, etc). It's likely that plugin_end() is called before fw_svshutdown and is resulting in your error, plus svshutdown is likely not tied to a player as it's a server event, so passing an id parameter is doing nothing.
__________________

Last edited by Bugsy; 08-13-2023 at 00:51.
Bugsy is offline
Catalinn
Junior Member
Join Date: Aug 2023
Old 08-13-2023 , 20:50   Re: [nVault] Invalid vault id: 0
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
Just call save_data() at client_disconnect, this will handle all scenarios (disconnect, server shutdown, map change, etc). It's likely that plugin_end() is called before fw_svshutdown and is resulting in your error, plus svshutdown is likely not tied to a player as it's a server event, so passing an id parameter is doing nothing.

And if the server goes down due to an error or attack, would it work?
Catalinn is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-13-2023 , 21:36   Re: [nVault] Invalid vault id: 0
Reply With Quote #6

Quote:
Originally Posted by Catalinn View Post
And if the server goes down due to an error or attack, would it work?
If the server goes down via crash then all bets are off as no plug-ins can handle that, aside from saving data at an interval. If it shuts down gracefully, you are good using client_disconnect().
__________________
Bugsy is offline
Catalinn
Junior Member
Join Date: Aug 2023
Old 08-14-2023 , 09:15   Re: [nVault] Invalid vault id: 0
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
If the server goes down via crash then all bets are off as no plug-ins can handle that, aside from saving data at an interval. If it shuts down gracefully, you are good using client_disconnect().

I figured it, solved then, thank you very much!
Catalinn is offline
Reply



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 18:33.


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