| usaexelent |
10-31-2011 14:59 |
Please help me.
I'm editing Shop plugin for JB to make that jbpacks would be saved and the packs don't save could some one please help me :cry:
PHP Code:
public plugin_cfg( )
{
////////////////Nvault//////////////
//Open our vault and have g_Vault store the handle.
g_Vault = nvault_open( "JBPACKS" );
//Make the plugin error if vault did not successfully open
if ( g_Vault == INVALID_HANDLE )
set_fail_state( "Error opening nVault" );
//This will remove all entries in the vault that are 5+ (or cvar+) days old at server-start
//or map-change
nvault_prune( g_Vault , 0 , get_systime() - ( 86400 * 30 ) );
///////////////////////////////////
}
public plugin_end()
{
//Close the vault when the plugin ends (map change\server shutdown\restart)
nvault_close( g_Vault );
}
public client_authorized(id)
{
//Get the connecting users authid and store it in our global string array so it
//will not need to be retrieved every time we want to do an nvault transaction.
get_user_ip( id , g_szip[id] , charsmax( g_szip[] ) );
}
public savejb(id)
{
new szPacks[7]; //Data holder for the packs amount
new szKey[40]; //Key used to save packs "STEAM_0:0:1234MONEY"
formatex( szKey , charsmax( szKey ) , "%s" , g_szip[id] );
formatex( szPacks , charsmax( szPacks ) , "%s" , g_jbpacks[id] );
nvault_set( g_Vault , szKey , szPacks );
client_print( id , print_chat , "* Your money was saved to vault %s packs",szPacks );
}
public getjb(id)
{
//Read 2 items that that are saved in the same entry
//Example: STEAM_0:0:1234 15 5
new szData[8];
new szKey[40];
formatex( szKey , charsmax( szKey ) , "%s" , g_szip[id] );
//If data was found
if ( nvault_get( g_Vault , szKey , szData , charsmax( szData ) ) )
{
new Paketai[4];
formatex( Paketai , 3 , "%s" , szData );
//Set the players packs with these values.
g_jbpacks[id] = str_to_num( Paketai )
client_print( id , print_chat , "* Your packs was loaded: %s packs" , Paketai );
}
else
{
client_print( id , print_chat , "* You have no score entry in vault." );
}
}
|