Thread: VAC Ban Status
View Single Post
Plugin Info:     Modification:          Category:          Approver:   Hawk552 (427)
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-27-2009 , 02:10   VAC Ban Status
Reply With Quote #1

VAC Ban Status
v0.41 beta

Update
The curl module was implemented to bring this plugin back to life. I have not thoroughly tested so please let me know if you find any issues. Sockets is no longer needed.

Download curl here. Direct link to download page. Don't forget to also get the include files.

***************** Important *****************
You must also get a SSL certificate file and place it in the below location:
addons/amxmodx/data/curl_cert/cacert.pem
Get a certificate here: https://curl.se/docs/caextract.html
*********************************************

Description
This plugin will check if a steam account has ever been VAC banned. Checking an account can be done in 2 ways; manually via console and auto. Auto checking will automatically check a player either when they first connect to the server or when they join a team. To specify when a player is checked, set the cvar vbs_vaccheck to the appropriate value (default: 0 [on connect]). If a VAC ban is found on a players steam account then the selected punishment will be issued on player. There are 5 punishments to choose from (see below enum) which can be defined by cvar vbs_punishment (default: 0 [log only]). Punishments can be issued either when a VAC ban status is found or when the player reaches a specified kill\death ratio. To make a punishment be issued when the player reaches a specified kill-death ratio, select the appropriate punishment below. Each punishment named KDRATIO will be issued once the player reaches the kill\death ratio. To specify the kill-death ratio, set it in the cvar vbs_kdratio (default 3 [3:1]). You can also specify a minimum kills value for when the plugin will start to check a players kill\death ratio; to set this value set cvar vbs_kdminkills to the appropriate value (default: 15 [kills]). When auto-checking is enabled, the server will check the VAC ban status on the steam server and save the ban status value to the database. If the player is not banned, the database entry is added with a timestamp that will expire in the number of days defined in cvar vbs_expiredays (default: 15 [days]). This will prevent a plugin from having to constantly re-check a player everytime they connect. When the entry expires, they will get re-checked on the steam server on their next connection. If a VAC ban is found on a steam account, the database is permanent and will never expire. If a player connects that has a positive VAC ban status saved to the database, the selected punishment will be issued. There is a whitelisting system that allows you to whitelist particular players steam accounts. This will make the plugin not recognize them as being VAC banned and they will be immune to the plugin until they are removed from the whitelist.

This is a port of an existing sourcemod plugin: http://forums.alliedmods.net/showthread.php?t=80942

Commands
  • amx_vacban <name\steamid> - Check a players VAC ban status
  • amx_vacclearall - Clear all entries from database
  • amx_vacclearnotbanned - Clear all non-VAC banned entries from database
  • amx_vacremoveentry <name\steamid> - Remove an entry from database
  • amx_vacaddwhitelist <name\steamid> - Add a player to whitelist. Player will be considered not banned.
  • amx_vacremovewhitelist <name\steamid> - Remove a player from whitelist
  • amx_vacquery <name\steamid> - Query the database for a players VAC ban status
CVars
Code:
///////////////////////////////////////////////////////////////////////////
//   *************** VAC Ban Status Configuration File ****************  //	
///////////////////////////////////////////////////////////////////////////

echo Executing VAC Ban Status Configuration File

///////////////////////////////////////////////////////////////////////////
// Enable\Disable auto checking						 //
///////////////////////////////////////////////////////////////////////////
// 0 - Disabled								 //
// 1 - Enabled								 //
///////////////////////////////////////////////////////////////////////////
// Default: 1		     						 //
///////////////////////////////////////////////////////////////////////////

vbs_autocheck 1 

///////////////////////////////////////////////////////////////////////////
// Specify when auto-check is performed					 //
///////////////////////////////////////////////////////////////////////////
// 0 - When the player connects						 //
// 1 - When the player joins a team					 //
///////////////////////////////////////////////////////////////////////////
// Default: 0								 //
///////////////////////////////////////////////////////////////////////////

vbs_vaccheck 0

///////////////////////////////////////////////////////////////////////////
// The number of days at which VAC ban status values written to the db   //
// will expire. This will only affect players who are not VAC banned. If //
// a VAC ban is found on a player it is a permanent entry and will not   //
// expire.								 //
///////////////////////////////////////////////////////////////////////////
// Default: 15								 //
///////////////////////////////////////////////////////////////////////////

vbs_expiredays 15

///////////////////////////////////////////////////////////////////////////
// Punish method if VAC ban found					 //
///////////////////////////////////////////////////////////////////////////
// 0 - Log only (no punishment)						 //
// 1 - Kick only							 //
// 2 - Kick and ban using the players Steam ID				 //
// 3 - Kick and ban using the players IP address			 //
// 4 - Kick and ban via AMX ban						 //
// 5 - Shoot blanks, SteamID, reapplied if user reconnects		 //
// 6 - Kick only [KDRATIO]						 //
// 7 - Kick and ban using the players Steam ID [KDRATIO]		 //
// 8 - Kick and ban using the players IP address [KDRATIO]		 //
// 9 - Kick and ban via AMX ban	[KDRATIO]				 //
// 10 - Shoot blanks, SteamID, reapplied if user reconnects [KDRATIO]	 //
///////////////////////////////////////////////////////////////////////////
// Default: 0								 //
///////////////////////////////////////////////////////////////////////////

vbs_punishment 0

///////////////////////////////////////////////////////////////////////////
// Flag required for plugin notification				 //
///////////////////////////////////////////////////////////////////////////
// Can be any admin flag 						 //
///////////////////////////////////////////////////////////////////////////
// Default: "d"								 //
///////////////////////////////////////////////////////////////////////////

vbs_notifyflag "d"

