03.08.2016, 12:17
Here:
PHP код:
// Ban Checking system
new
string[6][24],
string2[156],
expire,
DIALOG[676]
;
if(SQL::RowExistsEx(""BANS_TABLE"", "ban_username", GetName(playerid)))
{
new handle = SQL::OpenEx(SQL::READ, ""BANS_TABLE"", "ban_username", GetName(playerid));
SQL::ReadString(handle, "ban_username", string[1], 24);
SQL::ReadString(handle, "ban_ip", string[2], 24);
SQL::ReadString(handle, "ban_by", string[3], 24);
SQL::ReadString(handle, "ban_on", string[4], 24);
SQL::ReadString(handle, "ban_reason", string[5], 24);
SQL::ReadInt(handle, "ban_expire", expire);
SQL::Close(handle);
if(expire > gettime() || expire == 0)
{
strcat(DIALOG, ""white"Your account is banned from this server,\n\n");
format(string2, sizeof(string2), ""white"Username: "red"%s\n", string[1]);
strcat(DIALOG, string2);
format(string2, sizeof(string2), ""white"IP: "red"%s\n", string[2]);
strcat(DIALOG, string2);
format(string2, sizeof(string2), ""white"Banned by: "red"%s\n", string[3]);
strcat(DIALOG, string2);
format(string2, sizeof(string2), ""white"Reason: "red"%s\n", string[5]);
strcat(DIALOG, string2);
format(string2, sizeof(string2), ""white"Ban date: "red"%s\n", string[4]);
strcat(DIALOG, string2);
new expire2[68];
if(expire == 0) expire2 = "PERMANENT";
else expire2 = ConvertTime(expire);
format(string2, sizeof(string2), ""white"Timeleft: "red"%s\n\n", expire2);
strcat(DIALOG, string2);
strcat(DIALOG, ""white"If you think that you got banned wrongfully, please make an appeal on our forums. Visit svt-reloaded.com\n");
strcat(DIALOG, "Make sure you saved this box by pressing F8.");
Dialog_Show(playerid, dialogUnused, DIALOG_STYLE_MSGBOX, "Notice", DIALOG, "Close", "");
DelayKick(playerid);
return true;
}
else
{
SQL::DeleteRowEx(""BANS_TABLE"", "ban_username", GetName(playerid));
Server(playerid, "Your account's ban has expired.");
}
}
else if(SQL::RowExistsEx(""BANS_TABLE"", "ban_ip", GetIP(playerid)))
{
new handle = SQL::OpenEx(SQL::READ, ""BANS_TABLE"", "ban_ip", GetIP(playerid));
SQL::ReadString(handle, "ban_username", string[1], 24);
SQL::ReadString(handle, "ban_ip", string[2], 24);
SQL::ReadString(handle, "ban_by", string[3], 24);
SQL::ReadString(handle, "ban_on", string[4], 24);
SQL::ReadString(handle, "ban_reason", string[5], 24);
SQL::ReadInt(handle, "ban_expire", expire);
SQL::Close(handle);
if(expire > gettime() || expire == 0)
{
strcat(DIALOG, ""white"Your IP is banned from this server,\n\n");
format(string2, sizeof(string2), ""white"Username: "red"%s\n", string[1]);
strcat(DIALOG, string2);
format(string2, sizeof(string2), ""white"IP: "red"%s\n", string[2]);
strcat(DIALOG, string2);
format(string2, sizeof(string2), ""white"Banned by: "red"%s\n", string[3]);
strcat(DIALOG, string2);
format(string2, sizeof(string2), ""white"Reason: "red"%s\n", string[5]);
strcat(DIALOG, string2);
format(string2, sizeof(string2), ""white"Ban date: "red"%s\n", string[4]);
strcat(DIALOG, string2);
new expire2[68];
if(expire == 0) expire2 = "PERMANENT";
else expire2 = ConvertTime(expire);
format(string2, sizeof(string2), ""white"Timeleft: "red"%s\n\n", expire2);
strcat(DIALOG, string2);
strcat(DIALOG, ""white"If you think that you got banned wrongfully, please make an appeal on our forums. Visit svt-reloaded.\n");
strcat(DIALOG, "Make sure you saved this box by pressing F8.");
Dialog_Show(playerid, dialogUnused, DIALOG_STYLE_MSGBOX, "Notice", DIALOG, "Close", "");
DelayKick(playerid);
return true;
}
else
{
SQL::DeleteRowEx(""BANS_TABLE"", "ban_username", GetName(playerid));
Server(playerid, "Your IP's ban has expired.");
}
}