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

Need help with nvault array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abdelwahab
Member
Join Date: Aug 2019
Old 06-24-2022 , 14:36   Need help with nvault array
Reply With Quote #1

Hello, hope u are doing well,
My problem is that im using nvault array by Bugsy and its working perfect but some times an error pops out and says
[AMXX] Plugin says: [nVault Array] Can only use nvault_get_array() on data that was saved using nvault_set_array().
i had to remove the file of vault to make it work but after while to will causes this problem again..
abdelwahab is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-24-2022 , 23:23   Re: Need help with nvault array
Reply With Quote #2

This means you tried to use nvault_get_array() on data saved using nvault_set(). If this is not the case, it may be a bug but I'll need more info to look into fixing it.
__________________

Last edited by Bugsy; 06-24-2022 at 23:24.
Bugsy is offline
abdelwahab
Member
Join Date: Aug 2019
Old 06-25-2022 , 10:26   Re: Need help with nvault array
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
This means you tried to use nvault_get_array() on data saved using nvault_set(). If this is not the case, it may be a bug but I'll need more info to look into fixing it.
Quote:
Save_Data( pPlayer ){
new szKey[64];
formatex(szKey, charsmax(szKey) , "%s-PlayerGamePoints" , g_playername[pPlayer]);
nvault_set_array(g_zpvault , szKey, g_PlayerGamePoints[pPlayer][TYPES:0] , sizeof g_PlayerGamePoints[]);

formatex(szKey, charsmax(szKey) , "%s-LEVEL" , g_playername[pPlayer]);
nvault_set_array(g_zpvault , szKey, g_level[pPlayer] , sizeof ( g_level ) );

formatex(szKey, charsmax(szKey) , "%s-EXP" , g_playername[pPlayer]);
nvault_set_array(g_zpvault , szKey, g_exp[pPlayer] , sizeof ( g_level ) );

formatex(szKey, charsmax(szKey) , "%s-HUMANCLASS" , g_playername[pPlayer]);
nvault_set_array(g_zpvault , szKey, g_humanclass[pPlayer] , sizeof ( g_humanclass ) );

formatex(szKey, charsmax(szKey) , "%s-HUMANCLASSNEXT" , g_playername[pPlayer]);
nvault_set_array(g_zpvault , szKey, g_humanclassnext[pPlayer] , sizeof ( g_humanclassnext ) );

formatex(szKey, charsmax(szKey) , "%s-ZOMBIECLASS" , g_playername[pPlayer]);
nvault_set_array(g_zpvault , szKey, g_zombieclass[pPlayer] , sizeof ( g_zombieclass ) );

formatex(szKey, charsmax(szKey) , "%s-ZOMBIECLASSNEXT" , g_playername[pPlayer]);
nvault_set_array(g_zpvault , szKey, g_zombieclassnext[pPlayer] , sizeof ( g_zombieclassnext ) );
}
Load_Data( pPlayer ){
new szKey[64];
formatex(szKey, charsmax(szKey) , "%s-PlayerGamePoints" , g_playername[pPlayer]);
nvault_get_array(g_zpvault , szKey, g_PlayerGamePoints[pPlayer][TYPES:0] , sizeof g_PlayerGamePoints[]);

formatex(szKey, charsmax(szKey) , "%s-LEVEL" , g_playername[pPlayer]);
nvault_get_array(g_zpvault , szKey, g_level[pPlayer] , sizeof ( g_level) );

formatex(szKey, charsmax(szKey) , "%s-EXP" , g_playername[pPlayer]);
nvault_get_array(g_zpvault , szKey, g_exp[pPlayer] , sizeof ( g_level ) );

formatex(szKey, charsmax(szKey) , "%s-HUMANCLASS" , g_playername[pPlayer]);
nvault_get_array(g_zpvault , szKey, g_humanclass[pPlayer] , sizeof ( g_humanclass) );

formatex(szKey, charsmax(szKey) , "%s-HUMANCLASSNEXT" , g_playername[pPlayer]);
nvault_get_array(g_zpvault , szKey, g_humanclassnext[pPlayer] , sizeof ( g_humanclassnext ) );

formatex(szKey, charsmax(szKey) , "%s-ZOMBIECLASS" , g_playername[pPlayer]);
nvault_get_array(g_zpvault , szKey, g_zombieclass[pPlayer] , sizeof ( g_zombieclass ) );

formatex(szKey, charsmax(szKey) , "%s-ZOMBIECLASSNEXT" , g_playername[pPlayer]);
nvault_get_array(g_zpvault , szKey, g_zombieclassnext[pPlayer] , sizeof ( g_zombieclassnext ) );

}
btw im playing with bots
abdelwahab is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-25-2022 , 10:37   Re: Need help with nvault array
Reply With Quote #4

Using the below as an example, you are passing what appears to be a single integer (g_level[]) with a size of the entire array (33?) for all players which doesn't make any sense.

PHP Code:
formatex(szKeycharsmax(szKey) , "%s-LEVEL" g_playername[pPlayer]);
nvault_set_array(g_zpvault szKeyg_level[pPlayer] , sizeof g_level ) ); 
Just do:

PHP Code:
new szDatasize ];
num_to_strg_levelpPlayer ] , szData charsmaxszData ) );
nvault_setg_zpvault szKey szData ); 
__________________

Last edited by Bugsy; 06-25-2022 at 10:51.
Bugsy is offline
abdelwahab
Member
Join Date: Aug 2019
Old 06-25-2022 , 10:58   Re: Need help with nvault array
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
Using the below as an example, you are passing what appears to be a single integer (g_level[]) with a size of the entire array (33?) for all players which doesn't make any sense.

PHP Code:
formatex(szKeycharsmax(szKey) , "%s-LEVEL" g_playername[pPlayer]);
nvault_set_array(g_zpvault szKeyg_level[pPlayer] , sizeof g_level ) ); 
Just do:

PHP Code:
new szDatasize ];
num_to_strg_levelpPlayer ] , szData charsmaxszData ) );
nvault_setg_zpvault szKey szData ); 
but this will effect on array saving
abdelwahab is offline
abdelwahab
Member
Join Date: Aug 2019
Old 06-25-2022 , 10:59   Re: Need help with nvault array
Reply With Quote #6

i mean nvault_set and nvault_set_array in same function
abdelwahab is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-25-2022 , 11:02   Re: Need help with nvault array
Reply With Quote #7

A vault can have a combination of array and non-array data. You just cant do

nvault_set( vault , "bugsy" , "abc" )
nvault_get_array( vault , "bugsy" , arr , size );
__________________
Bugsy is offline
abdelwahab
Member
Join Date: Aug 2019
Old 06-25-2022 , 11:13   Re: Need help with nvault array
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
A vault can have a combination of array and non-array data. You just cant do

nvault_set( vault , "bugsy" , "abc" )
nvault_get_array( vault , "bugsy" , arr , size );
btw if i used 2 vaults will this make problem ? i mean i have 2 plugins vault for zp and vault for missions will this effect?
abdelwahab is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-25-2022 , 11:14   Re: Need help with nvault array
Reply With Quote #9

Why use 2 separate vaults?
__________________
Bugsy is offline
abdelwahab
Member
Join Date: Aug 2019
Old 06-25-2022 , 11:15   Re: Need help with nvault array
Reply With Quote #10

Quote:
Originally Posted by Bugsy View Post
Why use 2 separate vaults?
hmm 2 separate plugins ?
abdelwahab 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:59.


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