TacoServer/Classic/scripts/autoexec/AntiCloak.cs

79 lines
1.8 KiB
C#
Raw Normal View History

2019-09-13 15:34:03 -04:00
// AntiCloak Script
//
2019-01-21 12:22:18 -05:00
// Amount of players needed on server for CloakPack to be banned/unbanned
2019-09-13 15:34:03 -04:00
// This is useful for low numbers
//
2019-09-13 15:34:03 -04:00
// Enable/Disable the feature
2019-01-21 12:22:18 -05:00
// $Host::AntiCloakEnable = 1;
2019-09-13 15:34:03 -04:00
// When you would like for it to deactivate
2019-01-21 12:22:18 -05:00
// $Host::AntiCloakPlayerCount = 6;
2019-09-13 15:34:03 -04:00
//
2018-06-28 14:34:52 -04:00
2019-01-21 12:22:18 -05:00
// Called in GetCounts.cs
function CheckAntiCloak( %game )
2018-06-28 14:34:52 -04:00
{
2018-11-04 17:07:25 -05:00
//CTF only
if( $Host::AntiCloakEnable && $CurrentMissionType $= "CTF" && !$Host::TournamentMode )
{
//echo("TotalTeamPlayerCount " @ $TotalTeamPlayerCount);
//echo("AntiCloakPlayerCount " @ $AntiCloakPlayerCount);
2018-06-28 14:34:52 -04:00
if( $TotalTeamPlayerCount < $Host::AntiCloakPlayerCount )
2019-01-02 23:07:31 -05:00
{
if( $AntiCloakStatus !$= "ACTIVEON" )
$AntiCloakStatus = "ON";
2019-01-02 23:07:31 -05:00
}
2019-02-08 17:29:56 -05:00
//Off
2019-01-21 12:22:18 -05:00
else
2019-01-02 23:07:31 -05:00
{
if( $AntiCloakStatus !$= "ACTIVEOFF" )
$AntiCloakStatus = "OFF";
2019-01-02 23:07:31 -05:00
}
2019-02-08 17:29:56 -05:00
}
//All other cases outside of CTF
2019-02-08 17:29:56 -05:00
else
{
if( $AntiCloakStatus !$= "ACTIVEOFF" )
$AntiCloakStatus = "OFF";
}
switch$($AntiCloakStatus)
{
case ON:
$InvBanList[CTF, "CloakingPack"] = 1;
if(!isActivePackage(DisableCloakPack))
activatePackage(DisableCloakPack);
$AntiCloakStatus = "ACTIVEON";
case OFF:
2019-02-08 17:29:56 -05:00
$InvBanList[CTF, "CloakingPack"] = 0;
if(isActivePackage(DisableCloakPack))
deactivatePackage(DisableCloakPack);
$AntiCloakStatus = "ACTIVEOFF";
case ACTIVEON:
//Do Nothing
case ACTIVEOFF:
//Do Nothing
}
}
2019-09-13 15:34:03 -04:00
// So if the player is able to get a cloakpack, he cant use it
2019-01-02 23:07:31 -05:00
package DisableCloakPack
{
function CloakingPackImage::onActivate(%data, %obj, %slot)
{
if(%obj.client.armor $= "Light")
{
if(%obj.canCloak() $= "true")
2019-01-12 14:33:30 -05:00
messageClient(%obj.client, 'MsgCloakingPackInvalid', '\c2Cloakpack is disabled until %1 players.', $Host::AntiCloakPlayerCount );
2019-01-02 23:07:31 -05:00
}
2019-01-21 12:22:18 -05:00
else
2019-01-02 23:07:31 -05:00
{
messageClient(%obj.client, 'MsgCloakingPackInvalid', '\c2Cloaking available for light armors only.');
}
}
};