TacoServer/Classic/scripts/autoexec/AntiCloak.cs

77 lines
1.8 KiB
C#
Raw Normal View History

2019-01-21 12:22:18 -05:00
// Amount of players needed on server for CloakPack to be banned/unbanned
//
2019-01-21 12:22:18 -05:00
// $Host::AntiCloakEnable = 1;
// $Host::AntiCloakPlayerCount = 6;
2018-06-28 14:34:52 -04:00
2019-01-21 12:22:18 -05:00
// Called in GetCounts.cs
2019-02-03 02:51:56 -05:00
function ActivateAntiCloak( %game )
2018-06-28 14:34:52 -04:00
{
2018-11-04 17:07:25 -05:00
//CTF only
if( $Host::AntiCloakEnable && $CurrentMissionType $= "CTF" )
{
//echo("TotalTeamPlayerCount " @ $TotalTeamPlayerCount);
//echo("AntiCloakPlayerCount " @ $AntiCloakPlayerCount);
2018-06-28 14:34:52 -04:00
2018-11-13 15:31:04 -05:00
//If server is in Tourny mode and the team population is lower than the AntiCloakPlayerCount cloak is not selectable.
2019-01-21 12:22:18 -05:00
if( !$Host::TournamentMode && $TotalTeamPlayerCount < $Host::AntiCloakPlayerCount )
2019-01-02 23:07:31 -05:00
{
2019-01-21 12:22:18 -05:00
if( $AntiCloakRunOnce !$= 0 )
{
$InvBanList[CTF, "CloakingPack"] = 1;
2019-01-02 23:07:31 -05:00
2019-01-21 12:22:18 -05:00
if(!isActivePackage(DisableCloakPack))
activatePackage(DisableCloakPack);
2019-01-02 23:07:31 -05:00
2019-01-21 12:22:18 -05:00
$AntiCloakRunOnce = 0;
}
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
{
2019-01-21 12:22:18 -05:00
if( $AntiCloakRunOnce !$= 1 )
{
$InvBanList[CTF, "CloakingPack"] = 0;
2019-01-02 23:07:31 -05:00
2019-01-21 12:22:18 -05:00
if(isActivePackage(DisableCloakPack))
deactivatePackage(DisableCloakPack);
2019-01-21 12:22:18 -05:00
$AntiCloakRunOnce = 1;
}
2019-01-02 23:07:31 -05:00
}
2019-02-08 17:29:56 -05:00
}
//All other cases outside of CTF.
else
{
if( $AntiCloakRunOnce !$= 1 )
{
$InvBanList[CTF, "CloakingPack"] = 0;
if(isActivePackage(DisableCloakPack))
deactivatePackage(DisableCloakPack);
$AntiCloakRunOnce = 1;
}
}
}
2019-01-02 23:07:31 -05:00
//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")
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.');
}
}
};