27.05.2012, 17:27
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:
ShowRemainingBanTime:
The funny thing is, is that when I replace, gettime with == 0), It works, but the time isn't correct, "-1736"
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);
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"