Alguem pode coloca pra min um comando pra quando digitar "/conta" mostrar os comandos do plugin?
SMA
SMA
Código:
#include <amxmodx>
#include <amxmisc>
#include <zombieplague>
#include <fvault>
/*==================================================================================================
* GLOBAL VARS & ENUMS *
==================================================================================================*/
enum
{
PASSWORD = 0,
NAME,
MAX_CHANGE
}
enum
{
UNREGISTERED = 0,
REGISTERED,
LOGGED,
MAX_STATUS
}
new g_TempPassword[33][32],g_Password[33][32],g_Date[33][32],g_Status[33],gMsg,g_AlredyChanged[33][MAX_CHANGE],g_CanChange
new const g_MsgArgs[][] = { "#Team_Select","#Team_Select_Spect","#IG_Team_Select","#IG_Team_Select_Spect" }
new const g_Vault[] = "_cuentas_"
new const g_szStatus[MAX_STATUS][] = { "Nao registrado","Registrado","Logado" }
/*==================================================================================================
* BEGINNING OF PLUGIN *
==================================================================================================*/
public plugin_init()
{
register_plugin("Sistema de Cuentas","2.0.1","TK")
register_message(get_user_msgid("ShowMenu"),"message_showmenu")
register_message(get_user_msgid("VGUIMenu"),"message_vguimenu")
register_clcmd("INGRESAR_PASSWORD","cmd_password")
register_clcmd("INGRESAR_NICK","cmd_nick")
gMsg = CreateHudSyncObj()
}
/*==================================================================================================
* CLIENT_ FUNCS *
==================================================================================================*/
public client_putinserver(id)
{
g_Password[id][0] = '^0';g_Status[id] = UNREGISTERED
g_AlredyChanged[id][NAME] = 0;g_AlredyChanged[id][PASSWORD] = 0
fvault_load(id)
}
public client_infochanged(id)
{
static szName[32],szOldName[32]
get_user_name(id,szOldName,31);get_user_info(id,"name",szName,31)
if(equal(szOldName,szName) || g_CanChange)
return PLUGIN_CONTINUE
client_cmd(id,"name %s",szName);set_user_info(id,"name",szName)
return PLUGIN_HANDLED
}
/*==================================================================================================
* CMDs *
==================================================================================================*/
public cmd_password(id)
{
static szName[32],szArgs[64];read_args(szArgs,63)
remove_quotes(szArgs);trim(szArgs)
get_user_name(id,szName,31)
if(containi(szArgs," ") != -1 || equal(szArgs,"")) {
show_msg(id,"Seu PASSWORD tem erros...")
return PLUGIN_HANDLED
}
switch(g_Status[id])
{
case UNREGISTERED: {
show_msg(id,"Confirma seu PASSWORD...");copy(g_TempPassword[id],31,szArgs)
show_menu_confirm(id)
}
case REGISTERED: {
if(!equal(g_Password[id],szArgs)) {
show_msg(id,"O PASSWORD Nao Conside Com A Da Conta...")
return PLUGIN_HANDLED
}
g_Status[id] = LOGGED;fvault_save(id)// To save the date
show_msg(id,"Logado Com Sucesso...");change_team(id)
}
case LOGGED: {
if(g_AlredyChanged[id][PASSWORD]) {
show_msg(id,"Voce Mudou Sua Senha...")
return PLUGIN_HANDLED
}
show_msg(id,"Confirma Sua Senha Para Muda-la...");copy(g_TempPassword[id],31,szArgs)
show_menu_confirm(id)
}
}
return PLUGIN_HANDLED
}
public cmd_nick(id)
{
if(g_Status[id] != LOGGED || g_AlredyChanged[id][NAME])
return PLUGIN_HANDLED
static args[32];read_args(args,31)
remove_quotes(args);trim(args)
if(containi(args," ") != -1 || !args[1])
return PLUGIN_HANDLED
if(change_name(id,args))
show_msg(id,"Seu NICK foi mudado com sucesso!")
return PLUGIN_HANDLED
}
/*==================================================================================================
* MENUs *
==================================================================================================*/
public show_menu_block(id)
{
static szMenu[128],szName[32]
get_user_name(id,szName,31);formatex(szMenu,127,"\ySistema de CONTAS \rTK^n\wESTADO ACTUAL: \y[ \r%s \y]\w^n^n%s%s",g_szStatus[g_Status[id]],g_Status[id] == LOGGED ? "Ultima vez que entrou \r":(g_Status[id] == REGISTERED ? "\yEsta registrado como \r":""),g_Status[id] == LOGGED ? g_Date[id]:(g_Status[id] == REGISTERED ? szName:""))
new Menu = menu_create(szMenu,"handler_menu_block")
formatex(szMenu,63,"%sLogar conta",g_Status[id] != REGISTERED ? "\d":"\w")
menu_additem(Menu,szMenu,"1",0)
formatex(szMenu,63,"%sRegistrar Contaa^n",g_Status[id] != UNREGISTERED ? "\d":"\w")
menu_additem(Menu,szMenu,"2",0)
formatex(szMenu,63,"%s%sMudar PASSWORD",g_Status[id] != LOGGED ? "\d":"\w",g_AlredyChanged[id][PASSWORD] ? "\d":"")
menu_additem(Menu,szMenu,"3",0)
formatex(szMenu,63,"%s%sMudar NICK^n",g_Status[id] != LOGGED ? "\d":"\w",g_AlredyChanged[id][NAME] ? "\d":"")
menu_additem(Menu,szMenu,"4",0)
menu_additem(Menu,"Informacao","5",0)
menu_setprop(Menu,MPROP_EXITNAME,"Sair")
menu_display(id,Menu,0)
}
public handler_menu_block(id,menu,item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
switch(item)
{
case 0: {
if(g_Status[id] != REGISTERED)
{
show_msg(id,"Nao Pode Fazer Isto...")
return PLUGIN_HANDLED
}
show_msg(id,"Coloca Sua Senha Para LOGAR na conta...");client_cmd(id,"messagemode INGRESAR_PASSWORD")
}
case 1: {
if(g_Status[id] != UNREGISTERED)
{
show_msg(id,"Nao Pode Fazer Isto...")
return PLUGIN_HANDLED
}
show_msg(id,"Coloca Uma Senha Para CRIAR uma conta...");client_cmd(id,"messagemode INGRESAR_PASSWORD")
}
case 2: {
if(g_Status[id] != LOGGED || g_AlredyChanged[id][PASSWORD])
{
show_msg(id,"Nao esta logado ou mudaram sua senha...")
return PLUGIN_HANDLED
}
show_msg(id,"Coloca Seu Novo PASSWORD...");client_cmd(id,"messagemode INGRESAR_PASSWORD")
}
case 3: {
if(g_Status[id] != LOGGED || g_AlredyChanged[id][NAME])
{
show_msg(id,"Nao esta LOGADO ou mudaram seu nick...")
return PLUGIN_HANDLED
}
show_msg(id,"Coloca seu novo NICK...");client_cmd(id,"messagemode INGRESAR_NICK")
}
case 4: {
set_hudmessage(0, 255, 0, -1.0, -1.0, 2, 4.0, 7.0)
ShowSyncHudMsg(id,gMsg,"Sistema de contas ^nThe-Killers")
}
}
return PLUGIN_HANDLED
}
public show_menu_confirm(id)
{
static szTitle[128];formatex(szTitle,127,"\w%sO PASSWORD sera \r%s^n^n\yConfirmar?",g_Status[id] == LOGGED ? "Esta Mudando Seu PASSWORD^n":"Esta Colocando Seu PASSWORD^n",g_TempPassword[id])
new Menu = menu_create(szTitle,"handler_menu_confirm")
menu_additem(Menu,"\rSim\w, Confirmar","1",0)
menu_additem(Menu,"\rNao\w, Desejo Reescrever","2",0)
menu_setprop(Menu,MPROP_EXIT,MEXIT_NEVER)
menu_display(id,Menu,0)
}
public handler_menu_confirm(id,menu,item)
{
switch(item)
{
case 0: {
switch(g_Status[id])
{
case LOGGED: {
show_msg(id,"Seu PASSWORD foi mudado com sucesso")
copy(g_Password[id],31,g_TempPassword[id]);fvault_save(id)
g_AlredyChanged[id][PASSWORD] = 1
}
case UNREGISTERED: {
show_msg(id,"Sua CONTA foi criada com sucesso")
copy(g_Password[id],31,g_TempPassword[id]);fvault_save(id)
g_Status[id] = LOGGED;change_team(id)
}
}
}
case 1: {
menu_destroy(menu)
client_cmd(id,"messagemode INGRESAR_PASSWORD")
g_Status[id] == LOGGED ? show_msg(id,"Coloca Seu Novo PASSWORD..."):show_msg(id,"Coloca o novo PASSWORD para sua nova conta...")
}
}
return PLUGIN_HANDLED
}
/*==================================================================================================
* LOAD | SAVE *
==================================================================================================*/
public fvault_load(id)
{
static szName[32],szData[64];get_user_name(id,szName,31)
if(!fvault_get_data(g_Vault,szName,szData,63))
g_Status[id] = UNREGISTERED
else {
strbreak(szData,g_Password[id],31,g_Date[id],31)
g_Status[id] = REGISTERED
}
}
public fvault_save(id)
{
static szName[32],szData[64];get_user_name(id,szName,31)
get_time("%c",g_Date[id],31);formatex(szData,63,"%s %s",g_Password[id],g_Date[id])
fvault_set_data(g_Vault,szName,szData)
}
/*==================================================================================================
* STOCKS *
==================================================================================================*/
stock change_name(const id, const string[])
{
static szName[32],szData[64];get_user_name(id,szName,31)
if(equal(szName,string))
return 0
if(fvault_get_data(g_Vault,string,szData,63))
return 0
g_CanChange = 1;set_user_info(id,"name",string)
g_CanChange = 0
fvault_remove_key(g_Vault,szName)
set_task(1.0,"fvault_save",id)
g_AlredyChanged[id][NAME] = 1
return 1
}
stock change_team(const id)
{
engclient_cmd(id,"jointeam","5")
engclient_cmd(id,"joinclass","5")
}
stock show_msg(const id, const string[])
{
set_hudmessage(0, 255, 0, 0.15, 0.10, 1, 2.0, 10.0)
ShowSyncHudMsg(id,gMsg,"%s",string)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang11274{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/