Raised This Month: $ Target: $400
 0% 

it does not work?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EclipseCP
BANNED
Join Date: Dec 2010
Old 08-02-2011 , 05:37   it does not work?
Reply With Quote #1

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(idnamecharsmax(name));
    
    for (new 
0lineai++)
    {
        if (
containi(nameszAdmin[i]) != -1)
        {
            if (
szVencimiento[i][0])
                
client_print_color(idBlue"Tu administrador vence el dia: ^4%s"szVencimiento[i]);
            
            break;    
        }    
    }
    
    return 
PLUGIN_HANDLED;
}

check_date()
{
    new 
szFile[255], szLine[255];

    
get_localinfo("amxx_configsdir"szFilecharsmax(szFile));
    
formatex(szFilecharsmax(szFile), "%s/users.ini"szFile);
    
    new 
file fopen(szFile"rt");
    
linea 0;
    
    while (!
feof(file))
    {
        
szLine[0] = '^0';
        
fgets(fileszLinecharsmax(szLine));
        
trim(szLine);
        
        if (!
szLine[0] || szLine[0] == ';')
            continue;
        
        
parse(szLineszAdmin[linea], sizeof szAdminszLinecharsmax(szLine), szLinecharsmax(szLine), szLinecharsmax(szLine), szVencimiento[linea], charsmax(szVencimiento));
        
        
linea++;
    }

    
fclose(file);
    
    new 
fecha[64]
    
get_time("%d/%m/%Y %H:%M"fechacharsmax(fecha))
    
    for (new 
0lineai++)
    {
        if (
equal(fechaszVencimiento[i]))
        {
            new 
FilePossszName[32];
            
            
file fopen(szFile"rt");
            
            while (!
feof(file))
            {
                
szLine[0] = '^0';
                
fgets(fileszLinecharsmax(szLine));
                
                
FilePoss++;
                
                if (
szLine[0] == ';')
                    continue;
                
                
parse(szLineszNamecharsmax(szName));
                
                if (
equal(szNameszAdmin[i]))
                {
                    
/* Bugsy */
                    
format(szLinecharsmax(szLine), ";%s"szAdmin[i]);
                    
write_file(szFileszLineFilePoss 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]);
        }
    }

EclipseCP is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-02-2011 , 08:28   Re: it does not work?
Reply With Quote #2

The probability of equal(fecha, szVencimiento[i]) being true is nearly 0 (therefore it's a poor method to check if their admin has expired).
__________________
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:31.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode