Hi,
I can't seem to save my rules in the nvault.
I am doing this through cmd.
This is the code:
PHP Code:
new rrm_Rules; //Global var to hold our vault handle
new rrm_Punishments; //Global var to hold our vault handle
new rrm_szAuthID[33][35]; //Global array to store auth ids of players
enum _:VaultData
{
VAULT_KEY[ 32 ], //change to max key length
VAULT_DATA[ 32 ] //..max data len
};
public plugin_init()
{
register_concmd( "RRM_ChangeRule", "Change_Rule", ADMIN_KICK );
rrm_Rules = nvault_open( "rrm_Rules" );
rrm_Punishments = nvault_open( "rrm_Punishments" );
}
public plugin_end()
{
nvault_close( rrm_Rules );
nvault_close( rrm_Punishments );
}
cmd_ChangeRule(id, key)
{
if ( gbAdminAccess[id] )
{
client_cmd(id, "messagemode RRM_ChangeRule");
client_print(id, print_chat, "Write the %s. rule.", key);
}
return PLUGIN_HANDLED;
}
public Change_Rule( iClient, iLevel, iCid )
{
if( !cmd_access( iClient, iLevel, iCid, 3 ) )
{
return;
}
new szVaultData[ VaultData ];
read_argv( 1, szVaultData[ VAULT_KEY ] , charsmax( szVaultData[] ) );
read_argv( 2, szVaultData[ VAULT_DATA ] , charsmax( szVaultData[] ) );
nvault_pset( rrm_Rules, szVaultData[ VAULT_KEY ], szVaultData[ VAULT_DATA ] );
}
public ShowRule( id, key )
{
//Read 2 items that that are saved in the same entry
//Example: RULE-1 "HELP ME!"
new szData[8];
new szKey[40];
formatex( szKey , 39 , "%s" , key );
//If data was found
if ( nvault_get( rrm_Rules , szKey , szData , 7 ) )
{
ColorChat(id, GREEN, "%s^x01 Rule^x03 %s:^x01 %s", PLUGIN_PREFIX, szKey, szData);
}
else
{
ColorChat(id, GREEN, "%s^x01 Rule^x03 %s:^x01 Wasn't found, make a new Entry!", PLUGIN_PREFIX, key);
}
}
I hope you can help