Sistema de Banco automático e registro por senha que eu achei perdido no meu PC . Apenas Ajusteis algumas Partes e retirei alguns warnings .
Esta funcionando perfeitamente.
Opcoes de troca de time e mudar senha adicionados.
- CLICK AQUI PARA VER A SMA:
#include
#include
#include
#include
#include
#include
#define PLUGIN "Sistema de Contas"
#define VERSION "1.0"
#define AUTHOR "Manu"
new const NombreVaul[] = "Contas"
new const NombreVaul2[] = "Ammopacks"
new Contra[192]
new LogPw[192]
new ContraNueva[192]
new MalaPW[33]
new Reg[33]
new Intentos[33]
new CambiarPW[33]
new PuedoTeam[33]
new Cambiar, maxplayers
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("chooseteam", "clcmd_changeteam")
register_clcmd("jointeam", "clcmd_changeteam")
register_clcmd("say /opcoes", "Opciones") // abre menu para mudar time e trocar senha
register_clcmd("Logar_Senha", "Logueo")
register_clcmd("Registro_Senha", "Cuenta")
register_clcmd("Nova_Senha", "NuevaContra")
register_forward(FM_ClientUserInfoChanged, "fw_ClientUserInfoChanged")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
maxplayers = get_maxplayers()
Cambiar = register_cvar("amx_equipo", "1")
}
// Auto Salvar
public Autoguardar(id)
{
Guardar(id)
set_task(10.0, "Guardar", id)
}
// Carregar ammoPacks
public CarregarAPs(id)
{
static szData[512], szNombre[32]
get_user_name(id, szNombre, charsmax(szNombre))
if(!fvault_get_data(NombreVaul2, szNombre, szData, charsmax(szData)))
return 0
zp_set_user_ammo_packs(id, str_to_num(szData))
return 1
}
// Guardar AmmoPacks
public Guardar(id)
{
if( Reg[id] != 1 )
return PLUGIN_HANDLED
new szData[512], szNombre[32]
get_user_name(id, szNombre, charsmax(szNombre))
formatex(szData, charsmax(szData), "%d", zp_get_user_ammo_packs(id))
fvault_set_data(NombreVaul2, szNombre, szData)
return PLUGIN_HANDLED
}
public FWClientUserInfoChanged( Index, Buffer )
{
if( !is_user_connected( Index ) )
return FMRES_IGNORED;
static NickName[32], NickOld[32]; get_user_name( Index, NickOld, 31 )
engfunc( EngFunc_InfoKeyValue, Buffer, "name", NickName, 31 )
if( equal( NickName, NickOld ) )
return FMRES_IGNORED;
engfunc( EngFunc_SetClientKeyValue, Index, Buffer, "name", NickOld )
client_cmd( Index, "name ^"%s^"; setinfo name ^"%s^"", NickOld, NickOld )
return FMRES_SUPERCEDE;
}
public event_round_start()
{
for( new id = 1; id < maxplayers; id++ )
{
PuedoTeam[id] = 0
Autoguardar(id)
}
}
public client_putinserver(id)
{
MalaPW[id] = 0
Reg[id] = 0
Intentos[id] = 0
PuedoTeam[id] = 0
set_task(0.1, "clcmd_changeteam", id)
CarregarAPs(id)
}
public clcmd_changeteam(id)
{
static Team; Team = get_user_team(id)
if( ( Team == 0 || Team == 3 ) && MalaPW[id] == 0 && Reg[id] == 1 )
return PLUGIN_CONTINUE;
else if( !Reg[id] || MalaPW[id] )
{
new Menu = menu_create("\ySistema de Registro para \r(ZombiePlague)", "Mostrar")
menu_additem(Menu, "\wRegistrar Nova Conta^n[Criar nova conta]", "1", 0)
menu_additem(Menu, "\wLogar-se^n[Carregar seus AmmoPacks]", "2", 0)
menu_addtext(Menu, "\w^n^nSistema De Contas+Guardado!", 0)
menu_setprop(Menu,MPROP_EXITNAME,"Sair")
menu_display(id, Menu, 0)
return PLUGIN_HANDLED;
}
else
Llamar(id)
return PLUGIN_HANDLED;
}
/*--------------------------------------------------------------------------------------------------
-----------------------------------------------Menu de Reg----------------------------------------*/
public Menu(id)
{
new Menu = menu_create("\ySistema de Registro para \r(ZombiePlague)", "Mostrar")
menu_additem(Menu, "\wRegistrar Nova Conta^n\r[Criar nova conta]", "1", 0)
menu_additem(Menu, "\wLogar-se^n\r[Carregar seus AmmoPacks]", "2", 0)
menu_addtext(Menu, "\w^n^nSistema De Contas+Guardado!", 0)
menu_setprop(Menu,MPROP_EXITNAME,"Sair")
menu_display(id, Menu, 0)
}
public Mostrar(id, Menu, item)
{
if (item == MENU_EXIT)
{
ChatColor(id, "!g[ZombiePlague] !ySe esta de spectador, Nao te poderas ver o menu!")
}
new iData[6];
new iAccess;
new iCallback;
new iName[64];
menu_item_getinfo(Menu, item, iAccess, iData, 5, iName, 63, iCallback)
switch (str_to_num(iData))
{
case 1:
{
PreCuenta(id)
}
case 2:
{
if( Intentos[id] == 3 )
{
client_cmd(id, "disconnect;echo MAXIMO DE TENTATIVAS ALCANSADAS;toggleconsole")
}
PreLogueo(id)
}
}
return PLUGIN_HANDLED
}
/*--------------------------------------------------------------------------------------------------
-------------------------------------------Login--------------------------------------------*/
public PreLogueo(id)
{
new szData[512], szNombre[32]
get_user_name(id, szNombre, 31)
if( !fvault_get_data(NombreVaul, szNombre, szData, charsmax(szData)) )
{
ChatColor(id, "!g[ZombiePlague] !yVoce Nao esta Registrado!")
Menu(id)
return PLUGIN_HANDLED
}
else
{
client_cmd(id, "messagemode Logar_Senha")
set_hudmessage(170, 255, 127, 0.0, 0.07, 0, 6.0, 12.0)
show_hudmessage(id, "Digite sua Senha para fazer login.")
}
return PLUGIN_HANDLED
}
public Logueo(id)
{
new szData[512], szNombre[32], szContra[192]
get_user_name(id, szNombre, 31)
read_args( LogPw, charsmax(LogPw) )
remove_quotes( LogPw )
trim( LogPw )
if( !fvault_get_data(NombreVaul, szNombre, szData, charsmax(szData) ) )
return 0
parse(szData, szContra, 191)
if( equal(szContra,LogPw) )
{
Reg[id] = 1
MalaPW[id] = 0
set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)
show_hudmessage(id, "Voce logou com Exito")
}
else
{
MalaPW[id] = 1
Menu(id)
Intentos[id]++
set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)
show_hudmessage(id, "Senha Incorreta!^n Tente novamente.")
return PLUGIN_HANDLED
}
return 1
}
/*---------------------------------------------------------------------------------------------
------------------------------------------ REGISTRO -------------------------------------------*/
public PreCuenta(id)
{
new szData[512], szNombre[32]
get_user_name(id, szNombre, 31)
if( fvault_get_data(NombreVaul, szNombre, szData, charsmax(szData)) )
{
ChatColor(id, "!g[ZombiePlague] !yJa estas Registrado! Logue-se!")
Menu(id)
return PLUGIN_HANDLED
}
else
{
client_cmd(id, "messagemode Registro_Senha")
set_hudmessage(170, 255, 127, 0.0, 0.07, 0, 6.0, 12.0)
show_hudmessage(id, "Digite sua Senha para se registrar.Escolha uma senha dificil.")
}
return PLUGIN_HANDLED
}
public Cuenta(id)
{
read_args( Contra, charsmax(Contra) )
remove_quotes( Contra )
trim( Contra )
if( equal(Contra,"") || contain(Contra," ") != -1 )
{
ChatColor(id, "!g[Sistema de Registro] !yA Senha deve ter pelo menos 1 palavra ")
Menu(id)
return PLUGIN_HANDLED
}
else
{
new szData[512], szNombre[32]
get_user_name(id, szNombre, 31)
Reg[id] = 1
set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)
show_hudmessage(id, "Voce se registrou com sucesso!")
formatex(szData, charsmax(szData), "%s", Contra)
fvault_set_data(NombreVaul, szNombre, szData)
}
return PLUGIN_HANDLED
}
/*--------------------------------------------------------------------------------------------------
-----------------------------------------------Nova PW-------------------------------------------*/
public NuevaContra(id)
{
read_args( ContraNueva, charsmax(ContraNueva) )
remove_quotes( ContraNueva )
trim( ContraNueva )
if( equal(ContraNueva,"") || contain(ContraNueva," ") != -1 )
{
ChatColor(id, "!g[ZombiePlague] !yA Senha deve ter pelo menos 1 palavra!")
Menu(id)
return PLUGIN_HANDLED
}
else
{
new szData[512], szNombre[32]
get_user_name(id, szNombre, 31)
Reg[id] = 1
set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)
show_hudmessage(id, "Tua senha foi alterada com sucesso! ")
formatex(szData, charsmax(szData), "%s", ContraNueva)
fvault_set_data(NombreVaul, szNombre, szData)
}
return PLUGIN_HANDLED
}
/*--------------------------------------------------------------------------------------------------
------------------------------------------Opcoes da conta--------------------------------------*/
public Opciones(id)
{
new Texto[192]
new Menu = menu_create("\yOpcoes", "MostrarOpc")
if( get_pcvar_num(Cambiar) != 0 && PuedoTeam[id] == 0 )
formatex(Texto, charsmax(Texto), "\wMudar de Team^n")
else
formatex(Texto, charsmax(Texto), "\dMudar de Team^n")
menu_additem(Menu, Texto, "1", 0)
menu_additem(Menu, "\wMudar Senha", "2", 0)
menu_additem(Menu, "\wSair da Conta", "3", 0)
menu_setprop(Menu,MPROP_EXITNAME,"Sair")
menu_display(id, Menu, 0)
}
public MostrarOpc(id, Menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(Menu)
return PLUGIN_HANDLED
}
new iData[6];
new iAccess;
new iCallback;
new iName[64];
menu_item_getinfo(Menu, item, iAccess, iData, 5, iName, 63, iCallback)
switch (str_to_num(iData))
{
case 1:
{
if( get_pcvar_num(Cambiar) != 0 && PuedoTeam[id] == 0)
{
if( cs_get_user_team(id) == CS_TEAM_CT )
{
user_silentkill(id)
cs_set_user_team(id, CS_TEAM_T)
}
else
{
user_silentkill(id)
cs_set_user_team(id, CS_TEAM_CT)
}
PuedoTeam[id] = 1
}
else
{
ChatColor(id, "!g[ZombiePlague] !yNao esta permitido a troca de Times")
return PLUGIN_HANDLED
}
}
case 2:
{
if( CambiarPW[id] == 0 )
{
client_cmd(id, "messagemode Nova_Senha")
CambiarPW[id] = 1
}
else
{
ChatColor(id, "!g[ZombiePlague] !yNao pode trocar tua senha mais de 1 vez por mapa!")
return PLUGIN_HANDLED
}
}
case 3:
{
client_cmd(id, "echo ********************************;echo **** Voce decidiu sair da conta! *****;echo ********************************;disconnect;toggleconsole")
}
}
return PLUGIN_HANDLED
}
public Llamar(id)
{
new callfunc = callfunc_begin("clcmd_changeteam", "zombie_plague.amxx") // nome do seu plugin do zombieplague ex : zombieplague1677.amxx
switch(callfunc)
{
case -2: return log_error(AMX_ERR_NOTFOUND, "Funcao nao encontrada")
case -1: return log_error(AMX_ERR_NOTFOUND, "Plugin nao existe")
case 0: return log_error(AMX_ERR_NOTFOUND, "Erro de Tempo")
case 1:
{
callfunc_push_int(id)
callfunc_end()
return 1
}
}
return 1
}
/*--------------------------------------------------------------------------------------------------
-----------------------------------------------COLOR CHAT-----------------------------------------*/
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!team", "^3") // Team Color
replace_all(msg, 190, "!team2", "^0") // Team2 Color
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
Se nao aparecer as includes sao essas :
- Código:
#include <amxmodx>#include <amxmisc>#include <cstrike>#include <fvault>#include <fakemeta>#include <zombieplague>