gettime bug?
#1

Hey there, my ban system is with gettime()

But when I log in game( I am banned for testing), it's says I can just log in.

Can someone help me with this problem?

The script when connecting:

pawn Код:
if (PlayerFile_Load(playerid) == 1)
    {
        // Check if the player is still banned
        if (APlayerData[playerid][BanTime] < gettime()) // Player ban-time is passed
        {
            ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, TXT_DialogLoginTitle, TXT_DialogLoginMsg, TXT_DialogLoginButton1, TXT_DialogButtonCancel);
        }
        else // Player is still banned
        {
            ShowRemainingBanTime(playerid); // Show the remaining ban-time to the player is days, hours, minutes, seconds
        }
    }
    else
        ShowPlayerDialog(playerid, DialogRegister, DIALOG_STYLE_INPUT, TXT_DialogRegisterTitle, TXT_DialogRegisterMsg, TXT_DialogRegisterButton1, TXT_DialogButtonCancel);
ShowRemainingBanTime:
pawn Код:
// This function shows the player how long his ban still is when he tries to login (in days, hours, minutes, seconds)
ShowRemainingBanTime(playerid)
{
    // Setup local variables
    new TotalBanTime, Days, Hours, Minutes, Seconds, Msg[128];

    // Get the total ban-time
    TotalBanTime = APlayerData[playerid][BanTime] - gettime();

    // Calculate days
    if (TotalBanTime >= 86400)
    {
        Days = TotalBanTime / 86400;
        TotalBanTime = TotalBanTime - (Days * 86400);
    }
    // Calculate hours
    if (TotalBanTime >= 3600)
    {
        Hours = TotalBanTime / 3600;
        TotalBanTime = TotalBanTime - (Hours * 3600);
    }
    // Calculate minutes
    if (TotalBanTime >= 60)
    {
        Minutes = TotalBanTime / 60;
        TotalBanTime = TotalBanTime - (Minutes * 60);
    }
    // Calculate seconds
    Seconds = TotalBanTime;

    // Display the remaining ban-time for this player
    SendClientMessage(playerid, 0xFFFFFFFF, TXT_StillBanned);
    format(Msg, 128, TXT_BannedDuration, Days, Hours, Minutes, Seconds);
    SendClientMessage(playerid, 0xFFFFFFFF, Msg);
    Kick(playerid); // Kick the player
    print("ShowRemaining Bantime werkt.+ kick");
}

The funny thing is, is that when I replace, gettime with == 0), It works, but the time isn't correct, "-1736"
Reply


Messages In This Thread
gettime bug? - by SomebodyAndMe - 27.05.2012, 17:27
AW: gettime bug? - by Nero_3D - 27.05.2012, 17:51
Re: gettime bug? - by SomebodyAndMe - 27.05.2012, 18:00
Re: gettime bug? - by SomebodyAndMe - 27.05.2012, 20:16
Re: gettime bug? - by SomebodyAndMe - 27.05.2012, 22:04
AW: gettime bug? - by Nero_3D - 27.05.2012, 22:30
Re: gettime bug? - by SomebodyAndMe - 27.05.2012, 22:48
Re: gettime bug? - by iggy1 - 27.05.2012, 23:09
AW: Re: gettime bug? - by Nero_3D - 27.05.2012, 23:24
Re: gettime bug? - by AdamCooper - 27.05.2012, 23:43

Forum Jump:


Users browsing this thread: 1 Guest(s)