Ban time seems to be returning incorrectly.
#1

I'm hosting my own server on my own PC, so the time is currently 04:13.

I /rtban the player for (2 HOURS), log back in and the time says I'll be unbanned at 05:14

pawn Код:
CMD:rtban(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");

    new reason[128], bantime,id,calc,string[256],hours1,player[24],days,query[512];
    if(AdminLevel[playerid] < 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
    if(sscanf(params, "s[24]D(0)D(0)s[128]", player,hours1,days, reason)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /rtban [player name] [hours] [days] [reason] - Use an underscore otherwise it will not work.");
    if(days < 0 || days > 7) return SendClientMessage(playerid, COLOUR_GREY, "Days must be between 1 and 10.");
    if(hours1 < 0 || hours1 > 23) return SendClientMessage(playerid, COLOUR_GREY, "Hours must be between 1 and 23.");
    if(hours1 >= 1 && days >= 1) return SendClientMessage(playerid, COLOUR_GREY, "You can only select either Hours OR Days - Not both.");


    format(query, sizeof(query), "SELECT * FROM `accounts` WHERE `PlayerName` = '%s'", player);
    mysql_query(query); // No query line
    mysql_store_result(); // "Error nothing to store"
    printf("ID %d", id);
    new rows = mysql_num_rows();
    if(rows > 0)
    {
        if(days > 0)
        {
            calc =  86400 * days;
            bantime = calc + gettime();
            printf("BAN TIME %d", bantime);
            format(query, sizeof(query), "UPDATE `accounts` SET `BanTime` = %d WHERE `PlayerName` = '%s' LIMIT 1", bantime, player);
            mysql_query(query);
            format(string, sizeof(string), "Admin %s Banned %s until %s - %d Day(s) [Reason: %s]", GetNameEx(playerid), player, date(bantime,4), days, reason);
            SendClientMessageToAll(COLOUR_REALRED, string);
        }
        if(hours1 > 0)
        {
            calc = 3600 * hours1;
            bantime = calc + gettime();
            format(query, sizeof(query), "UPDATE `accounts` SET `BanTime` = %d WHERE `PlayerName` = '%s' LIMIT 1", bantime, player);
            mysql_query(query);
            format(string, sizeof(string), "Admin %s Banned %s for %d Hour(s) [Reason: %s]", GetNameEx(playerid), player, hours1, reason);
            SendClientMessageToAll(COLOUR_REALRED, string);
        }
        format(string, sizeof(string), "You have banned account (REMOTE) %s.", player);
        SendClientMessage(playerid, COLOUR_REALRED, string);
    }
    if(rows == 0)
        {
            SendClientMessage(playerid, COLOUR_GREY, "There are no accounts found with that name.");
        }
    mysql_free_result();
    return 1;
}
Does gettime return incorrectly?

Thanks.
Reply


Messages In This Thread
Ban time seems to be returning incorrectly. - by Dokins - 19.05.2015, 03:07
Re: Ban time seems to be returning incorrectly. - by Dokins - 19.05.2015, 03:51
Re: Ban time seems to be returning incorrectly. - by Threshold - 19.05.2015, 06:48
Re: Ban time seems to be returning incorrectly. - by Dokins - 19.05.2015, 09:56
Re: Ban time seems to be returning incorrectly. - by Sergei - 19.05.2015, 10:15

Forum Jump:


Users browsing this thread: 1 Guest(s)