///////////////////////////////////////////////////////////////////////////
// The time at which a connecting socket is considered timed-out. At     //
// this number of seconds, if the plugin does not receive a response     //
// from the steam server it will drop the connection.			 //
///////////////////////////////////////////////////////////////////////////
// Default: 5								 //
///////////////////////////////////////////////////////////////////////////

vbs_sockettimeout 5

///////////////////////////////////////////////////////////////////////////
// The kill:death ratio needed for KDRATIO punishments to take effect.   //
// When a VAC ban is first found on the player, the punishment is not    //
// applied. The plugin will wait until when\if the player player and     //
// reaches this kd ratio and then apply punishment. The same will happen //
// if the player re-connects. 						 //
///////////////////////////////////////////////////////////////////////////
// Default: 3								 //
///////////////////////////////////////////////////////////////////////////

vbs_kdratio 3

///////////////////////////////////////////////////////////////////////////
// The number of kills required before kill:death ratio is evaluated     //
// when using a KDRATIO punishment					 //
///////////////////////////////////////////////////////////////////////////
// You can use any number						 //
///////////////////////////////////////////////////////////////////////////
// Default: 15								 //
///////////////////////////////////////////////////////////////////////////

vbs_kdminkills 15

///////////////////////////////////////////////////////////////////////////
// The ban duration used for all ban punishments.			 // 
///////////////////////////////////////////////////////////////////////////
// 0 - Permanent							 //
// 1+ - Number of minutes						 //
///////////////////////////////////////////////////////////////////////////
// Default: 0 								 //
///////////////////////////////////////////////////////////////////////////

vbs_bantime 0
Punishments
  • 0 = Log only
  • 1 = Kick only
  • 2 = Kick & ban by Steam ID
  • 3 = Kick & ban by IP
  • 4 = Kick & AMX ban
  • 5 = Shoot blanks
  • 6 = Kick only [KD Ratio]
  • 7 = Kick & ban by Steam ID [KD Ratio]
  • 8 = Kick & ban by IP [KD Ratio]
  • 9 = Kick & AMX ban [KD Ratio]
  • 10 = Shoot blanks [KD Ratio]
Required Modules
  • Sockets (0.3)
  • Curl (0.4 and greater)
  • Fakemeta
  • nVault
Credits
voogru - Discovering how to convert steamid to community id.
danielkza - AMX-X script to do steamid to community id conversion.
Mordekay - Beta testing
Shadows Adi - Idea to use SSL certificate cURL option for consistent request responses.

ChangeLog
  • v0.4 beta
    - Plugin now uses the curl module and sockets is no longer needed. All other functionality should continue to work as it did in prior versions.
  • v0.3
    - Improved speed of checking by increasing incoming data buffer size to 4096. Defined by BUFFER_SIZE
    - I noticed at times particular steam id checks would not work. I found that depending on the size of the users steam community page, the incoming data was sometimes cut off in the middle of a string/phrase we are looking for. For example, if we are looking for "<vacBanned>1" for ban status. One packet would have "<vacB" and the following packet would start with "anned>1" causing the plugin to not notice the ban string. Now, when data is received it is added to the previously received data so the detection strings can be checked within the entire buffer.
    - Fixed bug where if you try to manually check a SteamID and accidentally have a space on the end it would print out checking SteamID [].
    - Replaced set_user_hitzones with fm_set_user_hitzones. Removed fun module, fakemeta is now required.
    - Revised\improved DeathMsg code for applying punishment based on kill\death ratio.
    - Changed punishment and notify admin flag selection to cvar.
    - Added cvar to specify the seconds used to consider a connection to steam server as timedout. The cvar that specifies the time out is vbs_sockettimeout [default 5.0]
    - Added KICK_BAN_ID_KDRATIO and KICK_BAN_IP_KDRATIO, these were both accidentally not coded.
    - Added punishment function so all punishments are issued in one place instead of having them coded multiple times.
    - Added cvar to specify the time period to ban a player when a ban punishment is used. vbs_bantime [default: 0]
    - Added clear all command to clear the database of all entries (everything, including both VAC banned\unbanned status and whitelist entries). Note: You cannot clear all whitelisted or all VAC banned without clearing the entire db.
    - Added clear non VAC banned command to clear database of entires that are not VAC banned (VAC banned and whitelist entries will remain in database). Command: amx_vacclearall
    - Added whitelist system so you can whitelist a steamid\player. When whitelisted, the player will be treated as if they have no VAC ban and will not get checked. The whitelist entry is permanent and will not be cleared unless done so manually with the amx_vacremovewhitelist or amx_vacclearall command.
    Commands: amx_vacaddwhitelist , amx_vacremovewhitelist
    - Added query command so you can manually check a players entry in the db. Command: amx_vacquery
    - Added display of time that a manual VAC ban status check took with steam server.
    - Added cvar to set when a player is auto-checked vbs_vaccheck [default: 0] 0=on connect, 1=team join [T\CT only]
    - Switched back to regular sockets module as sockets_hz didn't solve the lag issue.
    - Added error checking when opening vault. Since almost every function of the plugin uses vault communication, if the vault does not open properly then the plugin cannot function as it was designed to. If an error is found when opening the nvault file, the plugin will fail and report an error in log.
    - Corrected AMXBan usage.
    - Added usage of config file (vacbanstatus.cfg)

Downloads
0.2b 279
0.2 458
0.1 77
Attached Files
File Type: cfg vacbanstatus.cfg (5.2 KB, 3928 views)
File Type: sma Get Plugin or Get Source (vacbans.sma - 6948 views - 35.1 KB)
File Type: sma Get Plugin or Get Source (vacbans_041_beta.sma - 627 views - 33.9 KB)
__________________

Last edited by Bugsy; 02-02-2021 at 21:56. Reason: new release
Bugsy is offline