VACChecker

  • community
  • anti-cheat
  • by limon
  • Takaro main
  • all
Version
View export JSON

Automatically checks players for VAC bans upon connection and applies configurable punishments (kick or ban) based on the ban's age.

Key Functionality

  • VAC Ban Detection: The module retrieves player VAC ban information (number of bans, days since last ban) from the game server.
  • Configurable Threshold: Administrators can set a threshold for the number of days since the last VAC ban. Players with bans within this threshold are subject to punishment.
  • Punishment Options: The module supports two punishment types:
    * Kick: Removes the player from the server.
    * Ban: Temporarily bans the player.
  • Customizable Messages: Kick and ban messages can be customized to inform players of the reason for the action.
  • Immunity Permission: A permission can be granted to exempt specific players from VAC ban checks and punishments.

How to Use

  1. Configuration:
    • PunishmentType: Choose the punishment to apply (kick or ban). Default: kick.
    • Ban Duration: If PunishmentType is ban, set the duration of the ban (in milliseconds).
    • PunishmentMessage: Customize the message shown to the player when they are kicked or banned. Use {days} as a placeholder for the number of days since the player's last VAC ban and {threshold} for the configured DaysThreshold.
    • DaysThreshold: Set the number of days. Players with a VAC ban within this many days will be punished.
  2. Permissions:
    • Grant the VAC_BAN_IMMUNITY permission to players who should be exempt from VAC ban checks.
  3. Module Operation:
    • The module automatically checks players when they connect to the server. No manual commands are required.

Important Considerations

  • Game Server Compatibility: Ensure that your game server provides the necessary player VAC ban information for this module to function correctly.
  • Threshold Setting: Carefully consider the DaysThreshold to balance enforcement with player leniency.
  • Immunity Usage: Use the VAC_BAN_IMMUNITY permission judiciously.
  • Message Clarity: Customize the PunishmentMessage to provide clear and informative reasons for kicks or bans.

Configuration 4

Settings you fill in when installing the module on a server.

SettingTypeDefaultDescription
PunishmentType PunishmentType string "kick" PunishmentType
Ban Duration Ban Duration number 3600000 Ban Duration
PunishmentMessage PunishmentMessage string "VAC ban detected {days} days ago" Punishment Message
DaysThreshold DaysThreshold string Days Threshold
Raw config schema
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "required": [],
  "additionalProperties": false,
  "properties": {
    "PunishmentType": {
      "title": "PunishmentType",
      "description": "PunishmentType",
      "default": "kick",
      "type": "string",
      "enum": [
        "kick",
        "ban"
      ]
    },
    "Ban Duration": {
      "title": "Ban Duration",
      "description": "Ban Duration",
      "default": 3600000,
      "x-component": "duration",
      "type": "number"
    },
    "PunishmentMessage": {
      "title": "PunishmentMessage",
      "description": "Punishment Message",
      "default": "VAC ban detected {days} days ago",
      "type": "string"
    },
    "DaysThreshold": {
      "title": "DaysThreshold",
      "description": "Days Threshold",
      "type": "string"
    }
  }
}
Raw UI schema
{}

Hooks 1

Code that runs in reaction to a game or Takaro event.

  • vac-checker

    Hook for player-connected events

    Hook source
    import { takaro, data, checkPermission } from '@takaro/helpers';
    
    async function main() {
        const { gameServerId, player, pog } = data;
        console.log(`VACBanChecker: Checking player ${player.name}`);
    
        // Check for immunity permission
        if (checkPermission(pog, 'VAC_BAN_IMMUNITY')) {
            console.log(`VACBanChecker: Player ${player.name} has immunity, skipping check`);
            return;
        }
    
        // Get the player data from their ID
        const playerData = (await takaro.player.playerControllerGetOne(player.id)).data.data;
        console.log(`VACBanChecker: Player Steam data loaded for ${player.name}`, {
            vacBans: playerData.steamNumberOfVACBans,
            daysSinceLastBan: playerData.steamsDaysSinceLastBan
        });
    
        // Check for VAC bans
        if (playerData.steamNumberOfVACBans > 0 &&
            parseInt(playerData.steamsDaysSinceLastBan) < data.module.userConfig.daysThreshold) {
    
            const formattedMessage = data.module.userConfig.PunishmentMessage
                .replace('{days}', playerData.steamsDaysSinceLastBan)
                .replace('{threshold}', data.module.userConfig.daysThreshold);
    
            if (data.module.userConfig.PunishmentType === 'kick') {
                await takaro.gameserver.gameServerControllerKickPlayer(gameServerId, player.id, {
                    reason: formattedMessage
                });
    
                await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {
                    message: `${player.name} was kicked (VAC ban ${playerData.steamsDaysSinceLastBan} days ago)`
                });
            } else if (data.module.userConfig.PunishmentType === 'ban') {
                const now = new Date();
                const expiresAt = new Date(now.getTime() + (data.module.userConfig['Ban Duration']));
    
                await takaro.player.banControllerCreate({
                    gameServerId,
                    playerId: player.id,
                    until: expiresAt,
                    reason: formattedMessage
                });
    
                await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {
                    message: `${player.name} was banned (VAC ban ${playerData.steamsDaysSinceLastBan} days ago)`
                });
            }
        }
    }
    
    await main();

Permissions 1

Roles you can grant to decide who may use what.

  • VAC_BAN_IMMUNITY

    VAC_BAN_IMMUNITY