Raised This Month: $ Target: $400
 0% 

[Solved] nvault lookup


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 02-04-2016 , 07:39   [Solved] nvault lookup
Reply With Quote #1

About plugin
plugin is working well while saving and retrying at load and save but nvault lookup is not working it is not able to check the data is already exist or not
someone please help me

PHP Code:
#include <amxmodx>
#include <nvault>

#define PLUGIN "Test_lookup"
#define VERSION "1.0"
#define AUTHOR "26-{indra}"

new g_Vault;
new 
szName[33],szKey[10],Text[10];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("Enter_string","get_strings");
    
register_clcmd("say /test","testmenu");
}

public 
plugin_cfg()
{
    
g_Vault nvault_open"Test_lookup" );
}

public 
client_putinserver(id)
{
    
load_string(id);
}

public 
client_disconnect(id)
{
    
save_string(id);
}

public 
plugin_end()
{
    
nvault_closeg_Vault );
}

public 
testmenu(id)
{
    new 
menu menu_create("Enter a string""mh_testMenu");
    
menu_additem(menu"Enter a string"""0); 
    
menu_additem(menu"Submit """0);
    
menu_display(idmenu0);
}

public 
mh_testMenu(idmenuitem)
{
    switch(
item)
    {
        case 
0:
        {
            new 
szVal[10];
            new 
iExists,iTimestamp;
            
            
get_user_nameid ,  szName charsmaxszName ) );
            
iExists nvault_lookupg_Vault "szName" szVal charsmaxszVal ) , iTimestamp );  
            if(
iExists)
            {
                
client_print(id,print_chat,"This user already entered string")
            }
            else
            {
            
client_cmd(id"messagemode Enter_string");
            
testmenu(id)
            }
        }
        case 
1:
        {
            
client_print(idprint_chat,"Your string is saved");
            
save_string(id);
        }
    }
    
menu_destroy(menu);
}

public 
get_strings(id)
{
    
read_args(Textcharsmax(Text));
    
remove_quotes(Text);
    if(
equal(Text""))
      return 
PLUGIN_HANDLED;
    
client_print(id,print_chat,"the enter string is %s",Text);
    return 
PLUGIN_CONTINUE;
}


public 
load_string(id)
{
    
get_user_nameid ,  szName charsmaxszName ) );
    
formatexszKey charsmaxszKey ) , "%s-string",  szName );
    
nvault_getg_Vault szKey Text);
    
server_print("the data is retry %s",Text);
    return 
PLUGIN_CONTINUE;
}

public 
save_string(id)
{
    
get_user_nameid ,  szName charsmaxszName ) );
    
formatexszKey charsmaxszKey ) , "%s-string",  szName );
    
nvault_setg_Vault szKey Text );
    
server_print("the data is saved %s",Text);
    return 
PLUGIN_CONTINUE;

Attached Files
File Type: sma Get Plugin or Get Source (test_lookup.sma - 602 views - 2.1 KB)
__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 02-04-2016 at 23:31.
indraraj striker is offline
 



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 09:24.


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