Raised This Month: $ Target: $400
 0% 

Nvault problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 12-22-2014 , 04:23   Re: Nvault problem
Reply With Quote #4

Quote:
Originally Posted by Bugsy View Post
  • Use steam id, not name. This only needs to be read once per player connection.
  • Use charsmax() instead of manually specifying max chars
  • I would need to see your full code to determine your issue, there's a chance you were not loading\saving at an appropriate time.

Untested.
PHP Code:
#include <amxmodx>
#include <nvault>

const MAX_PLAYERS 32;

new 
g_Vaultg_PointsMAX_PLAYERS ], g_szAuthIDMAX_PLAYERS ][ 35 ];

public 
plugin_init() 
{
    
g_Vault nvault_open"hello" );
}

public 
plugin_end() 
{
    
nvault_closeg_Vault );
}

public 
client_authorizedid )
{
    
get_user_authidid g_szAuthIDid ] , charsmaxg_szAuthID[] ) );
    
LoadDataid );
}

public 
client_disconnectid )
{
    
SaveDataid );
}

public 
SaveData(id)
{
    new 
vaultkey[64] , vaultdata[328];
    
    
formatexvaultkey charsmaxvaultkey ) , "Yo_%s" g_szAuthIDid ] );
    
formatexvaultdata charsmaxvaultdata ) , "%i#" g_Pointsid ] );
    
    
nvault_setg_Vault vaultkey vaultdata )
}

public 
LoadData(id)
{    
    new 
vaultkey[64], vaultdata[328] , g_point[32];
    
    
formatvaultkey charsmaxvaultkey ) , "Yo_%s" g_szAuthIDid ] );
    
    
//You are about to read data from vault into the vaultdata variable so there is
    //no reason to format it since it will be overwritten anyway.
    //Don't do this -> format( vaultdata , 327 , "%i#", g_Points[id]);
    
    
nvault_getg_Vault vaultkey vaultdata charsmaxvaultdata ) )
    
    
replace_allvaultdata charsmaxvaultdata ) , "#" " " );
    
parsevaultdata g_point charsmaxg_point ) );
    
g_Pointsid ] = str_to_numg_point );

With that code, it is not saving, and it doesnt even create any file.
Syturi0 is offline
 



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 15:25.


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