Code:
new iPoints[33]
new g_Vault
new g_szAuthID[33][35]
public plugin_cfg()
{
g_Vault = nvault_open( "zombiedefiance" );
if ( g_Vault == INVALID_HANDLE )
set_fail_state( "Error opening nVault" );
}
public plugin_end()
{
nvault_close( g_Vault );
}
public client_authorized(id)
{
get_user_authid( id , g_szAuthID[id] , 34 );
}
public cmdSavePoints(id)
{
new szPoints[7]; //Data holder for the money amount
new szKey[40]; //Key used to save money "STEAM_0:0:1234MONEY"
formatex( szKey , 39 , "%sPOINTS" , g_szAuthID[id] );
formatex( szMoney, 6 , "%d" , iPoints[id] );
nvault_set( g_Vault , szKey , szPoints );
client_print_color( id, Blue, "^4[ZD]^3 ** Your points were saved to vault **" );
}
public cmdGetPoints(id)
{
new szKey[40];
formatex( szKey , 39 , "%sPOINTS" , g_szAuthID[id] );
new iMoney = nvault_get( g_Vault , szKey );
if ( iMoney )
{
iPoints[id] = iMoney
nvault_remove( g_Vault , szKey );
client_print_color( id, Blue, "^4[ZD] ^3** Your points were loaded from vault:^4 $%d **", iMoney );
}
else
{
client_print_color( id, Blue, "^4[ZD] ^3** You have no point entries in vault. **" );
}
}