Temp Ban, not returning correct time.
#1

Hello, the server, I know is + 1 GMT. Alright? My time is GMT 00:00. But I banned myself from the server for 2 hours, at 22:45 and it says. I'll be un banned at 11:45? Although I clearly wrote 2 hours. Could it be that the clocks just went forward in this country?

command is here:

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

    new reason[128], giveplayerid, string[256],hours1,days;
    if(AdminLevel[playerid] < 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
    if(sscanf(params, "uD(0)D(0)s[128]", giveplayerid,hours1,days, reason)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /tban [player id] [hours] [days] [reason]");
    if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOUR_GREY, "That player is not connected.");
    if(days < 0 || days > 7) return SendClientMessage(playerid, COLOUR_GREY, "Day's must be between 1 and 10.");
    if(hours1 < 0 || hours1 > 23) return SendClientMessage(playerid, COLOUR_GREY, "Hour's 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.");

    PlayerSQLID[giveplayerid] = MySQL_GetValue(PlayerSQLID[giveplayerid], "id", "accounts");
    if(days > 0)
    {

        BanTime[giveplayerid]= Time[giveplayerid] + 86400 * days;
        MySQL_SetInteger(PlayerSQLID[giveplayerid], "BanTime" , BanTime[giveplayerid], "accounts");
        format(string, sizeof(string), "Admin %s Banned %s until %s - %d Day(s) [Reason: %s]", GetNameEx(playerid), GetNameEx(giveplayerid),date(BanTime[giveplayerid],4), days, reason);
        SendClientMessageToAll(COLOUR_REALRED, string);
        format(string,sizeof(string), "You have been {FF0000}BANNED{FFFFFF} from Bone County Roleplay until {FF0000}%s", date(BanTime[giveplayerid],4));
        SendClientMessage(giveplayerid, COLOUR_WHITE, string);
        format(string, sizeof(string),"Reason: {FF0000}%s", reason);
        SendClientMessage(giveplayerid, COLOUR_WHITE, string);
        SendClientMessage(giveplayerid, COLOUR_REALRED, "{FFFFFF}PLEASE DO {FF0000}NOT{FFFFFF} POST A {FF0000}BAN APPEAL {FFFFFF}as this is a Temporary Ban.");
    }
    if(hours1 > 0)
    {
        BanTime[giveplayerid]= Time[giveplayerid] + 3600 * hours1;
        MySQL_SetInteger(PlayerSQLID[giveplayerid], "BanTime" , BanTime[giveplayerid], "accounts");
        format(string, sizeof(string), "Admin %s Banned %s for %d Hour(s) [Reason: %s]", GetNameEx(playerid), GetNameEx(giveplayerid), hours1, reason);
        SendClientMessageToAll(COLOUR_REALRED, string);
        format(string,sizeof(string), "You have been {FF0000}BANNED{FFFFFF} from Bone County Roleplay for {FF0000}%d{FFFFFF} Hours.", hours1);
        SendClientMessage(giveplayerid, COLOUR_WHITE, string);
        format(string, sizeof(string),"Reason: {FF0000}%s", reason);
        SendClientMessage(giveplayerid, COLOUR_WHITE, string);
        SendClientMessage(giveplayerid, COLOUR_REALRED, "{FFFFFF}PLEASE DO {FF0000}NOT{FFFFFF} POST A {FF0000}BAN APPEAL {FFFFFF}as this is a Temporary Ban.");
    }
    MySQL_SetInteger(PlayerSQLID[giveplayerid], "Banned" , 1, "accounts");

    Kick(giveplayerid);
    return 1;
}
Reply
#2

hmm use gettime(); and mktime function

this will use the time of the server and not from yours!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)