Thread: nVault Tutorial
View Single Post
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-02-2009 , 13:34   Re: nVault
Reply With Quote #8

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];
    
formatexszKey 39 "%sMONEY" g_szAuthID[id] );
    
formatexszData "%d %d" get_user_kills(id) , get_user_deaths(id) );

    
nvault_setg_Vault szKey szData );

    
client_printid 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];
    
formatexszKey 39 "%sMONEY" g_szAuthID[id] );

    if ( 
nvault_getg_Vault szKey szData ) )
    {
        new 
iSpacePos containszData " " );
        new 
szKills[4];
        new 
szDeaths[4];
        
        if ( 
iSpacePos > -)
        {    
            
formatexszKills iSpacePos "%s" szData );
            
formatexszDeaths "%s" szDataiSpacePos ] );

            
set_user_killsid str_to_numszKills );
            
set_user_deathsid str_to_numszDeaths );

            
client_printid print_chat "* Your score was loaded: %s kills, %s deaths" szKills szDeaths );
        }
    }
    else
    {
        
client_printid print_chat "* You have no score entry in vault." );
    }

Don't you mean:
PHP Code:
formatexszKey 39 "%sSCORE" g_szAuthID[id] ); 
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline