Example: I have 50 lives and my password is "red". Player B has 15 lives and his password is "green".
I don't know why, but sometimes when player B enters the server he will have 50 lives and his password will be "red". But the SETINFO_PASSWORD is "green" and therefore he can't login in his account. In the FVAULT the information changed so he lost all his data.
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fvault>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
new SZ_Password[ 192 ]
new SZ_Password_T[ 33 ][ 192 ]
new Registered[ 33 ]
new BadPassword[ 33 ]
new g_lifes[33]
new const Vault[] = "_datos"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /account", "CMDRegister");
register_clcmd( "EnterPassword", "CMDIntroducirContrasenia" )
}
public client_putinserver( id ){
Registered[id] = 0
BadPassword[id] = 0
set_task(2.0, "Load", id)
}
public client_disconnect( id ) {
Save(id);
}
public CMDRegister(id){
if( Registered[ id] == 1 || BadPassword[id] == 1){
return PLUGIN_HANDLED;
}
else{
client_cmd( id, "messagemode EnterPassword" )
}
return PLUGIN_CONTINUE;
}
public CMDIntroducirContrasenia( id ){
read_args( SZ_Password, 191 )
remove_quotes( SZ_Password )
trim( SZ_Password )
if( equal( SZ_Password, "" ) || contain( SZ_Password, " ") != -1){
return PLUGIN_HANDLED;
}
else {
client_cmd( id, "setinfo _password ^"%s^"", SZ_Password )
Registered[ id ] = 1
static SZ_Name[ 32 ], SZ_Data[ 512 ]
get_user_name( id, SZ_Name, 31 )
formatex( SZ_Data, charsmax( SZ_Data ), "%s %d", SZ_Password, g_lifes[id])
fvault_set_data( Vault, SZ_Name, SZ_Data )
SZ_Password_T[ id ] = SZ_Password
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public Save( id ){
if(Registered[ id ] == 0 || BadPassword[ id ] == 1){
return PLUGIN_HANDLED;
}
else{
static SZ_Data[ 512 ], SZ_Name[ 32 ]
formatex( SZ_Data, charsmax( SZ_Data ), "%s %d", SZ_Password_T[ id ], g_lifes[id])
get_user_name( id, SZ_Name, 31 )
fvault_set_data( Vault, SZ_Name, SZ_Data )
}
return PLUGIN_CONTINUE;
}
public Load( id ){
static SZ_Data[ 512 ], SZ_Name[ 32 ], SETINFO_Password[ 191 ], VAULT_Password[ 191 ], lifes[32]
get_user_name( id, SZ_Name, 31 )
get_user_info( id, "_password", SETINFO_Password, 190 )
if( !fvault_get_data( Vault, SZ_Name, SZ_Data, charsmax( SZ_Data ) ) ){
return 0;
}
Registered[id] = 1
parse( SZ_Data, VAULT_Password, 190, lifes, 31)
if( equal( SETINFO_Password, VAULT_Password ) ){
SZ_Password_T[id] = SETINFO_Password
g_lifes[id] = str_to_num(lifes)
return 2;
}
else{
BadPassword[ id ] = 1
}
return 1;
}