Good job! I always wanted to know how to use the prune function.
PHP Code:
public cmdSaveScore(id)
{
//Save 2 items into the value of the entry.
//Example: STEAM_0:0:1234 15 5
new szData[8];
new szKey[40];
formatex( szKey , 39 , "%sMONEY" , g_szAuthID[id] );
formatex( szData , 7 , "%d %d" , get_user_kills(id) , get_user_deaths(id) );
nvault_set( g_Vault , szKey , szData );
client_print( id , print_chat , "* Your score was saved to vault." );
}
public cmdGetScore(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 , 39 , "%sMONEY" , g_szAuthID[id] );
if ( nvault_get( g_Vault , szKey , szData , 7 ) )
{
new iSpacePos = contain( szData , " " );
new szKills[4];
new szDeaths[4];
if ( iSpacePos > -1 )
{
formatex( szKills , iSpacePos , "%s" , szData );
formatex( szDeaths , 3 , "%s" , szData[ iSpacePos + 1 ] );
set_user_kills( id , str_to_num( szKills );
set_user_deaths( id , str_to_num( szDeaths );
client_print( id , print_chat , "* Your score was loaded: %s kills, %s deaths" , szKills , szDeaths );
}
}
else
{
client_print( id , print_chat , "* You have no score entry in vault." );
}
}
Don't you mean:
PHP Code:
formatex( szKey , 39 , "%sSCORE" , g_szAuthID[id] );
__________________