#1 |
Le acabo de adaptar estos 3 plugins.. Esto servira para darte la informacion y vencimiento de tu admin, además podras poner la pw dentro del SV y no poner afuera del sv setinfo _pw..
Credits:
Mario AR. ( ADMIN LOGIN)
alan_el_more (ADMIN VENCIMIENTO)
Si hay bugs fabor de reportarlos.
INCS:
PLUGIN
Credits:
Mario AR. ( ADMIN LOGIN)
alan_el_more (ADMIN VENCIMIENTO)
Si hay bugs fabor de reportarlos.
INCS:
Código PHP:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <unixtime>
#include <ColorChat>
Código PHP:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <unixtime>
#include <ColorChat>
#include <cstrike>
#define MODNAME "^x04 [^x03 Amxmodx^x04 ]^x01"
#define PLUGIN "Admin Login"
#define VERSION "0.2"
new Trie:gVencimiento
new g_adminIndex[33], g_time[33];
#define autenticado(%0) (g_adminIndex[0] & (1<<%0-1))
#define cvar_time g_time[0]
const OFFSET_VGUI_JOINTEAM = 2;
const NIVEL_DE_ADMIN = ADMIN_KICK;
enum (+=100)
{
TASK_KICK = 1234,
TASK_CHECK
};
public plugin_init()
{
register_plugin(PLUGIN, VERSION, "Mario AR.");
register_message(get_user_msgid("ShowMenu"), "message_showmenu");
register_message(get_user_msgid("VGUIMenu"), "message_vguimenu");
register_clcmd("chooseteam", "clcmd_jointeam");
register_clcmd("jointeam", "clcmd_jointeam");
register_clcmd("ADMIN_PASS", "clcmd_pass");
cvar_time = register_cvar("admin_login_time", "15");
register_clcmd("say /miadmin", "CheckAdmin")
/* Vencimiento */
gVencimiento = TrieCreate()
/* CheckVencimiento */
CheckAdminsx()
}
public client_putinserver(id)
{
if (is_user_bot(id))
return;
check_admin(id)
set_task(5.0, "CheckAdmin", id)
}
public client_disconnect(id)
{
remove_task(id + TASK_CHECK);
remove_task(id + TASK_KICK);
remove_task(id)
}
public clcmd_jointeam(id)
{
if (!is_user_connected(id))
return PLUGIN_CONTINUE;
if (!autenticado(id) && (get_user_flags(id) & NIVEL_DE_ADMIN))
{
AdminLogin(id);
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public message_showmenu(junk1, junk2, id)
{
if (!is_user_connected(id))
return PLUGIN_CONTINUE;
if (!autenticado(id) && (get_user_flags(id) & NIVEL_DE_ADMIN))
{
static szCode[32];
get_msg_arg_string(4, szCode, charsmax(szCode));
if (contain(szCode, "#Team") != -1)
AdminLogin(id);
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public message_vguimenu(junk1, junk2, id)
{
if (!is_user_connected(id))
return PLUGIN_CONTINUE;
if (!autenticado(id) && (get_user_flags(id) & NIVEL_DE_ADMIN))
{
if (get_msg_arg_int(1) == OFFSET_VGUI_JOINTEAM)
AdminLogin(id);
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
AdminLogin(id)
{
if (!is_user_connected(id))
return;
if (!task_exists(id + TASK_KICK))
{
g_time[id] = get_pcvar_num(cvar_time);
set_task(1.0, "kick_admin", id + TASK_KICK, .flags = "a", .repeat = g_time[id]);
}
client_print(id, print_chat, "Ingresa tu PASS de Admin o seras expulsado en %d segundos.", g_time[id]);
client_cmd(id, "messagemode ^"ADMIN_PASS^"");
}
public clcmd_pass(id)
{
if (!is_user_connected(id) || autenticado(id))
return;
static szPass[32], szCorrectPass[32];
read_args(szPass, 31);
remove_quotes(szPass);
admins_lookup(g_adminIndex[id], AdminProp_Password, szCorrectPass, 31);
if (equal(szPass, szCorrectPass))
{
remove_task(id + TASK_KICK);
g_adminIndex[0] |= (1<<id-1);
client_print(id, print_center, "Te logueaste correctamente.");
client_cmd(id, "jointeam");
set_task(9.0, "CheckAdmin", id)
}
else
{
client_print(id, print_center, "Password incorrecto.");
client_cmd(id, "messagemode ^"ADMIN_PASS^"");
}
}
public client_infochanged(id)
{
if (!is_user_connected(id))
return;
static szName[2][32];
get_user_name(id, szName[0], 31);
get_user_info(id, "name", szName[1], 31);
if (!equal(szName[0], szName[1]))
set_task(2.0, "task_check_admin", id + TASK_CHECK);
}
public kick_admin(id)
{
id -= TASK_KICK;
if (!--g_time[id])
server_cmd("kick #%d ^"No has introducido tu clave.^"", get_user_userid(id));
else
client_print(id, print_center, "Tienes %d segundos para introducir tu clave.", g_time[id]);
}
public task_check_admin(id)
{
id -= TASK_CHECK;
if (check_admin(id))
{
if (is_user_alive(id))
user_kill(id);
cs_set_user_team(id, CS_TEAM_UNASSIGNED);
AdminLogin(id);
}
}
check_admin(id)
{
if (get_user_flags(id) & NIVEL_DE_ADMIN)
{
static AuthData[32], szName[32], Flags, Count, index;
get_user_name(id, szName, 31);
index = -1;
Count = admins_num();
for (new i = 0; i < Count; ++i)
{
Flags = admins_lookup(i, AdminProp_Flags);
if ((Flags & FLAG_AUTHID) || (Flags & FLAG_IP))
continue;
admins_lookup(i, AdminProp_Auth, AuthData, charsmax(AuthData));
if (Flags & FLAG_CASE_SENSITIVE)
{
if (Flags & FLAG_TAG)
{
if (contain(szName, AuthData) != -1)
{
index = i;
break;
}
}
else if (equal(szName, AuthData))
{
index = i;
break;
}
}
else
{
if (Flags & FLAG_TAG)
{
if (containi(szName, AuthData) != -1)
{
index = i;
break;
}
}
else if (equali(szName, AuthData))
{
index = i;
break;
}
}
}
if (index != -1) // Es un admin con PASS
{
g_adminIndex[id] = index;
g_adminIndex[0] &= ~(1<<id-1);
return 1;
}
}
g_adminIndex[0] |= (1<<id-1);
return 0;
}
public CheckAdmin(id) {
if(!is_user_admin(id))
return PLUGIN_HANDLED
new menu[195], len, szAuth[32], szExp[12]
len = 0
new name[33]; get_user_name(id, name, charsmax(name))
get_user_authid(id, szAuth, charsmax(szAuth))
if(!TrieGetString(gVencimiento, szAuth, szExp, charsmax(szExp))) {
get_user_name(id, szAuth, charsmax(szAuth))
if(!TrieGetString(gVencimiento, szAuth, szExp, charsmax(szExp))) {
get_user_ip(id, szAuth, charsmax(szAuth), 1)
TrieGetString(gVencimiento, szAuth, szExp, charsmax(szExp))
}
}
if(get_user_flags(id) & ADMIN_RCON)
ColorChat(id, GREEN, "%s Bienvenido:^x04 %s^x01 ||^x01 Tipo:^x04 OWNER-STAFF^x01 ||^x01 Vence:^x04 %s", MODNAME, name)
else if(get_user_flags(id) & ADMIN_IMMUNITY)
ColorChat(id, GREEN, "%s Bienvenido:^x04 %s^x01 ||^x01 Tipo:^x04 PREMIUM^x01 ||^x01 Vence:^x04 %s", MODNAME, name, szExp ? szExp : "NUNCA")
else if(get_user_flags(id) & ADMIN_LEVEL_A)
ColorChat(id, GREEN, "%s Bienvenido:^x04 %s^x01 ||^x01 Tipo:^x04 SILVER^x01 ||^x01 Vence:^x04 %s", MODNAME, name, szExp ? szExp : "NUNCA")
return PLUGIN_HANDLED
}
CheckAdminsx() {
new szFile[64], szData[160], szAuth[44], szPw[32], szAccess[32], szFlags[32], szDate[12]
new iLine, bAdmRemoved
get_configsdir(szFile, charsmax(szFile))
add(szFile, charsmax(szFile), "/users.ini")
new file = fopen(szFile, "rt")
while(!feof(file)) {
fgets(file, szData, charsmax(szData))
trim(szData)
iLine++
if(!szData[0] || szData[0] == ';')
continue
parse(szData, szAuth, charsmax(szAuth), szPw, charsmax(szPw), szAccess, charsmax(szAccess), szFlags, charsmax(szFlags), szDate, charsmax(szDate))
if(!szDate[0])
continue
replace_all(szDate, charsmax(szDate), "/", " ")
new szDay[3], szMonth[3], szYear[5]
parse(szDate, szDay, charsmax(szDay), szMonth, charsmax(szMonth), szYear, charsmax(szYear))
if(get_systime() >= TimeToUnix(str_to_num(szYear), str_to_num(szMonth), str_to_num(szDay), 0, 0, 0, UT_TIMEZONE_SERVER)) {
formatex(szData, charsmax(szData), ";[SVL'MEXICO] EL ADMINISTRADOR - ^"%s^" VENCIO EN LA FECHA %s/%s/%s", szAuth, szDay, szMonth, szYear)
write_file(szFile, szData, iLine - 1)
bAdmRemoved = true
} else {
replace_all(szDate, charsmax(szDate), " ", "/")
TrieSetString(gVencimiento, szAuth, szDate)
}
}
if(bAdmRemoved) {
server_cmd("amx_reloadadmins")
server_exec()
}
fclose(file)
}