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

nvault problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
skz
Senior Member
Join Date: Jul 2014
Location: Portugal
Old 04-24-2016 , 17:23   nvault problem
Reply With Quote #1

Hi guys,

Im doesnt use nvault for anything, but in this plugin im making i think is the best option because I work always with sqlx.

Im very noob at nvault, someone can help me? The first 2 variables save, but the last 2 dont

PHP Code:
public load(id)
{
    
pokevault nvault_open("lendas_data")
   
    new 
key[100], szAuthID[35]
   
    
get_user_authid(idszAuthIDcharsmax(szAuthID))
    
formatex(keycharsmax(key),"%s-lendas"szAuthID)
   
    if(
nvault_get(pokevaultkey))
    {
        new 
vaultdata[250]
        
format(vaultdatacharsmax(vaultdata), "%i %i %i %i"g_Desligado[id], g_Som_Desligado[id],  g_Musica_desligada[id],  g_Dano[id])
        
nvault_get(pokevaultkeyvaultdatacharsmax(vaultdata))
       
        new 
disable[2], sdisable[2], ssom[2], sg_Dano[3]
       
        
parse(vaultdatadisablecharsmax(disable), sdisablecharsmax(sdisable), ssomcharsmax(ssom), sg_Danocharsmax(sg_Dano))
       
        new 
disablen str_to_num(disable)
        new 
sdisablen str_to_num(sdisable)
        new 
ssomn str_to_num(ssom)
        new 
sg_Danon str_to_num(sg_Dano)
       
        
g_Desligado[id] = disablen true false
        g_Som_Desligado
[id] = sdisablen true false
        g_Musica_desligada
[id] = ssomn truefalse
        g_Dano
[id] = sg_Danon
    
}
   
    
nvault_close(pokevault)
}
 
public 
save(id)
{
    
pokevault nvault_open("lendas_data")
   
    new 
key[62], vaultdata[250], szAuthID[35]
    
get_user_authid(idszAuthIDcharsmax(szAuthID))
    
format(key61,"%s-poke"szAuthID)
   
    
format(vaultdatacharsmax(vaultdata), "%i %i %i %i"g_Desligado[id] ? 0g_Som_Desligado[id] ? 0g_Musica_desligada[id] ? 0g_Dano[id])
    
nvault_set(pokevaultkeyvaultdata)
   
    
nvault_close(pokevault)
   
    
g_Desligado[id] = false
    g_Som_Desligado
[id] = false
    g_Musica_desligada
[id] = false
    g_Dano
[id] = 0

__________________

Last edited by skz; 04-24-2016 at 17:24.
skz is offline
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 04-24-2016 , 22:44   Re: nvault problem
Reply With Quote #2

Your code is a total mess.

I recommend you to use fVault instead (https://forums.alliedmods.net/showthread.php?t=76453).
It has more features than nVault and its overall easier/simpler to use.
Also use global variables with values of 1/0 instead of true/false.

Here is an example using fVault:

LOAD
PHP Code:
new sSteamID[35]
get_user_authid(idsSteamIDcharsmax(sSteamID))

new 
sData[50]
fvault_get_data(g_FvaultsSteamIDsDatacharsmax(sData))

new 
sz1[2], sz2[2],
sz3[2], sz4[2],

parse(sData,
sz1charsmax(sz1),
sz2charsmax(sz2),
sz3charsmax(sz3),
sz3charsmax(sz3),
)

g_1[id] = str_to_num(sz1)
g_2[id] = str_to_num(sz2)
g_3[id] = str_to_num(sz3)
g_4[id] = str_to_num(sz4
SAVE
PHP Code:
new sSteamID[35]
get_user_authid(idsSteamIDcharsmax(sSteamID))

new 
sData[50]
formatex(sDatacharsmax(sData),
"%s %d %d %d",
g_1[id],
g_2[id], 
g_3[id],
g_4[id],
)

fvault_set_data(g_FvaultsSteamIDsData

Last edited by Syturi0; 04-24-2016 at 22:47.
Syturi0 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-24-2016 , 22:59   Re: nvault problem
Reply With Quote #3

If you know how to use SQLx, why are you trying to use something else? SQLX is much more powerful than nvault.
__________________
fysiks 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 10:16.


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