Raised This Month: $ Target: $400
 0% 

[Solved] nvault lookup


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-04-2016 , 20:47   Re: [help] nvault lookup
Reply With Quote #5

I didn't review your entire code, only the nvault stuff.
Code:
public mh_testMenu(id, menu, item) {     switch(item)     {         case 0:         {             new szVal[10];             new iExists,iTimestamp;                         get_user_name( id ,  szName , charsmax( szName ) );                     //You forgot to do this:             formatex( szKey , charsmax( szKey ) , "%s-string",  szName )             iExists = nvault_lookup( g_Vault , szKey , szVal , charsmax( szVal ) , 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(id, print_chat,"Your string is saved");             save_string(id);         }     }     menu_destroy(menu); }

Make sure you have the same when you use nvault_get() and nvault_set() or else it will not work. These keys must be identical if you expect to be able to retrieve the data.
PHP Code:
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;

__________________

Last edited by Bugsy; 02-04-2016 at 20:48.
Bugsy 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