What could be wrong?
#1

I am trying to make a tempban script, but the check doesn't work, what is the problem?

pawn Код:
stock CheckTempBan(playerid)
{
    new ip[15];
    new str[128];
    new load[3][32];
    new ban_second, ban_minute, ban_hour, ban_ip[20];
    GetPlayerIp(playerid, ip, sizeof ip);
    new hour, minute, second;
    gettime(hour, minute);
    new File:file = fopen("/userfiles/tempban.ini",io_read);
    if (file)
    {
        while (fread(file, str, sizeof str))
        {
            split(str, load, '|');

            ban_hour = strval(load[0]);
            ban_minute = strval(load[1]);
            strmid(ban_ip, load[2], 0, strlen(load[2])-1, 15);
            if (!(hour >= ban_hour && minute >= ban_minute) && !strcmp(ban_ip, ip, true))
            {
                format(str, sizeof str, "You are temporarily banned from this server until: %d:%d", ban_hour, ban_minute);
                SendClientMessage(playerid, COLOR_CYAN, str);
                return Kick(playerid);
            }
        }
    }
    return true;
}
Reply
#2

Sorry for bumping but I don't know the problem
Reply
#3

Explain what you are trying to do here:
pawn Код:
if (!(hour >= ban_hour && minute >= ban_minute) && !strcmp(ban_ip, ip, true))
If I was going to read it, it'd be: If ("hour" is more than or equal to "ban_hour" and "minute" is more than or equal to "ban_minute") and all that is false, and "ban_ip" compared with "ip" is equal to false (aka, they are the same), continue.
Reply
#4

Problem solved, Hiddos helped me :>
Reply
#5

Ah, ok :] Well done
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)