stock Check_Ban(playerid)
{
new string[2500];
if(fexist(UserPath(playerid)))
{
pInfo[playerid][Banned] = dini_Int(UserPath(playerid), "Banned");
format(pInfo[playerid][BanBy], 256, "%s", dini_Get(UserPath(playerid), "BanBy"));
format(pInfo[playerid][BanReason], 256, "%s", dini_Get(UserPath(playerid), "BanReason"));
format(pInfo[playerid][WhenBan], 256, "%s", dini_Get(UserPath(playerid), "WhenBan"));
if(pInfo[playerid][Banned] == 1)
{
ClearBox(playerid);
format(string, sizeof(string), ""grey"Sorry, But you are banned from San Andreas Chaos.\nBan Details:\n\n"red"Banned by "white"%s\n"red"Ban Reason "white"(%s)\n"red"Date "white"(%s)\n\n"grey"If you think it is a false ban, Please refer to "#SERVER_URL" and file a ban appeal.\nMake sure to take a screenshot of this (Press F8).", pInfo[playerid][BanBy], pInfo[playerid][BanReason], pInfo[playerid][WhenBan]);
ShowPlayerDialog(playerid, DIALOG_BANS, DIALOG_STYLE_MSGBOX, ""red"Banned from SAC", string, "Close", "");
SendClientMessage(playerid, COLOR_RED, "You are banned from the server.");
format(string, sizeof(string), "Banned by: "white"%s, "red"Reason: "white"%s, "red"When: "white"%s", pInfo[playerid][BanBy], pInfo[playerid][BanReason], pInfo[playerid][WhenBan]);
SendClientMessage(playerid, COLOR_RED, string);
SendClientMessage(playerid, -1, "You have been kicked.");
KickX(playerid);
return 0;
}
}
return 1;
}
stock AddBan(playerid = -1, targetid, reason[])
{
new band, bany, banm;
getdate(bany, banm, band);
new string[190];
if(playerid != -1)
{
if(fexist(UserPath(targetid)))
{
if(logged[targetid] == 1)
{
format(pInfo[targetid][BanBy], 256, "%s", GetName(playerid));
format(pInfo[targetid][BanReason], 256, "%s", reason);
format(pInfo[targetid][WhenBan], 256, "%d-%d-%d", banm, band, bany);
ClearBox(targetid, 100);
format(string, sizeof(string), "** "red"%s has been banned from the server by %s (%s)", GetName(targetid), GetName(playerid), reason);
SendClientMessageToAll(-1, string);
format(string, sizeof(string), "%s %s banned %s for %s (%s) (IP: %s)", GetA_Rank(playerid), GetName(playerid), GetName(targetid), reason, pInfo[targetid][WhenBan], GetIP(targetid));
SaveLog("banlog", string);
format(string, sizeof(string), "** "red"You have been banned from the server by %s for %s (%s)", GetName(playerid), reason, pInfo[targetid][WhenBan]);
SendClientMessage(targetid, -1, string);
SendClientMessage(targetid, -1, "If you think this is a wrongful ban, Visit us at "#SERVER_URL" and file a ban appeal.");
SendClientMessage(targetid, -1, "Make sure to screenshot this ban for evidence. (Press F8 to take a screenshot)");
pInfo[targetid][Banned] = 1;
KickX(targetid);
}
}
}
else if(playerid == -1)
{
if(fexist(UserPath(targetid)))
{
if(logged[targetid] == 1)
{
format(pInfo[targetid][BanBy], 256, "Anticheat");
format(pInfo[targetid][BanReason], 256, "%s", reason);
format(pInfo[targetid][WhenBan], 256, "%d-%d-%d", banm, band, bany);
ClearBox(playerid, 100);
format(string, sizeof(string), "** "red"%s has been banned from the server by the Anticheat (%s)", GetName(targetid), reason);
SendClientMessageToAll(-1, string);
format(string, sizeof(string), "Anticheat banned %s for %s (%s) (IP: %s)", GetName(targetid), reason, pInfo[targetid][WhenBan], GetIP(targetid));
SaveLog("banlog", string);
format(string, sizeof(string), "** "red"You have been banned from the server by the Anticheat for %s (%s)", reason, pInfo[targetid][WhenBan]);
SendClientMessage(targetid, -1, string);
SendClientMessage(targetid, -1, "If you think this is a wrongful ban, Visit us at "#SERVER_URL" and file a ban appeal.");
SendClientMessage(targetid, -1, "Make sure to screenshot this ban for evidence. (Press F8 to take a screenshot)");
KickX(targetid);
}
}
}
return 1;
}
IP1 IP2 IP3
Make another file, 'banips' and save all banned ips there
then whenever anyone connects, try to match his ip with the one in 'banips', if it matches then ban him simple but maybe hard to script.. |
I don't know how to remove something from a list, I'll try to search for an answer, I'll reply if I found one.
Here's another idea: How about making a new folder called something like "bannedips" and then listing every IP as a new txt file. Then if you want to unban, fremove. He wants to know how to remove an IP from a whole list of IPs. |
new
INI:ini = INI_Open("myini.ini");
INI_RemoveEntry(ini, "NAME");
INI_Close(ini);
then he should use Y_ini as it has function:
pawn Код:
|
IP1 IP2 IP3 IP4 IP5