Raised This Month: $ Target: $400
 0% 

Saving in NVault ? Cant?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JProReTaRD
Member
Join Date: May 2009
Location: Denmark, KBH
Old 05-11-2010 , 08:01   Saving in NVault ? Cant?
Reply With Quote #1

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_KEY32 ],  //change to max key length
    
VAULT_DATA32 ]  //..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_closerrm_Rules );
    
nvault_closerrm_Punishments );
}

cmd_ChangeRule(idkey)
{
    if ( 
gbAdminAccess[id] )
    {
        
client_cmd(id"messagemode RRM_ChangeRule"); 
        
client_print(idprint_chat"Write the %s. rule."key); 
    }
    
    return 
PLUGIN_HANDLED;
}

public 
Change_RuleiClientiLeveliCid )
{
    if( !
cmd_accessiClientiLeveliCid) )
    {
        return;
    }

    new 
szVaultDataVaultData ];
    
    
read_argv1szVaultDataVAULT_KEY ] , charsmaxszVaultData[] ) );
    
read_argv2szVaultDataVAULT_DATA ] , charsmaxszVaultData[] ) );
    
    
nvault_psetrrm_RulesszVaultDataVAULT_KEY ], szVaultDataVAULT_DATA ] );
}

public 
ShowRuleidkey )
{
    
//Read 2 items that that are saved in the same entry
    //Example: RULE-1 "HELP ME!"

    
new szData[8];
    new 
szKey[40];

    
formatexszKey 39 "%s" key );

    
//If data was found
    
if ( nvault_getrrm_Rules szKey szData ) )
    {
        
ColorChat(idGREEN"%s^x01 Rule^x03 %s:^x01 %s"PLUGIN_PREFIXszKeyszData);
    }
    else
    {
        
ColorChat(idGREEN"%s^x01 Rule^x03 %s:^x01 Wasn't found, make a new Entry!"PLUGIN_PREFIXkey);
    }    

I hope you can help

Last edited by JProReTaRD; 05-11-2010 at 08:04.
JProReTaRD is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-11-2010 , 19:32   Re: Saving in NVault ? Cant?
Reply With Quote #2

Retard, from glancing at the code make these corrections and see if you still have a problem. I will look into it further if you still have issues.
PHP Code:
cmd_ChangeRule(idkey

PHP Code:
cmd_ChangeRule(id, const key[] ) 
And
PHP Code:
public ShowRuleidkey )
{
    
//Read 2 items that that are saved in the same entry
    //Example: RULE-1 "HELP ME!"

    
new szData[8];
    new 
szKey[40];

    
formatexszKey 39 "%s" key );

    
//If data was found
    
if ( nvault_getrrm_Rules szKey szData ) )
    {
        
ColorChat(idGREEN"%s^x01 Rule^x03 %s:^x01 %s"PLUGIN_PREFIXszKeyszData);
    }
    else
    {
        
ColorChat(idGREEN"%s^x01 Rule^x03 %s:^x01 Wasn't found, make a new Entry!"PLUGIN_PREFIXkey);
    }    


PHP Code:
public ShowRuleid, const szKey[] )
{
    
//Read 2 items that that are saved in the same entry
    //Example: RULE-1 "HELP ME!"

    
new szData[8];
    
    
//If data was found
    
if ( nvault_getrrm_Rules szKey szData ) )
    {
        
ColorChat(idGREEN"%s^x01 Rule^x03 %s:^x01 %s"PLUGIN_PREFIXszKeyszData);
    }
    else
    {
        
ColorChat(idGREEN"%s^x01 Rule^x03 %s:^x01 Wasn't found, make a new Entry!"PLUGIN_PREFIXszKey);
    }    

__________________

Last edited by Bugsy; 05-11-2010 at 19:38.
Bugsy is offline
JProReTaRD
Member
Join Date: May 2009
Location: Denmark, KBH
Old 05-21-2010 , 13:30   Re: Saving in NVault ? Cant?
Reply With Quote #3

Hi Bugsy Thank you for your reply

