mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-07-13 15:14:34 +00:00
Clean timed out bans at startup
This commit is contained in:
parent
41115c65ba
commit
6ff80403bc
1 changed files with 30 additions and 1 deletions
|
|
@ -55,7 +55,7 @@ function BanList::add(%guid, %ipAddress, %time){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(%eIndex == -1){
|
else if(%eIndex == -1){
|
||||||
%eIndex = %i;
|
%eIndex = %i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!%found){
|
if(!%found){
|
||||||
|
|
@ -122,6 +122,14 @@ function banList_checkGUID(%guid){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function CreateServer(%mission, %missionType)
|
||||||
|
{
|
||||||
|
parent::CreateServer(%mission, %missionType);
|
||||||
|
|
||||||
|
//Clean timed out bans at startup
|
||||||
|
schedule(10000,0,"banListClean",0);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!isActivePackage(dtBan)){
|
if (!isActivePackage(dtBan)){
|
||||||
|
|
@ -273,4 +281,25 @@ function unbanold(%guid,%ip){
|
||||||
error("IP" SPC %ip SPC "UNBANNED");
|
error("IP" SPC %ip SPC "UNBANNED");
|
||||||
}
|
}
|
||||||
saveBanList();
|
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…
Add table
Add a link
Reference in a new issue