Raised This Month: $ Target: $400
 0% 

Solved nvault_util doesn't work :/


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-15-2017 , 08:17   nvault_util doesn't work :/
Reply With Quote #1

hi i need help with nvault_util it's set to save per steam id but it save but i think he can't load or something like that please help me.

P.S : i need to change to save per names if someone can do it.

Code :
PHP Code:
#include <nvault_util>

public plugin_init()
{
    new 
g_iVault nvault_open("Level-System");
    
    if ( 
g_iVault == INVALID_HANDLE )
    
set_fail_state"Error opening nVault" );
}
public 
plugin_end() 
    
nvault_close(g_iVault);

stock Save(id)
{
    if(
g_iVault == INVALID_HANDLE)
        
set_fail_state("nVault returned invalid handle");
    
    new 
szAuthId[35]; 
    
get_user_authid(idszAuthIdcharsmax(szAuthId));
    
    new 
szName[32]; 
    
get_user_name(idszNamecharsmax(szName));
    
    new 
szData[256];
    
formatex(szDatacharsmax(szData), "%i %i"g_iXp[id], g_iLevel[id]);
    
    
nvault_remove(g_iVaultszAuthId);
    
nvault_set(g_iVaultszAuthIdszData);
        
    
format(szAuthIdcharsmax(szAuthId), "%s"szAuthId);
    
nvault_remove(g_iVaultszAuthId);
    
nvault_set(g_iVaultszAuthIdszName);
}

stock Load(id)
{
    if(
g_iVault == INVALID_HANDLE)
        
set_fail_state("nVault returned invalid handle");
        
    new 
szSavedName[32];
    new 
szName[32]; get_user_name(idszNamecharsmax(szName));
    new 
szAuthId[32]; get_user_authid(idszAuthIdcharsmax(szAuthId));
    
    new 
szData[256], iTimeStamp;
    if(!
nvault_lookup(g_iVaultszAuthIdszDatacharsmax(szData), iTimeStamp))
    {
        
nvault_set(g_iVaultszAuthId"0");
        
        
format(szAuthIdcharsmax(szAuthId), "%s"szAuthId);
        
nvault_set(g_iVaultszAuthIdszName);
        
        return 
PLUGIN_HANDLED;
    }
    
    
ParseLoadData(idszData);
    
    
format(szAuthIdcharsmax(szAuthId), "%s"szAuthId);
    
nvault_get(g_iVaultszAuthIdszSavedName);
    
    if(!
equal(szNameszSavedName))
    {
        
nvault_remove(g_iVaultszAuthId);
        
nvault_set(g_iVaultszAuthIdszName);
    }
    return 
PLUGIN_HANDLED;
}
ParseLoadData(idszData[256])
{
    static 
szNum[11];
    
strbreak(szDataszNumcharsmax(szNum), szDatacharsmax(szData));
    
g_iXp[id] = str_to_num(szNum);
    
    
strbreak(szDataszNumcharsmax(szNum), szDatacharsmax(szData));
    
g_iLevel[id] = str_to_num(szNum);
}
public 
client_disconnect(id)
{
    
Save(id);
    return 
PLUGIN_HANDLED;
}
public 
client_putinserver(id)
{
    
Load(id);
    return 
PLUGIN_HANDLED;

Please any help would be great.
Thanks.

Last edited by yas17sin; 02-18-2017 at 22:22.
yas17sin is offline
Send a message via ICQ to yas17sin
 



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 21:00.


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