Added ShieldPack

ShieldPack added to antipack restrictions at low numbers
This commit is contained in:
ChocoTaco1 2020-05-13 14:29:06 -04:00
parent 5c72ec89d4
commit 8bbe24e8ae
5 changed files with 98 additions and 84 deletions

View file

@ -1,78 +0,0 @@
// AntiCloak Script
//
// Amount of players needed on server for CloakPack to be banned/unbanned
// This is useful for low numbers
//
// Enable/Disable the feature
// $Host::AntiCloakEnable = 1;
// When you would like for it to deactivate
// $Host::AntiCloakPlayerCount = 6;
//
// Called in GetCounts.cs
function CheckAntiCloak( %game )
{
//CTF only
if( $Host::AntiCloakEnable && $CurrentMissionType $= "CTF" && !$Host::TournamentMode )
{
//echo("TotalTeamPlayerCount " @ $TotalTeamPlayerCount);
//echo("AntiCloakPlayerCount " @ $AntiCloakPlayerCount);
if( $TotalTeamPlayerCount < $Host::AntiCloakPlayerCount )
{
if( $AntiCloakStatus !$= "ACTIVEON" )
$AntiCloakStatus = "ON";
}
//Off
else
{
if( $AntiCloakStatus !$= "ACTIVEOFF" )
$AntiCloakStatus = "OFF";
}
}
//All other cases outside of CTF
else
{
if( $AntiCloakStatus !$= "ACTIVEOFF" )
$AntiCloakStatus = "OFF";
}
switch$($AntiCloakStatus)
{
case ON:
$InvBanList[CTF, "CloakingPack"] = 1;
if(!isActivePackage(DisableCloakPack))
activatePackage(DisableCloakPack);
$AntiCloakStatus = "ACTIVEON";
case OFF:
$InvBanList[CTF, "CloakingPack"] = 0;
if(isActivePackage(DisableCloakPack))
deactivatePackage(DisableCloakPack);
$AntiCloakStatus = "ACTIVEOFF";
case ACTIVEON:
//Do Nothing
case ACTIVEOFF:
//Do Nothing
}
}
// So if the player is able to get a cloakpack, he cant use it
package DisableCloakPack
{
function CloakingPackImage::onActivate(%data, %obj, %slot)
{
if(%obj.client.armor $= "Light")
{
if(%obj.canCloak() $= "true")
messageClient(%obj.client, 'MsgCloakingPackInvalid', '\c2Cloakpack is disabled until %1 players.', $Host::AntiCloakPlayerCount );
}
else
{
messageClient(%obj.client, 'MsgCloakingPackInvalid', '\c2Cloaking available for light armors only.');
}
}
};

View file

@ -0,0 +1,92 @@
// AntiPack Script
//
// Amount of players needed on server for (Cloak and Shield) Pack to be banned/unbanned
// This is useful for low numbers
//
// Enable/Disable the feature
// $Host::AntiPackEnable = 1;
// When you would like for it to deactivate
// $Host::AntiPackPlayerCount = 6;
//
// Called in GetCounts.cs
function CheckAntiPack( %game )
{
//CTF only
if( $Host::AntiPackEnable && $CurrentMissionType $= "CTF" && !$Host::TournamentMode )
{
//echo("TotalTeamPlayerCount " @ $TotalTeamPlayerCount);
//echo("AntiPackPlayerCount " @ $AntiPackPlayerCount);
if( $TotalTeamPlayerCount < $Host::AntiPackPlayerCount )
{
if( $AntiPackStatus !$= "ACTIVEON" )
$AntiPackStatus = "ON";
}
//Off
else
{
if( $AntiPackStatus !$= "ACTIVEOFF" )
$AntiPackStatus = "OFF";
}
}
//All other cases outside of CTF
else
{
if( $AntiPackStatus !$= "ACTIVEOFF" )
$AntiPackStatus = "OFF";
}
switch$($AntiPackStatus)
{
case ON:
$InvBanList[CTF, "CloakingPack"] = 1;
$InvBanList[CTF, "ShieldPack"] = 1;
if(!isActivePackage(AntiPack))
activatePackage(AntiPack);
$AntiPackStatus = "ACTIVEON";
case OFF:
$InvBanList[CTF, "CloakingPack"] = 0;
$InvBanList[CTF, "ShieldPack"] = 0;
if(isActivePackage(AntiPack))
deactivatePackage(AntiPack);
$AntiPackStatus = "ACTIVEOFF";
case ACTIVEON:
//Do Nothing
case ACTIVEOFF:
//Do Nothing
}
}
// So if the player is able to get said pack, he cant use it
package AntiPack
{
function CloakingPackImage::onActivate(%data, %obj, %slot)
{
if(%obj.client.armor $= "Light")
{
if(%obj.canCloak() $= "true")
messageClient(%obj.client, 'MsgCloakingPackInvalid', '\c2Cloakpack is disabled until %1 players.', $Host::AntiPackPlayerCount );
}
else
{
messageClient(%obj.client, 'MsgCloakingPackInvalid', '\c2Cloaking available for light armors only.');
}
}
function ShieldPackImage::onActivate(%data, %obj, %slot)
{
messageClient(%obj.client, 'MsgShieldPackInvalid', '\c2Shieldpack is disabled until %1 players.', $Host::AntiPackPlayerCount );
%obj.setImageTrigger(%slot,false);
%obj.isShielded = "";
}
function ShieldPackImage::onDeactivate(%data, %obj, %slot)
{
//Nothing
}
};

View file

@ -75,7 +75,7 @@ function GetTeamCounts( %game, %client, %respawn )
//Start Team Balance Notify
schedule(1000, 0, "TeamBalanceNotify", %game, %team1difference, %team2difference);
//Start AntiCloak
schedule(1500, 0, "CheckAntiCloak", %game);
schedule(1500, 0, "CheckAntiPack", %game);
//Set so counter wont run when it doesnt need to.
$GetCountsStatus = "IDLE";