Hello there,
Im storing name in nVault. So What I'm doing is storing name with the key of name. But when there are more than one players in the server and they type /reg to register at that time the name overlaps.
For eg. First player. /reg
He set his name: abc
For eg. Second player. /reg
He set his name: xyz
so when second players wants to know his password he types /showname
it shows xyz for both the users. Please help me out.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <nvault>
#include <csx>
#include <fakemeta>
#include <engine>
#define PLUGIN "Store Name"
#define VERSION "1.6"
#define AUTHOR "Abhishek"
new g_Vault
new uname[32]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
//XP Register System
register_clcmd("say /reg","cmdDoRegister")
register_clcmd("doRegister","cmdRegister")
register_clcmd( "say /showname" , "cmdShowName" );
}
public plugin_cfg()
{
g_Vault = nvault_open( "yourvault" );
}
public plugin_end()
{
nvault_close( g_Vault );
}
public client_connect(id)
{
get_user_name(id,uname,31)
}
public cmdDoRegister(id)
{
client_cmd(id,"messagemode doRegister")
}
public cmdShowName(id)
{
new szKey[40];
new szName[255]
formatex( szKey , charsmax( szKey ) , "%s-NAME" , uname );
nvault_get( g_Vault , szKey , szName , charsmax(szName) );
client_print( id , print_chat , "* Your pass = %s", szName);
}
public cmdRegister(id)
{
new szArgs[255]
new szKey[40]
read_args(szArgs,254)
remove_quotes(szArgs)
server_print("Reg pass : %s ",szArgs)
formatex( szKey , charsmax( szKey ) , "%s-NAME" , uname )
formatex( szArgs , charsmax( szArgs ) , "%s" , szArgs);
nvault_set( g_Vault , szKey , szArgs )
return PLUGIN_CONTINUE
}
//====================================== End of register System