mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-01-19 16:14:44 +00:00
Clean timed out bans at startup
This commit is contained in:
parent
41115c65ba
commit
6ff80403bc
|
|
@ -55,7 +55,7 @@ function BanList::add(%guid, %ipAddress, %time){
|
|||
}
|
||||
}
|
||||
else if(%eIndex == -1){
|
||||
%eIndex = %i;
|
||||
%eIndex = %i;
|
||||
}
|
||||
}
|
||||
if(!%found){
|
||||
|
|
@ -122,6 +122,14 @@ function banList_checkGUID(%guid){
|
|||
return 0;
|
||||
}
|
||||
|
||||
function CreateServer(%mission, %missionType)
|
||||
{
|
||||
parent::CreateServer(%mission, %missionType);
|
||||
|
||||
//Clean timed out bans at startup
|
||||
schedule(10000,0,"banListClean",0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
if (!isActivePackage(dtBan)){
|
||||
|
|
@ -273,4 +281,25 @@ function unbanold(%guid,%ip){
|
|||
error("IP" SPC %ip SPC "UNBANNED");
|
||||
}
|
||||
saveBanList();
|
||||
}
|
||||
|
||||
//Clean timed out bans at startup
|
||||
function banListClean(){
|
||||
%found = 0;
|
||||
for (%i = 0; %i < 100; %i++){
|
||||
%fieldList = $dtBanList::NameList[%i];
|
||||
if($dtBanList::NameList[%i] !$= ""){
|
||||
%guid = getField($dtBanList::NameList[%i], 1);
|
||||
%ip = getField($dtBanList::NameList[%i], 2);
|
||||
%time = $dtBanList::GUID[%guid];
|
||||
%delta = getBanCount(getField(%time,0), getField(%time,1),getField(%time,2),getField(%time,3));
|
||||
if (%delta > getField(%time,4)){
|
||||
$dtBanList::NameList[%i] = "";
|
||||
$dtBanList::GUID[%guid] = "";
|
||||
$dtBanList::IP[%ip] = "";
|
||||
error("GUID" SPC %guid SPC "IP" SPC %ip SPC "UNBANNED");
|
||||
}
|
||||
}
|
||||
}
|
||||
saveBanList();
|
||||
}
|
||||
Loading…
Reference in a new issue