AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Saving in NVault ? Cant? (https://forums.alliedmods.net/showthread.php?t=126592)

JProReTaRD 05-11-2010 08:01

Saving in NVault ? Cant?
 
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 :)

Bugsy 05-11-2010 19:32

Re: Saving in NVault ? Cant?
 
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

:arrow:
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);
    }    


:arrow:
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);
    }    



JProReTaRD 05-21-2010 13:30

Re: Saving in NVault ? Cant?
 
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


Bugsy 05-21-2010 13:45

Re: Saving in NVault ? Cant?
 
looks like you are trying to pass an integer to a function that is expecting a string.

mysticssjgoku4 05-21-2010 13:48

Re: Saving in NVault ? Cant?
 
Assuming it is talking about this function. Check the second argument "key" as it probably requires a string.
Code:
cmd_ChangeRule(id, key);

JProReTaRD 05-21-2010 14:33

Re: Saving in NVault ? Cant?
 
Quote:

Originally Posted by mysticssjgoku4 (Post 1186959)
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 :oops:

Or are you saying the func should look like this?
PHP Code:

cmd_ChangeRule(id,  key); 

bc that was what it was at first.

mysticssjgoku4 05-21-2010 14:37

Re: Saving in NVault ? Cant?
 
Can you post your current code please?

JProReTaRD 05-21-2010 14:42

Re: Saving in NVault ? Cant?
 
Quote:

Originally Posted by mysticssjgoku4 (Post 1187010)
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 :wink: )

Alka 05-21-2010 16:32

Re: Saving in NVault ? Cant?
 
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.

Bugsy 05-21-2010 16:46

Re: Saving in NVault ? Cant?
 
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.


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

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