Achei no forum da Allied Modders e arrumei o bagui da include color e coloquei o client_printcolor !!
kkkkkkkkkk...
SMA ABAIXO :
kkkkkkkkkk...
SMA ABAIXO :
Código:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fvault>
#include <nvault>
#include <zombie_plague_advance>
const KEYSMENU = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0
enum
{
NEGADO,
CONCEDIDO,
ACEITO,
ERROR
}
new tempPlayerSenha[33],
tempPlayerSenha2[33],
tempLoginSenha[33],
MudarSenhaAtual[33],
MudarSenhaNova[33],
vaultPlayerNick[33],
vaultPlayerSenha[33],
g_tentativas[33],
SteamID[50];
new bool:g_logado[33],
bool:plSteam[33],
bool:plRegistrado[33];
new cvar_punhish,
cvar_tentativas,
cvar_bantime,
g_msgSyncHud;
new const BaseDados[] = "DH_clients_data"
enum pcvar
{
enable = 0,
cap,
start,
advertise,
deposit,
withdraw,
savetype,
bot
}
new gvault, pcvars[pcvar], bankstorage[33]
public plugin_init() {
register_plugin("DH | Adv. Register + Bank Packs", "1.0", "SprIte")
register_forward(FM_ClientUserInfoChanged, "FWClientUserInfoChanged")
register_clcmd("chooseteam", "cmd_chooseteam")
register_clcmd("jointeam", "cmd_chooseteam")
register_clcmd("[Registrar]Senha_", "cmd_senha")
register_clcmd("[Registrar]Confirmar_Senha_", "cmd_confirmar_senha")
register_clcmd("[Logar]Senha_", "cmd_logar")
register_clcmd("[MudarSenha]Senha_Atual_", "cmd_check_mudar_senha")
register_clcmd("[MudarSenha]Nova_Senha_", "cmd_mudar_senha")
register_clcmd("[Banco]Deposito_", "cmd_deposito_filter")
register_clcmd("[Banco]Sacar_", "cmd_saque_filter")
cvar_punhish = register_cvar("xregister_punish", "1")
cvar_tentativas = register_cvar("xregister_tentativas", "3")
cvar_bantime = register_cvar("xregister_bantime", "5")
register_dictionary("DH_register.txt")
g_msgSyncHud = CreateHudSyncObj();
register_menu("Menu Resgistro Principal", KEYSMENU, "registro_main_handler")
register_menu("Bank Menu", KEYSMENU, "bank_handler")
//----------------------------------------------------------------------------
register_dictionary("zp_bank.txt")
gvault = nvault_open("Zombie Bank Ultimate");
pcvars[enable] = register_cvar("zp_bank", "1");
pcvars[cap] = register_cvar("zp_bank_limit", "1000000");
pcvars[start] = register_cvar("zp_bank_blockstart", "0");
pcvars[advertise] = register_cvar("zp_bank_ad_delay", "180.0")
pcvars[deposit] = register_cvar("zp_bank_deposit", "1")
pcvars[withdraw] = register_cvar("zp_bank_withdraw", "1")
pcvars[savetype] = register_cvar("zp_bank_save_type", "1")
pcvars[bot] = register_cvar("zp_bank_bot_support", "1")
if (get_pcvar_num(pcvars[cap]) > 2147483646)
{
set_pcvar_num(pcvars[cap], 2147483646);
server_print("[%L] %L", LANG_PLAYER, "BANK_PREFIX", LANG_PLAYER, "BANK_LIMIT");
}
else if (get_pcvar_num(pcvars[cap]) < 1)
set_pcvar_num(pcvars[cap], 1);
register_clcmd("say", "handle_say");
register_clcmd("say_team", "handle_say");
if (get_pcvar_num(pcvars[advertise]))
set_task(get_pcvar_float(pcvars[advertise]), "advertise_loop");
}
public plugin_precache()
{
precache_sound("DH_register/button_accept.wav")
precache_sound("DH_register/button_locked.wav")
}
public client_putinserver(id)
{
g_logado[id] = false
g_tentativas[id] = 0
plRegistrado[id] = false
plSteam[id] = false
}
public plugin_cfg()
{
// Plugin is disabled
if (!get_pcvar_num(pcvars[enable]))
return;
// Get configs dir
new cfgdir[32]
get_configsdir(cfgdir, charsmax(cfgdir))
// Execute config file (zp_rewards.cfg)
server_cmd("exec %s/zp_bank.cfg", cfgdir)
}
public plugin_end()
nvault_close(gvault);
public check_punish(id)
{
if(g_tentativas[id] >= get_pcvar_num(cvar_tentativas))
{
new punish = get_pcvar_num(cvar_punhish)
if(punish <= 0 || punish >= 3)
return PLUGIN_HANDLED;
new Nick[33],
Ip[13],
SteamID[51];
get_user_ip(id, Ip[id], 12)
get_user_authid(id, SteamID[id], 50)
get_user_name(id, Nick[id], 32)
if(punish == 1)
{
new UserID = get_user_userid(id)
server_cmd("kick #%i %L", UserID, id, "KICK_MSG2")
Log("------------------------------------------------------------------------------------------------------------------------")
Log("DH Register : Jogador ^"%s^" foi kickado por errar a senha muitas vezes.", Nick[id])
Log("IP: %s", Ip[id])
Log("SteamID: %s", SteamID[id])
Log("------------------------------------------------------------------------------------------------------------------------")
return PLUGIN_HANDLED
}
if(punish == 2)
{
new UserID = get_user_userid(id)
server_cmd("amx_banip #%i %i ^"%L^"", UserID, get_pcvar_num(cvar_bantime),id, "BAN_MSG", get_pcvar_num(cvar_tentativas))
Log("------------------------------------------------------------------------------------------------------------------------")
Log("DH Register : Jogador ^"%s^" foi banido por %d minutos por errar a senha muitas vezes.", Nick[id], get_pcvar_num(cvar_bantime))
Log("IP: %s", Ip[id])
Log("SteamID: %s", SteamID[id])
Log("------------------------------------------------------------------------------------------------------------------------")
}
}
return PLUGIN_CONTINUE
}
public filtrar_kick(id)
{
if(g_logado[id]==false)
{
server_cmd("kick #%i %L", get_user_userid(id), id, "KICK_MSG1")
}
return PLUGIN_CONTINUE
}
public check_status(id)
{
static tempData[521];
get_user_authid(id, SteamID[id], 49)
if(equal(SteamID[id], "STEAM_ID_LAN"))
plSteam[id] = false;
else
plSteam[id] = true;
if(plSteam[id] == true)
{
if(fvault_get_data(BaseDados, SteamID[id], tempData[id], 520))
plRegistrado[id] = true;
else
plRegistrado[id] = false;
}
else
{
get_user_name(id, vaultPlayerNick[id], 32)
if(fvault_get_data(BaseDados, vaultPlayerNick[id], tempData[id], 520))
plRegistrado[id] = true;
else
plRegistrado[id] = false;
}
menu_registro_main(id)
return PLUGIN_CONTINUE
}
public menu_registro_main(id)
{
new SteamID[50];
get_user_authid(id, SteamID[id], 49)
get_user_name(id, vaultPlayerNick[id], 32)
static menu[240], len;
len = 0
len += formatex(menu[len], charsmax(menu) - len, "\r[DH Register] \w%L.", id, "MENU_TITULO")
len += formatex(menu[len], charsmax(menu) - len, "^n\w%L \d%s\r[%L]", id, "MENU_NICK", vaultPlayerNick[id], id, plRegistrado[id] ? "MENU_REGISTRADO" : "MENU_NAO_REGISTRADO")
len += formatex(menu[len], charsmax(menu) - len, plSteam[id] ? "^n\wSteamID: \y%s" : "^n\wSteamID: \dN/A^n", SteamID[id])
if(g_logado[id] == true)
len += formatex(menu[len], charsmax(menu) - len, "^n\d1. %L", id, "MENU_KEY_ENTRAR");
else
len += formatex(menu[len], charsmax(menu) - len, plRegistrado[id] ? "^n\r1. \w%L" : "^n\d1. %L", id, "MENU_KEY_ENTRAR")
len += formatex(menu[len], charsmax(menu) - len, plRegistrado[id] ? "^n\d2. %L" : "^n\r2. \w%L", id, "MENU_KEY_REGISTRAR")
len += formatex(menu[len], charsmax(menu) - len, g_logado[id] && !plSteam[id] ? "^n^n\r3. \w%L" : "^n^n\d3. %L", id, "MENU_KEY_MUDAR_PW")
len += formatex(menu[len], charsmax(menu) - len, g_logado[id] ? "^n\r4. \w%L" : "^n\d4. %L", id, "MENU_KEY_SAIR_CONTA")
len += formatex(menu[len], charsmax(menu) - len, g_logado[id] ? "^n\r5. \wAcessar o Banco" : "^n\d5. Acessar o Banco")
len += formatex(menu[len], charsmax(menu) - len, "^n^n^n\r0. \w%L", id, "MENU_KEY_SAIR")
show_menu(id, KEYSMENU, menu, -1, "Menu Resgistro Principal")
}
public registro_main_handler(id, key)
{
switch(key)
{
case 0: filtrar_login(id)
case 1: filtrar_registro(id)
case 2: filtrar_mudar_senha(id)
case 3: filtrar_sair_conta(id)
case 4: filtrar_bank_access(id)
case 5: menu_registro_main(id)
case 6: menu_registro_main(id)
case 7: menu_registro_main(id)
case 8: menu_registro_main(id)
case 9: filtrar_kick(id)
}
return PLUGIN_HANDLED
}
public filtrar_registro(id)
{
new tempData[521];
if(g_logado[id]==false)
{
if(plSteam[id] == true)
{
get_user_authid(id, SteamID[id], 49)
if(fvault_get_data(BaseDados, SteamID[id], tempData[id], 520))
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "ERROR_NICK1")
EmitSound(id, ERROR)
menu_registro_main(id)
return PLUGIN_HANDLED
}
else
{
cmd_registro(id)
}
}
else
{
get_user_name(id, vaultPlayerNick[id], 32)
if(!fvault_get_data(BaseDados, vaultPlayerNick[id], tempData[id], 520))
{
client_cmd(id, "messagemode [Registrar]Senha_")
set_hudmessage(0, 0, 255, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "DIGITE_SENHA5")
EmitSound(id, ACEITO)
}
else
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "ERROR_NICK1")
EmitSound(id, ERROR)
menu_registro_main(id)
}
}
}
else
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "Voce ja esta registrado...")
EmitSound(id, ERROR)
menu_registro_main(id)
}
return PLUGIN_CONTINUE
}
public filtrar_login(id)
{
new tempData[512]
get_user_name(id, vaultPlayerNick[id], 32)
if(g_logado[id]==false)
{
if(plSteam[id] == true)
{
get_user_authid(id, SteamID[id], 49)
if(fvault_get_data(BaseDados, SteamID[id], tempData[id], 520))
{
EmitSound(id, ACEITO)
g_logado[id]=true
client_cmd(id, "chooseteam")
bankstorage[id] = 0; //clear residual before loading
retrieve_data(id);
check_status(id)
if (!get_pcvar_num(pcvars[withdraw]))
{
if (!bankstorage[id] || is_user_bot(id) && !get_pcvar_num(pcvars[bot]))
return -1;
take_packs(id, 0)
}
return PLUGIN_HANDLED
}
}
else if(fvault_get_data(BaseDados, vaultPlayerNick[id], tempData[id], 520))
{
client_cmd(id, "messagemode [Logar]Senha_")
set_hudmessage(0, 0, 255, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "DIGITE_SENHA1")
EmitSound(id, ACEITO)
}
else
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "ERROR_NICK2")
EmitSound(id, ERROR)
menu_registro_main(id)
}
}
else
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "ERROR_NICK3")
EmitSound(id, ERROR)
menu_registro_main(id)
}
return PLUGIN_CONTINUE
}
public filtrar_mudar_senha(id)
{
check_status(id)
if(g_logado[id]==false)
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "ERROR_NICK4")
menu_registro_main(id)
EmitSound(id, ERROR)
}
else
{
if(plSteam[id] == true)
{
EmitSound(id, ERROR)
client_printcolor(id, "!g[DH Register] !yJogadores !tSteam !ynao precisao de senha.")
menu_registro_main(id)
return PLUGIN_CONTINUE
}
set_hudmessage(0, 0, 255, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "DIGITE_SENHA2")
client_cmd(id, "messagemode [MudarSenha]Senha_Atual_")
EmitSound(id, ACEITO)
}
return PLUGIN_CONTINUE
}
public filtrar_sair_conta(id)
{
if(g_logado[id]==false)
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "ERROR_NICK4")
menu_registro_main(id)
EmitSound(id, ERROR)
}
else
{
user_silentkill(id)
cs_set_user_team(id, CS_TEAM_UNASSIGNED)
g_logado[id]=false
menu_registro_main(id)
}
}
public filtrar_bank_access(id)
{
if(g_logado[id]==false)
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "ERROR_NICK4")
menu_registro_main(id)
EmitSound(id, ERROR)
}
else
Menu_Info(id);
return PLUGIN_CONTINUE
}
public cmd_check_mudar_senha(id)
{
read_args(MudarSenhaAtual[id], charsmax(MudarSenhaAtual))
remove_quotes(MudarSenhaAtual[id])
trim(MudarSenhaAtual[id])
if(equal(MudarSenhaAtual[id], "") || equal(MudarSenhaAtual[id], " "))
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "ERROR_PW1")
menu_registro_main(id)
EmitSound(id, ERROR)
return PLUGIN_HANDLED
}
get_user_name(id, vaultPlayerNick[id], 32)
new tempData[521];
fvault_get_data(BaseDados, vaultPlayerNick[id], tempData[id], 520)
parse(tempData[id], vaultPlayerSenha[id], 190)
if(equal(MudarSenhaAtual[id], vaultPlayerSenha[id]))
{
set_hudmessage(0, 0, 255, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "DIGITE_SENHA3")
EmitSound(id, ACEITO)
client_cmd(id, "messagemode [MudarSenha]Nova_Senha_")
}
else
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "ERROR_PW2")
menu_registro_main(id)
EmitSound(id, NEGADO)
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public cmd_mudar_senha(id)
{
read_args(MudarSenhaNova[id], charsmax(MudarSenhaNova))
remove_quotes(MudarSenhaNova[id])
trim(MudarSenhaNova[id])
get_user_name(id, vaultPlayerNick[id], 32)
new tempData[521];
fvault_get_data(BaseDados, vaultPlayerNick[id], tempData[id], 520)
parse(tempData[id], vaultPlayerSenha[id], 190)
if(equal(MudarSenhaAtual[id], "") || equal(MudarSenhaAtual[id], " "))
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "ERROR_PW1")
menu_registro_main(id)
EmitSound(id, ERROR)
return PLUGIN_HANDLED
}
else
{
new tempData2[512]
get_user_name(id, vaultPlayerNick[id], 32)
formatex(tempData2[id], charsmax(tempData), "%s", MudarSenhaNova[id])
fvault_set_data(BaseDados, vaultPlayerNick[id], tempData2[id])
new SteamID[51]
get_user_authid(id, SteamID[id], 50)
client_printcolor(id, "!g[DH Register] !ySua senha foi alterada com sucesso. Senha antiga: !t%s !y|| Nova Senha: !t%s", MudarSenhaAtual[id], MudarSenhaNova[id])
Log("------------------------------------------------------------------------------------------------------------------------")
Log("DH register: dados do cliente atualizados.")
Log("Nick: %s", vaultPlayerNick[id])
Log("SteamID: %s", SteamID[id])
Log("Tipo de atualizacao: Alterou sua senha.")
Log("Senha antiga: %s", MudarSenhaAtual[id])
Log("Nova senha: %s", tempData2[id])
Log("------------------------------------------------------------------------------------------------------------------------")
set_hudmessage(0, 0, 255, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "MSG_PW_ALTERADA")
EmitSound(id, CONCEDIDO)
menu_registro_main(id)
}
return PLUGIN_CONTINUE
}
public cmd_senha(id)
{
read_args(tempPlayerSenha[id], 31)
remove_quotes(tempPlayerSenha[id])
trim(tempPlayerSenha[id])
if(equal(tempPlayerSenha[id], "") || equal(tempPlayerSenha[id], " "))
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "ERROR_PW1")
menu_registro_main(id)
EmitSound(id, ERROR)
}
else
{
set_hudmessage(0, 0, 255, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "DIGITE_SENHA4")
client_cmd(id, "messagemode [Registrar]Confirmar_Senha_")
EmitSound(id, ACEITO)
}
return PLUGIN_CONTINUE
}
public cmd_confirmar_senha(id)
{
read_args(tempPlayerSenha2[id], 32)
remove_quotes(tempPlayerSenha2[id])
trim(tempPlayerSenha2[id])
if(equal(tempPlayerSenha[id], tempPlayerSenha2[id]))
{
cmd_registro(id)
}
else
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "ERROR_PW4")
menu_registro_main(id)
EmitSound(id, ERROR)
}
}
public cmd_logar(id)
{
new tempData[521];
get_user_name(id, vaultPlayerNick[id], 32)
if(fvault_get_data(BaseDados, vaultPlayerNick[id], tempData[id], 520))
{
cmd_check_pw(id)
}
else
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "ERROR_NICK2")
menu_registro_main(id)
EmitSound(id, ERROR)
}
}
public cmd_check_pw(id)
{
read_args(tempLoginSenha[id], 32)
remove_quotes(tempLoginSenha[id])
trim(tempLoginSenha[id])
if(equal(tempLoginSenha[id], "") || equal(tempLoginSenha[id], " "))
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "ERROR_PW1")
EmitSound(id, ERROR)
menu_registro_main(id)
return PLUGIN_HANDLED
}
new tempData[521]
get_user_name(id, vaultPlayerNick[id], 32)
fvault_get_data(BaseDados, vaultPlayerNick[id], tempData[id], 520)
parse(tempData[id], vaultPlayerSenha[id], 190)
if(equal(vaultPlayerSenha[id] , tempLoginSenha[id]))
{
EmitSound(id, CONCEDIDO)
g_logado[id]=true
client_cmd(id, "chooseteam")
bankstorage[id] = 0;
retrieve_data(id);
if (!get_pcvar_num(pcvars[withdraw]))
{
if (!bankstorage[id] || is_user_bot(id) && !get_pcvar_num(pcvars[bot]))
return -1;
take_packs(id, 0)
}
return PLUGIN_HANDLED
}
else
{
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 30.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "%L", id, "ERROR_PW3")
menu_registro_main(id)
g_tentativas[id]++
EmitSound(id, NEGADO)
check_punish(id)
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public cmd_registro(id)
{
get_user_name(id, vaultPlayerNick[id], 32)
get_user_authid(id, SteamID[id], 49)
new tempData[512]
if(plSteam[id] == true)
{
get_user_authid(id, SteamID[id], 49)
formatex(tempData[id], charsmax(tempData), "SteamID/Non-PW")
fvault_set_data(BaseDados, SteamID[id], tempData[id])
client_printcolor(id, "!g[DH Register] !yRegistro feito com sucesso. SteamID: !t%s.", SteamID[id])
}
else
{
get_user_name(id, vaultPlayerNick[id], 32)
formatex(tempData[id], charsmax(tempData), "%s", tempPlayerSenha[id])
fvault_set_data(BaseDados, vaultPlayerNick[id], tempData[id])
client_printcolor(id, "!g[DH Register] !yRegistro feito com sucesso. Nick: !t%s !y|| Senha: !t%s", vaultPlayerNick[id], tempPlayerSenha[id])
}
Log("------------------------------------------------------------------------------------------------------------------------")
Log("DH Register: Adicionado novos dados ao registro do servidor.")
Log("Nick: %s", vaultPlayerNick[id])
Log("SteamID: %s", SteamID[id])
Log("Senha da Conta: %s", tempPlayerSenha[id])
Log("------------------------------------------------------------------------------------------------------------------------")
menu_registro_main(id)
return PLUGIN_CONTINUE
}
public cmd_chooseteam(id)
{
if(cs_get_user_team(id) == CS_TEAM_SPECTATOR || cs_get_user_team(id) == CS_TEAM_UNASSIGNED && g_logado[id]==false)
{
check_status(id)
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
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;
}
Log(const message_fmt[], any:...)
{
static message[500];
vformat(message, sizeof(message) - 1, message_fmt, 2);
static filename[96];
new base[51],
fr_data[51]
get_basedir(base, 50)
if( !filename[0] )
{
get_basedir(filename, sizeof(filename) - 1);
add(filename, sizeof(filename) - 1, "logs/reg_history.log");
}
format_time(fr_data, sizeof(filename) - 1, "%d-%m-%Y");
format(filename, sizeof(filename) - 1, "%s/logs/reg_history_%s.log", base, fr_data);
log_to_file(filename, "%s", message);
}
stock EmitSound(index, sound)
{
switch(sound)
{
case NEGADO: client_cmd(index, "spk ^"access denied^"");
case CONCEDIDO: client_cmd(index, "spk ^"access granted^"");
case ACEITO: client_cmd(index, "spk DH_register/button_accept");
case ERROR: client_cmd(index, "spk DH_register/button_locked");
}
}
/*---------------------------------------------------------------------------------------
----------------------------------BANK NATIVES-------------------------------------------
---------------------------------------------------------------------------------------*/
public Menu_Info(id)
{
static menu[195], len;
len = 0
len += formatex(menu[len], charsmax(menu) - len, "\r[DH Bank] \wOpcoes da conta.")
new BankNick[33]
get_user_name(id, BankNick[id], 32)
len += formatex(menu[len], charsmax(menu) - len, "^n\wConta: \d%s", BankNick[id])
len += formatex(menu[len], charsmax(menu) - len, "^n\wSaldo\d: \r%d \wAmmoPacks^n" , bankstorage[id])
len += formatex(menu[len], charsmax(menu) - len, g_logado[id] ? "^n\r1. \wDepositar Quantia" : "^n\d1. Depositar Quantia")
len += formatex(menu[len], charsmax(menu) - len, g_logado[id] ? "^n\r2. \wDepositar Tudo" : "^n\d2. Depositar Tudo")
len += formatex(menu[len], charsmax(menu) - len, g_logado[id] ? "^n^n\r3. \wSacar Quantia" : "^n^n\d3. Sacar Quantia")
len += formatex(menu[len], charsmax(menu) - len, g_logado[id] ? "^n\r4. \wSacar Tudo" : "^n\d4. Sacar Tudo")
len += formatex(menu[len], charsmax(menu) - len, "^n^n^n\r0. \w%L", id, "MENU_KEY_SAIR")
show_menu(id, KEYSMENU, menu, -1, "Bank Menu")
}
public bank_handler(id, key)
{
switch(key)
{
case 0:
{
client_cmd(id, "messagemode [Banco]Deposito_")
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 10.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "Digite a quantia que deseja depositar.")
}
case 1:
{
new CurretAmmount[20]
CurretAmmount[id] = zp_get_user_ammo_packs(id)
if(CurretAmmount[id] <= 0)
{
client_printcolor(id, "!g[DH Register] !yQuantia invalida.")
}
else
{
client_cmd(id,"say /depositar all")
}
}
case 2:
{
client_cmd(id, "messagemode [Banco]Sacar_")
set_hudmessage(255, 0, 0, 0.01, 0.15, 2, 1.0, 3.0, 0.1, 10.0, 3)
ShowSyncHudMsg( id, g_msgSyncHud, "Digite a quantia que deseja sacar.")
}
case 3:
{
client_cmd(id,"say /sacar all")
}
case 4: Menu_Info(id)
case 5: Menu_Info(id)
case 6: Menu_Info(id)
case 7: Menu_Info(id)
case 8: Menu_Info(id)
case 9: return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public cmd_deposito_filter(id)
{
new tempQuantia[19]
read_args(tempQuantia[id], 20)
remove_quotes(tempQuantia[id])
trim(tempQuantia[id])
if(tempQuantia[id] <= 0)
{
client_printcolor(id, "!g[DH Register] !yQuantia invalida.")
return PLUGIN_HANDLED
}
else
{
client_cmd(id, "say /depositar %s", tempQuantia[id])
}
return PLUGIN_CONTINUE
}
public cmd_saque_filter(id)
{
new tempQuantia[19]
read_args(tempQuantia[id], 20)
remove_quotes(tempQuantia[id])
trim(tempQuantia[id])
if(tempQuantia[id] <= 0)
{
client_printcolor(id, "!g[DH Register] !yQuantia invalida.")
return PLUGIN_HANDLED
}
else
{
client_cmd(id, "say /sacar %s", tempQuantia[id])
}
return PLUGIN_CONTINUE
}
public advertise_loop()
{
if (!get_pcvar_num(pcvars[enable]) || !get_pcvar_float(pcvars[advertise]))
{
remove_task()
return;
}
if (get_pcvar_num(pcvars[cap]))
client_printcolor(0, "^x04[%L]^x01 %L", LANG_PLAYER, "BANK_PREFIX", LANG_PLAYER, "BANK_INFO1", get_pcvar_num(pcvars[cap]));
if (get_pcvar_num(pcvars[deposit]))
client_printcolor(0, "^x04[%L]^x01 %L", LANG_PLAYER, "BANK_PREFIX", LANG_PLAYER, "BANK_INFO_DPS");
else
client_printcolor(0, "^x04[%L]^x01 %L", LANG_PLAYER, "BANK_PREFIX", LANG_PLAYER, "BANK_INFO_AS");
if (get_pcvar_num(pcvars[withdraw]))
client_printcolor(0, "^x04[%L]^x01 %L", LANG_PLAYER, "BANK_PREFIX", LANG_PLAYER, "BANK_INFO_WD");
set_task(get_pcvar_float(pcvars[advertise]), "advertise_loop");
}
public handle_say(id)
{
if (!get_pcvar_num(pcvars[enable]))
return PLUGIN_CONTINUE;
new text[70], arg1[32], arg2[32], arg3[6];
read_args(text, sizeof(text) - 1);
remove_quotes(text);
arg1[0] = '^0';
arg2[0] = '^0';
arg3[0] = '^0';
parse(text, arg1, sizeof(arg1) - 1, arg2, sizeof(arg2) - 1, arg3, sizeof(arg3) - 1);
//strip forward slash if present
if (equali(arg1, "/", 1))
format(arg1, 31, arg1[1]);
// if the chat line has more than 2 words, we're not interested at all
if (arg3[0])
return PLUGIN_CONTINUE;
if (equali(arg1, "deposit"))
{
if (!get_pcvar_num(pcvars[deposit]))
{
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_DNA");
return PLUGIN_CONTINUE;
}
if (isdigit(arg2[0]) || arg2[0] == '-' && isdigit(arg2[1]))
{
new amount = str_to_num(arg2);
if (amount <= 0)
{
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_VGZ");
return PLUGIN_CONTINUE;
}
store_packs(id, amount);
return PLUGIN_HANDLED;
}
else if (equali(arg2, "all"))
{
store_packs(id, 0);
return PLUGIN_HANDLED;
}
else if (!arg2[0])
{
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_HELP_DPS");
return PLUGIN_CONTINUE;
}
return PLUGIN_CONTINUE;
}
else if (equali(arg1, "sacar"))
{
if (!get_pcvar_num(pcvars[withdraw]))
{
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_WNA");
return PLUGIN_CONTINUE;
}
if (isdigit(arg2[0]) || arg2[0] == '-' && isdigit(arg2[1]))
{
new amount = str_to_num(arg2);
if (amount <= 0)
{
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_VGZ");
return PLUGIN_CONTINUE;
}
take_packs(id, amount);
return PLUGIN_HANDLED;
}
else if (equali(arg2, "all") || equali(arg2, "everything"))
{
take_packs(id, 0);
return PLUGIN_HANDLED;
}
else if (!arg2[0])
{
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_HELP_WD");
return PLUGIN_CONTINUE;
}
return PLUGIN_CONTINUE;
}
else if (equali(arg1, "banco") || equali(arg1, "saldo"))
{
if (!arg2[0])
{
Menu_Info(id)
return PLUGIN_HANDLED;
}
else
{
new id2 = cmd_target(id, arg2, 2);
if (!id2)
return PLUGIN_CONTINUE;
static id2name[32];
get_user_name(id2, id2name, 31);
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_INFO_CHK2", id2name, bankstorage[id2]);
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
else if(equali(arg1, "reg") || equali(arg1, "register") || equali(arg1, "registro"))
{
check_status(id)
set_task(1.0, "menu_registro_main", id)
}
return PLUGIN_CONTINUE;
}
//public zp_user_disconnect_pre(id)
public client_disconnect(id)
{
if (!get_pcvar_num(pcvars[enable]))
return;
if (is_user_bot(id) && !get_pcvar_num(pcvars[bot]) || !zp_get_user_ammo_packs(id))
return;
else
store_packs(id, 0);
if (bankstorage[id] > 0)
save_data(id);
}
store_packs(id, amnt)
{
if (!get_pcvar_num(pcvars[enable]))
return;
new temp[33] = 0;
new limit = get_pcvar_num(pcvars[cap]);
new fill = limit - bankstorage[id];
temp[id] = 0
temp[id] = zp_get_user_ammo_packs(id)
if (!temp[id])
{
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_NAPTD")
return;
}
if (amnt == 0)
{
if (bankstorage[id] + temp[id] <= limit)
{
bankstorage[id] += temp[id];
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_DPST", temp)
zp_set_user_ammo_packs(id, 0);
}
else
{
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_CPCT", limit);
if (!fill)
{
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_NDPST");
return;
}
else
{
bankstorage[id] += fill
zp_set_user_ammo_packs(id, temp[id] - fill);
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_PADPST", fill);
}
}
checkmax(id);
}
else if (amnt > 0)
{
if (temp[id] >= amnt)
{
if (bankstorage[id] + amnt <= limit)
{
bankstorage[id] += amnt
zp_set_user_ammo_packs(id, temp[id] - amnt);
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_DPST", amnt)
}
else
{
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_CPCT", limit);
if (!fill)
{
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_NDPST");
return;
}
else
{
bankstorage[id] += fill
zp_set_user_ammo_packs(id, temp[id] - fill);
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_PDPST", fill, amnt);
}
}
}
else
{
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_ASTDG", amnt, temp);
return;
}
}
}
take_packs(id, amnt)
{
retrieve_data(id)
if (!get_pcvar_num(pcvars[enable]))
return;
if (!bankstorage[id])
{
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_NPIA")
return;
}
if (amnt == 0)
{
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + bankstorage[id])
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_WALL", bankstorage[id])
bankstorage[id] = 0;
}
else if (amnt > 0)
{
if (bankstorage[id] >= amnt)
{
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + amnt);
bankstorage[id] -= amnt;
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_WAM", amnt)
}
else
{
client_printcolor(id, "^x04[%L]^x01 %L", id, "BANK_PREFIX", id, "BANK_ASGB", amnt, bankstorage[id]);
return;
}
}
}
save_data(id)
{
new vaultkey[40], vaultdata[13];
//switch (get_pcvar_num(pcvars[savetype]))
check_status(id)
if(plSteam[id] == true)
{
get_user_authid(id, SteamID[id], 49)
formatex(vaultkey[id], 39, "__%s__", SteamID[id]);
}
else
{
get_user_name(id, vaultPlayerNick[id], 32)
formatex(vaultkey[id], 39, "__%s__", vaultPlayerNick[id]);
}
formatex(vaultdata[id], 12, "%i", bankstorage[id]);
nvault_set(gvault, vaultkey[id], vaultdata[id]);
}
retrieve_data(id)
{
new vaultkey[40], vaultdata[13];
check_status(id)
if(plSteam[id] == true)
{
get_user_authid(id, SteamID[id], 49)
formatex(vaultkey[id], 39, "__%s__", SteamID[id]);
}
else
{
get_user_name(id, vaultPlayerNick[id], 32)
formatex(vaultkey[id], 39, "__%s__", vaultPlayerNick[id]);
}
nvault_get(gvault, vaultkey[id], vaultdata[id], 12);
bankstorage[id] = str_to_num(vaultdata);
checkmax(id);
// If they have an account don't allow zombie mod to give them 5 ammo packs at beggining
if (get_pcvar_num(pcvars[start]) && bankstorage[id] > 0)
zp_set_user_ammo_packs(id, 0);
}
checkmax(id)
{
if (bankstorage[id] > get_pcvar_num(pcvars[cap]))
bankstorage[id] = get_pcvar_num(pcvars[cap]);
else if (bankstorage[id] < 0)
bankstorage[id] = 0;
}
stock client_printcolor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Chat Verde
replace_all(msg, 190, "!y", "^1") // Chat Normal
replace_all(msg, 190, "!t", "^3") // Chat Do Time Tr=Vermelho Ct=Azul Spec=Branco
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();
}
}
}
}