TacoServer/Classic/scripts/autoexec/AntiCloak.cs

65 lines
1.6 KiB
C#
Raw Normal View History

//Amount of players needed on server for CloakPack to be banned/unbanned
//
//$Host::AntiCloakEnable = 1;
//$Host::AntiCloakPlayerCount = 6;
2018-06-28 14:34:52 -04:00
2018-11-13 15:31:04 -05:00
//Called in GetCounts.cs
function ActivateAntiCloak()
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-02 23:16:55 -05:00
if( !$Host::TournamentMode && $TotalTeamPlayerCount < $Host::AntiCloakPlayerCount && $CloakpackRunOnce !$= 0)
2019-01-02 23:07:31 -05:00
{
2018-06-28 14:34:52 -04:00
$InvBanList[CTF, "CloakingPack"] = true;
2019-01-02 23:07:31 -05:00
if(!isActivePackage(DisableCloakPack))
activatePackage(DisableCloakPack);
2019-01-02 23:16:55 -05:00
$CloakpackRunOnce = 0;
2019-01-02 23:07:31 -05:00
}
2018-11-13 15:31:04 -05:00
//All other cases it is.
2019-01-02 23:16:55 -05:00
else if( $CloakpackRunOnce !$= 1 )
2019-01-02 23:07:31 -05:00
{
$InvBanList[CTF, "CloakingPack"] = false;
if(isActivePackage(DisableCloakPack))
deactivatePackage(DisableCloakPack);
2019-01-02 23:16:55 -05:00
$CloakpackRunOnce = 1;
2019-01-02 23:07:31 -05:00
}
}
}
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
}
else
{
//Nothing
}
}
else
{
messageClient(%obj.client, 'MsgCloakingPackInvalid', '\c2Cloaking available for light armors only.');
}
}
};