Rate Enforcer

From AntiHax

Windows and Linux version:

Download Rate Enforcer *Final*

Download Rate Enforcer Source Code

If you use this software or source code, please consider donating.


Contents

Rate Enforcer for HalfLife (HL) mods including Day of Defeat (DOD) and Counter Strike (CS)

Rate enforcer is a metamod plugin for HalfLife aimed at rate and file consistency enforcement for leagues. Current features include;

  • File Integrity Checking (with exceptions!)
  • CVar Limiting
  • Rate Enforcing
  • CVar Logging
  • Configuration Hash

The enforcer is compatible with most HL mods including;

  • Counter Strike 1.6 (CS)
  • Day of Defeat 1.3 (DOD)
  • HalfLife Deathmatch (HLDM)

Please report bugs and crashes to antihax@gmail.com. (Send a paypal donation too if you want! :) )

Pub Server Warning

The default configuration is for 12 man private servers. If you want to use this on a pub server with more than 12 players do not enforce high rates. Use the following limits;

  • cl_updaterate 20
  • cl_cmdrate 60
  • rate 7500
  • ex_interp 0.02 <=> 0.1

Make sure your server has;

  • sv_maxrate 30000
  • sv_maxupdaterate 100

This allows all levels of players to play. Contrary to popular belief cl_cmdrate and cl_rate are the only values which affect ALL players quality.


!WARNING! DO NOT ENFORCE HIGH UPDATERATE OR RATE ON PUBLIC SERVERS, MOST CONNECTIONS CANNOT HANDLE IT!

Ninety percent of the time, "bad registration" is caused because the affected player (the one whining) has unrealistically low interp and high updaterate (cl_updaterate 101, ex_interp 0.01) causing extrapolation or guessing where players will be. Extrapolation is not accurate and gets less accurate over time, if you cant hit 'em, ex_interp 0.1 cl_updaterate 40. Please learn HL_Rates correctly.

Configuration

The package comes with a default enforcer config but it is fully customizable.

///***
//*
//*   Copyright (c) 2005-2006, AntiHax.Net. All rights reserved.
//*	
//*   All use, distribution, or modification is prohibited
//*   without donating a cash amount to antihax@gmail.com via paypal.
//*   (ok really it is free, but please donate something =P).
//*
//*   Author: "Danni" Wilson
//*
//****/



//  * e_logging <1/0> *

//  Setup cvar logging to mod/enforcerlogs directory
//  All CVars added with e_querycvar will be logged here.

e_logging "1"


// * e_ticrate <floattime>*

//  Tick rate to query a cvar.
//  0.1 is 100 ms. 1.0 is one second.

e_ticrate "0.1"

// * e_forceintegrity <1/0>*

//  Turns on model and sound consistency checking.
//  Players with modified files are kicked.

e_forceintegrity "1"


// * e_consistancyexception <file> *

//  Mod relative path to a file that should not be auto-enforced.

e_consistancyexception "sprites/gplayer.spr"
e_consistancyexception "sprites/axis_camera.spr"
e_consistancyexception "sprites/aplayer.spr"
e_consistancyexception "sprites/allies_camera.spr"
e_consistancyexception "sprites/caparea.spr"


// * e_querycvar <cvar> <datatype> <critical> <operator> <value> <fixvalue>*
// * e_querycvar <cvar> <datatype> <critical> (<=>) <lowervalue> <uppervalue> <fixvalue> *

// cvar is the name of the cvar to be queried.
// datatype is one of the following;
//
//	s: String Value: 	"Hello Mom!"
//	f: float value:  	10.01231
//	i: integer value:	123
//
// critical required, use the character 'c'
// operator is one of the following;
//	
//	== 	equal to
//	!=	not equal to
//	>	greater than
//	<	less than
//	>=	greater or equal to
//	<=	less or equal to
//	<=>	Bounding (use the second e_querycvar method above for upper and lower limits)
//	0	Null, do nothing and log only
//
// value (lowervalue/uppervalue) the desired value, 
//	or value range if using the Bounding operator.
//
// fixvalue is an optional value that will be forced 
// 	if the players cvar does not meet the requirement.
//
//
//
//  * EXAMPLES *
//
//  Log only
//  e_querycvar "_ah" "i" "c" "0" "" ""
//
//  Check cl_updaterate is at least 75 and force to 75 if not.
//  e_querycvar "cl_updaterate" "i" "c" "<" "75" "75"
//
//  Bound ex_interp to 0.1 and 0.01, force 0.1 if not met.
//  e_querycvar "ex_interp" "f" "c" "<=>" "0.01" "0.1" "0.1"
//
//

CVAR Logging

The logging feature of this rate enforcer allows all defined querycvar for each player to be logged to a file allowing league administrators to request the server files and detect interesting configuration settings which may have been previously unknown.

Using this setting on a public server is unwise and unnecessary unless the administrator is curious about other players settings.


Configuration Hash

Since this plugin was aimed at league use, it is understood that the league would likely use a stock configuration for the enforcer settings and users should not be allowed to modify these settings. As a result, a configuration hashing function has been developed into the library that will display the hash of the configuration within the log files allowing league administrators to detect a modified configuration.


Source Code

The source code started from MetaMod_Base v1.4 and can be used for any purpose. The code is primarily C with some C++ elements (STL structures, simple classes, etc).