07.02.2013, 17:56
Title says all.
getdate(year, month, day); format(data, sizeof(data), "%d-%d-%d", day, month, year); format(query, sizeof(query), "INSERT INTO `kicks` (player, victim, reason, data) VALUES ('%s', '%s', '%s', '%s')", GetName(playerid), GetName(id), reason, data);
new szIP[16], szUsername[26], szAdminName[26], szReason[60], temp[20];
cache_get_row(0, 0, temp);
new iBanID = strval(temp);
cache_get_row(0, 1, szIP);
cache_get_row(0, 2, szUsername);
cache_get_row(0, 3, szAdminName);
cache_get_row(0, 4, szReason);
cache_get_row(0, 5, temp);
new iBannedTimestamp = strval(temp);
cache_get_row(0, 6, temp);
new iUnbannedTimestamp = strval(temp);
if(gettime() >= iUnbannedTimestamp)
{
new szQuery[128];
format(szQuery, sizeof(szQuery), "DELETE FROM `Bans` WHERE `banID` = %d", iBanID);
mysql_function_query(connectionHandle, szQuery, false, "databaseCallback", "");
format(szQuery, sizeof(szQuery), "SELECT * FROM `Accounts` WHERE `Username` = '%s'", getEscName(playerid));
mysql_function_query(connectionHandle, szQuery, true, "accountCheck", "d", playerid);
}
else
{
clearPlayerChat(playerid);
new szString[128];
SendClientMessage(playerid, COLOR_RED, "You are banned from this server.");
SendClientMessage(playerid, -1, " ");
format(szString, sizeof(szString), "You were banned by {E70000}%s {FFFFFF}on %s.", szAdminName, date(iBannedTimestamp, 2));
SendClientMessage(playerid, COLOR_WHITE, szString);
format(szString, sizeof(szString), "Reason: %s", szReason);
SendClientMessage(playerid, COLOR_WHITE, szString);
SendClientMessage(playerid, -1, " ");
format(szString, sizeof(szString), "You will be automatically unbanned on %s.", date(iUnbannedTimestamp, 2));
SendClientMessage(playerid, COLOR_WHITE, szString);
defer serverKickDelay(playerid);
}