Now it says:
Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Argument type mismatch (argument 2) on line 242
Error: Argument type mismatch (argument 2) on line 243
Error: Argument type mismatch (argument 2) on line 244
Error: Argument type mismatch (argument 2) on line 245
Error: Argument type mismatch (argument 2) on line 246
Error: Argument type mismatch (argument 2) on line 247
Error: Argument type mismatch (argument 2) on line 248
Error: Argument type mismatch (argument 2) on line 299
Error: Argument type mismatch (argument 2) on line 300
Error: Argument type mismatch (argument 2) on line 301
Error: Argument type mismatch (argument 2) on line 302
Error: Argument type mismatch (argument 2) on line 303
Error: Argument type mismatch (argument 2) on line 304
Error: Argument type mismatch (argument 2) on line 305

14 Errors.
(compile failed).
The errors are here according to Pawn Compiler:
PHP Code:

    
new key str_to_num(data);
   
    switch(
key)
    {
        case 
1ShowRule(idkey);
        case 
2ShowRule(idkey);
        case 
3ShowRule(idkey);
        case 
4ShowRule(idkey);
        case 
5ShowRule(idkey);
        case 
6ShowRule(idkey);
        case 
7ShowRule(idkey);
    }
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED
AND

PHP Code:
    new key str_to_num(data);
    switch(
key)
    {
        case 
1cmd_ChangeRule(idkey);
        case 
2cmd_ChangeRule(idkey);
        case 
3cmd_ChangeRule(idkey);
        case 
4cmd_ChangeRule(idkey);
        case 
5cmd_ChangeRule(idkey);
        case 
6cmd_ChangeRule(idkey);
        case 
7cmd_ChangeRule(idkey);
    }
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED
JProReTaRD is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-21-2010 , 13:45   Re: Saving in NVault ? Cant?
Reply With Quote #4

looks like you are trying to pass an integer to a function that is expecting a string.
__________________
Bugsy is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 05-21-2010 , 13:48   Re: Saving in NVault ? Cant?
Reply With Quote #5

Assuming it is talking about this function. Check the second argument "key" as it probably requires a string.
Code:
cmd_ChangeRule(id, key);
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
JProReTaRD
Member
Join Date: May 2009
Location: Denmark, KBH
Old 05-21-2010 , 14:33   Re: Saving in NVault ? Cant?
Reply With Quote #6

Quote:
Originally Posted by mysticssjgoku4 View Post
Assuming it is talking about this function. Check the second argument "key" as it probably requires a string.
Code:
cmd_ChangeRule(id, key);
So you are saying this is the one making an error?
PHP Code:
new key str_to_num(data); 
I tried to use data instead, that doesn't work either,
then it says: Array must be indexed.

Omg, it's too long since I have worked with this kind of shit

Or are you saying the func should look like this?
PHP Code:
cmd_ChangeRule(id,  key); 
bc that was what it was at first.

Last edited by JProReTaRD; 05-21-2010 at 14:38.
JProReTaRD is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 05-21-2010 , 14:37   Re: Saving in NVault ? Cant?
Reply With Quote #7

Can you post your current code please?
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
JProReTaRD
Member
Join Date: May 2009
Location: Denmark, KBH
Old 05-21-2010 , 14:42   Re: Saving in NVault ? Cant?
Reply With Quote #8

Quote:
Originally Posted by mysticssjgoku4 View Post
Can you post your current code please?
I can pm you with an uploaded sma, bc I don't wan't the idea stolen - since it's quite unique.
I will post it when it's done (no one likes to get their work stolen )
JProReTaRD is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 05-21-2010 , 16:32   Re: Saving in NVault ? Cant?
Reply With Quote #9

If you want help with something specific and you post in this section, then you must provide all needed informations about code / possible problems so peoples can help you. Also a solution will be good for future persons that might have the same problem.

Thank you.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-21-2010 , 16:46   Re: Saving in NVault ? Cant?
Reply With Quote #10

You are trying to use these functions in two different ways. You either need to decide if the function will accept only an int or string as second param or modify the function to accept both.
__________________
Bugsy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode