hi all.
I have a problem with this:
In this plugin, check that, when the time XX / XX / XX 00:00 of the day is equal to a variable
But to put hours and minutes, Buge, is not he takes the admin (as this will use it to automatically remove the admins)
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <chatcolor>
new szAdmin[63][40], szVencimiento[63][11], linea
public plugin_init()
{
register_plugin("Admin Vencimiento", "1.0", "ILUSION")
register_clcmd("say /vencimiento", "cmdVencimiento")
check_date()
}
public cmdVencimiento(id)
{
if (!(get_user_flags(id) & ADMIN_RESERVATION))
return PLUGIN_CONTINUE;
new name[32];
get_user_name(id, name, charsmax(name));
for (new i = 0; i < linea; i++)
{
if (containi(name, szAdmin[i]) != -1)
{
if (szVencimiento[i][0])
client_print_color(id, Blue, "Tu administrador vence el dia: ^4%s", szVencimiento[i]);
break;
}
}
return PLUGIN_HANDLED;
}
check_date()
{
new szFile[255], szLine[255];
get_localinfo("amxx_configsdir", szFile, charsmax(szFile));
formatex(szFile, charsmax(szFile), "%s/users.ini", szFile);
new file = fopen(szFile, "rt");
linea = 0;
while (!feof(file))
{
szLine[0] = '^0';
fgets(file, szLine, charsmax(szLine));
trim(szLine);
if (!szLine[0] || szLine[0] == ';')
continue;
parse(szLine, szAdmin[linea], sizeof szAdmin, szLine, charsmax(szLine), szLine, charsmax(szLine), szLine, charsmax(szLine), szVencimiento[linea], charsmax(szVencimiento));
linea++;
}
fclose(file);
new fecha[64]
get_time("%d/%m/%Y %H:%M", fecha, charsmax(fecha))
for (new i = 0; i < linea; i++)
{
if (equal(fecha, szVencimiento[i]))
{
new FilePoss, szName[32];
file = fopen(szFile, "rt");
while (!feof(file))
{
szLine[0] = '^0';
fgets(file, szLine, charsmax(szLine));
FilePoss++;
if (szLine[0] == ';')
continue;
parse(szLine, szName, charsmax(szName));
if (equal(szName, szAdmin[i]))
{
/* Bugsy */
format(szLine, charsmax(szLine), ";%s", szAdmin[i]);
write_file(szFile, szLine, FilePoss - 1);
break;
/* Bugsy */
}
}
fclose(file);
server_cmd("amx_reloadadmins");
log_amx("El admin %s fue deshabilitado ya que vencio el dia %s", szAdmin[i], szVencimiento[i]);
}
}
}