mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-07-16 00:24:35 +00:00
dtBanSystem Update (Minutes)
This commit is contained in:
parent
5c21499f4f
commit
77b46e7e53
2 changed files with 106 additions and 77 deletions
|
|
@ -1,9 +1,14 @@
|
||||||
//$dtBanList::IP192_168_0_133 = "336\t2020\t365";
|
|
||||||
//336 day of the year banned Dec1
|
|
||||||
//2020 year banned
|
|
||||||
//365 How long to ban (365 days = 1 year)
|
|
||||||
|
|
||||||
//$Host::dtBanlist = "prefs/dtBanlist.cs";
|
//$Host::dtBanlist = "prefs/dtBanlist.cs";
|
||||||
|
//$Host::KickBanTime = 20; is 20 Minutes
|
||||||
|
//$Host::BanTime = 43200; is One Month
|
||||||
|
//$Host::BanTime = 129600; is Three Months
|
||||||
|
//$Host::BanTime = 259200; is Six Months
|
||||||
|
//$Host::BanTime = 518400; is 1 year
|
||||||
|
//$Host::BanTime = 1000000; is Until you unban them (Forever)
|
||||||
|
//$Host::BanTime = BAN; is Until you unban them (Forever)
|
||||||
|
|
||||||
|
//$dtBanList::GUID3555379 = "DAY OF THE YEAR BANNED \t YEAR BANNED \t HOUR BANNED \t MINUTE BANNED \t TIME TO BE BANNED";
|
||||||
|
//$dtBanList::GUID3555379 = "4\t2021\t18\t31\t518400";
|
||||||
|
|
||||||
package dtBan
|
package dtBan
|
||||||
{
|
{
|
||||||
|
|
@ -17,57 +22,64 @@ function ClassicLoadBanlist()
|
||||||
exec($Host::ClassicWhitelist);
|
exec($Host::ClassicWhitelist);
|
||||||
}
|
}
|
||||||
|
|
||||||
function BanList::add(%guid, %ipAddress, %days)
|
function BanList::add(%guid, %ipAddress, %time){
|
||||||
{
|
if(%time > 999999){
|
||||||
if (%guid > 0)
|
%time = "BAN";
|
||||||
$dtBanList::GUID[%guid] = dtBanDay() TAB getBanYear() TAB %days;
|
}
|
||||||
|
if (%guid > 0){
|
||||||
|
$dtBanList::GUID[%guid] = dtBanMark() TAB %time;
|
||||||
|
}
|
||||||
|
if (getSubStr(%ipAddress, 0, 3) $= "IP:"){
|
||||||
|
// add IP ban
|
||||||
|
%bareIP = getSubStr(%ipAddress, 3, strLen(%ipAddress));
|
||||||
|
%bareIP = getSubStr(%bareIP, 0, strstr(%bareIP, ":"));
|
||||||
|
%bareIP = strReplace(%bareIP, ".", "_"); // variable access bug workaround
|
||||||
|
|
||||||
if (getSubStr(%ipAddress, 0, 3) $= "IP:")
|
$dtBanList::IP[%bareIP] = dtBanMark() TAB %time;
|
||||||
{
|
//error("ban" SPC %bareIP SPC $dtBanList::IP[%bareIP]);
|
||||||
// add IP ban
|
}
|
||||||
%bareIP = getSubStr(%ipAddress, 3, strLen(%ipAddress));
|
|
||||||
%bareIP = getSubStr(%bareIP, 0, strstr(%bareIP, ":"));
|
|
||||||
%bareIP = strReplace(%bareIP, ".", "_"); // variable access bug workaround
|
|
||||||
|
|
||||||
$dtBanList::IP[%bareIP] = dtBanDay() TAB getBanYear() TAB %days;
|
// write out the updated bans to the file
|
||||||
//error("ban" SPC %bareIP SPC $dtBanList::IP[%bareIP]);
|
export("$dtBanList*", $Host::dtBanlist);
|
||||||
}
|
|
||||||
|
|
||||||
// write out the updated bans to the file
|
|
||||||
export("$dtBanList*", $Host::dtBanlist);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function banList_checkIP(%client)
|
function banList_checkIP(%client){
|
||||||
{
|
%ip = %client.getAddress();
|
||||||
%ip = %client.getAddress();
|
%ip = getSubStr(%ip, 3, strLen(%ip));
|
||||||
%ip = getSubStr(%ip, 3, strLen(%ip));
|
%ip = getSubStr(%ip, 0, strstr(%ip, ":"));
|
||||||
%ip = getSubStr(%ip, 0, strstr(%ip, ":"));
|
%ip = strReplace(%ip, ".", "_");
|
||||||
%ip = strReplace(%ip, ".", "_");
|
|
||||||
|
|
||||||
%time = $dtBanList::IP[%ip];
|
%time = $dtBanList::IP[%ip];
|
||||||
if (%time !$= "" && %time !$= "UNBAN")
|
if(%time $= "BAN")
|
||||||
{
|
return 1;
|
||||||
%delta = getBanCount(getField(%time,0), getField(%time,1));
|
if (%time !$= "" && %time != 0){
|
||||||
if (%delta < getField(%time,2))
|
%delta = getBanCount(getField(%time,0), getField(%time,1),getField(%time,2),getField(%time,3));
|
||||||
return 1;
|
if (%delta < getField(%time,4))
|
||||||
else
|
return 1;
|
||||||
$dtBanList::IP[%ip] = "UNBAN";
|
else{
|
||||||
}
|
$dtBanList::IP[%ip] = "";
|
||||||
return 0;
|
schedule(1000,0,"export","$dtBanList*", $Host::dtBanlist);
|
||||||
|
//export("$dtBanList*", "prefs/dtBanlist.cs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function banList_checkGUID(%guid)
|
function banList_checkGUID(%guid){
|
||||||
{
|
%time = $dtBanList::GUID[%guid];
|
||||||
%time = $dtBanList::GUID[%guid];
|
if(%time $= "BAN")
|
||||||
if (%time !$= "" && %time !$= "UNBAN")
|
return 1;
|
||||||
{
|
if (%time !$= "" && %time != 0){
|
||||||
%delta = getBanCount(getField(%time,0), getField(%time,1));
|
%delta = getBanCount(getField(%time,0), getField(%time,1),getField(%time,2),getField(%time,3));
|
||||||
if (%delta < getField(%time,2))
|
if (%delta < getField(%time,4))
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else{
|
||||||
$dtBanList::GUID[%guid] = "UNBAN";
|
$dtBanList::GUID[%guid] = "";
|
||||||
}
|
schedule(500,0,"export","$dtBanList*", $Host::dtBanlist);
|
||||||
return 0;
|
//export("$dtBanList*", "prefs/dtBanlist.cs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -75,17 +87,31 @@ function banList_checkGUID(%guid)
|
||||||
if (!isActivePackage(dtBan))
|
if (!isActivePackage(dtBan))
|
||||||
activatePackage(dtBan);
|
activatePackage(dtBan);
|
||||||
|
|
||||||
function getBanCount(%d, %year)
|
function getBanCount(%d, %year, %h, %n){
|
||||||
{
|
%dif = formattimestring("yy") - %year;
|
||||||
%dif = getBanYear() - %year;
|
|
||||||
%days += 365 * (%dif-1);
|
%days += 365 * (%dif-1);
|
||||||
%days += 365 - %d;
|
%days += 365 - %d;
|
||||||
%days += dtBanDay();
|
%days += dtBanDay();
|
||||||
return %days;
|
%ht = %nt = 0;
|
||||||
|
if(formattimestring("H") > %h){
|
||||||
|
%ht = formattimestring("H") - %h;
|
||||||
|
}
|
||||||
|
else if(formattimestring("H") < %h){
|
||||||
|
%ht = 24 - %h;
|
||||||
|
%ht = formattimestring("H")+ %ht;
|
||||||
|
}
|
||||||
|
if(formattimestring("n") > %n){
|
||||||
|
%nt = formattimestring("n") - %n;
|
||||||
|
}
|
||||||
|
else if(formattimestring("n") < %n){
|
||||||
|
%nt = 60 - %n;
|
||||||
|
%nt = formattimestring("n") + %nt;
|
||||||
|
}
|
||||||
|
return mfloor((%days * 1440) + (%ht*60) + %nt);
|
||||||
|
//return mfloor((%days * 1440) + (%ht*60) + %nt) TAB (%days * 1440) TAB (%ht*60) TAB %nt;
|
||||||
}
|
}
|
||||||
|
|
||||||
function dtBanDay()
|
function dtBanMark(){
|
||||||
{
|
|
||||||
%date = formattimestring("mm dd yy");
|
%date = formattimestring("mm dd yy");
|
||||||
%m = getWord(%date,0);%d = getWord(%date,1);%y = getWord(%date,2);
|
%m = getWord(%date,0);%d = getWord(%date,1);%y = getWord(%date,2);
|
||||||
%count = 0;
|
%count = 0;
|
||||||
|
|
@ -94,17 +120,20 @@ function dtBanDay()
|
||||||
%days[4] = "30"; %days[5] = "31"; %days[6] = "30";
|
%days[4] = "30"; %days[5] = "31"; %days[6] = "30";
|
||||||
%days[7] = "31"; %days[8] = "31"; %days[9] = "30";
|
%days[7] = "31"; %days[8] = "31"; %days[9] = "30";
|
||||||
%days[10] = "31"; %days[11] = "30"; %days[12] = "31";
|
%days[10] = "31"; %days[11] = "30"; %days[12] = "31";
|
||||||
|
for(%i = 1; %i <= %m-1; %i++){
|
||||||
for(%i = 1; %i <= %m-1; %i++)
|
|
||||||
{
|
|
||||||
%count += %days[%i];
|
%count += %days[%i];
|
||||||
}
|
}
|
||||||
|
return %count + %d TAB formattimestring("yy") TAB formattimestring("H") TAB formattimestring("n");
|
||||||
return %count + %d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBanYear()
|
function unban(%guid,%ip){
|
||||||
{
|
if($dtBanList::GUID[%guid] !$= ""){
|
||||||
return formattimestring("yy");
|
$dtBanList::GUID[%guid] = "";
|
||||||
|
error("GUID" SPC %guid SPC "UNBANNED");
|
||||||
|
}
|
||||||
|
if($dtBanList::IP[%ip] !$= ""){
|
||||||
|
$dtBanList::IP[%ip] = "";
|
||||||
|
error("IP" SPC %ip SPC "UNBANNED");
|
||||||
|
}
|
||||||
|
export("$dtBanList*", $Host::dtBanlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ $Host::holoName[6] = "Harbinger";
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
// z0dd - ZOD, 9/29/02. Removed T2 demo code
|
// z0dd - ZOD, 9/29/02. Removed T2 demo code
|
||||||
$Host::GameName = "Tribes 2 Test";
|
$Host::GameName = "Tribes 2 Test";
|
||||||
$Host::Info = " ";
|
$Host::Info = "This is a Tribes 2 Classic server. More information in Discord. <a:playt2.com/discord>playt2.com/discord</a>";
|
||||||
$Host::Map = "VaubanLak";
|
$Host::Map = "VaubanLak";
|
||||||
$Host::MaxPlayers = 30;
|
$Host::MaxPlayers = 30;
|
||||||
$Host::MissionType = "LakRabbit";
|
$Host::MissionType = "LakRabbit";
|
||||||
|
|
@ -95,8 +95,8 @@ $Host::MaxBotDifficulty = 0.75;
|
||||||
$Host::NoSmurfs = 1;
|
$Host::NoSmurfs = 1;
|
||||||
$Host::VoteTime = 30; // amount of time before votes are calculated
|
$Host::VoteTime = 30; // amount of time before votes are calculated
|
||||||
$Host::VotePassPercent = 60; // percent needed to pass a vote
|
$Host::VotePassPercent = 60; // percent needed to pass a vote
|
||||||
$Host::KickBanTime = 1; // specified in days
|
$Host::KickBanTime = 20; // specified in minutes
|
||||||
$Host::BanTime = 30; // specified in days
|
$Host::BanTime = 43200; // specified in minutes (43200 is one month)
|
||||||
$Host::PlayerRespawnTimeout = 60; // time before a dead player is forced into observer mode
|
$Host::PlayerRespawnTimeout = 60; // time before a dead player is forced into observer mode
|
||||||
$Host::warmupTime = 20;
|
$Host::warmupTime = 20;
|
||||||
$Host::TournamentMode = 0;
|
$Host::TournamentMode = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue