r1ch.net forums
* Home Help Search Login Register
r1ch.net  |  r1ch.net stuff  |  Anticheat  |  Topic: How to setup anticheat-cvars.txt
Pages: [1]
Print
Author Topic: How to setup anticheat-cvars.txt  (Read 16745 times)
R1CH
Administrator
Member

Posts: 2625



« on: October 30, 2006, 02:54:45 am »

Starting with 2006-10-30 anticheat release and R1Q2 server b6904+, the anticheat module has the ability to restrict cvars on the client. The file for configuring cvars is anticheat-cvars.txt which belongs in the mod dir and the format is as follows:

Code:
var_name operator valuelist default
(Remember, the white space is a TAB character, not spaces!)

Where:
var_name is the variable name, eg gl_modulate or cl_maxfps you wish to evaluate.

operator is one of the following operators:
==   (is equal to, numeric)
!=   (is not equal to, numeric)
>   (greater than)
<   (less than)
>=   (greater than or equal to)
<=   (less than or equal to)
eq   (is equal to, case-insensitive string)
ne   (is not equal to, case-insensitive string)
~   (contains, case-insensitive string)

valuelist is a list of comma-separated values to test on. Usually you will just want one value here since most of the operators only expect one.

default is the default value to use if the client cvar value matches the expression. The default is only used on connecting, further cvar changes which match the expression will simply be ignored.

You may have multiple lines for the same cvar; they will be evaluated from top to bottom, so the last expression which evaluates successfully will have its default value set.

Now, you're probably quite confused, so here's a ton of examples to get you going:

Code:
gl_modulate > 2 1
This will stop gl_modulate from being set higher than 2. If the client connects with an invalid value (eg, gl_modulate 10), they will be reset to gl_modulate 1.

Code:
gl_modulate != 2 2
This forces gl_modulate 2 on every client.

Code:
rate < 5000 5000
rate > 15000 15000
This will limit rate between 5000 and 15000.

Code:
skin ne male/grunt male/grunt
This will prevent clients from changing skin to anything other than male/grunt.

Code:
name ~ fark Player
Prevent anyone from changing their name to anything containing "fark". If they connect with an invalid name, reset it to "Player".

Code:
fov != 90,110,120 90
This shows the use of multiple values in a single expression. This means the client has to be using fov 90, 110 or 120. If they are not, they will be reset to fov 90 on connecting.

Code:
skin ne male/grunt,female/athena,cyborg/terminator male/grunt
Again showing multiple values, the client must be using one of the listed skins. If not, they will be reset to male/grunt.

Code:
skin eq female/athena female/brianna
The eq operator and == act differently to the others, since they are inclusive rather than exclusive. The above example means the client will not be allowed to use the female/athena skin. If they connect with it, they will be reset to female/brianna. Any other skin value is permitted.

Code:
fov == 121,122 120
A silly example that will allow any fov except 121 and 122.

The anticheat server will disconnect your Q2 server if it has problems understanding an expression. Be careful not to specify a default value that would match any other expressions, including the one just evaluated. Don't do something stupid, like specify a value list with >=,  <, etc where it makes no sense to do so. Keep your defaults as safe as possible - remember, default values will only be used if the client connects with something invalid. Once connected, attempting to change a cvar to something that matches an expression will simply be ignored.

Also be aware how Q2 handles cvars internally - there are three ways a cvar is used - either its string value, its float value or its integer value. The anticheat right now only supports string and float matching (an integer op may be added later if the need arises). This means if you try to lock down a discrete integer value using ==, it may be possible to bypass by specifying it as a float. As in the last example above, only fov 121 and 122 are blocked. A client can still use fov 121.001 and likely get the same effect as fov 121. This shouldn't really be a problem since == has limited usefulness anyway.

To make managing cvar enforcements easier, it is possible to split the anticheat-cvars.txt into multiple files by using the \include directive. For example, if you stored your video-related cvars in video-cvars.txt and sound-related cvars in sound-cvars.txt, your anticheat-cvars.txt could look like this:
Code:
\include video-cvars.txt
\include sound-cvars.txt
Included files may themselves include other files. There is no recursion checking, so be careful not to get into an include loop! Included files are searched using the standard Quake II path searching, so if the file does not exist in the mod dir, it may be read from baseq2.

Another note, a string interpreted as a float or integer is always 0. Eg, gl_modulate "foo" is the same as gl_modulate 0 when an expression is matched.

Any questions, suggestions or bug reports, please post!
« Last Edit: February 09, 2007, 10:04:22 pm by R1CH » Logged
Darky
Member

Posts: 17


« Reply #1 on: January 07, 2007, 04:09:27 pm »

Here is a suggestion for a default config:


gl_driver   ne   opengl32   opengl32
vid_ref   ne   soft,gl,r1gl,ncgl   gl


Why?
gl_driver: I only host/configure tourney and TDM configs and i dont know of any other gl_driver and i dont want people to change it either. If you could you can use the wh.dll. (Even if you use the filecheck. See my filecheck post.)
vid_ref: I havent seen any one use a difrent one.

Let me know if im wrong or not.

Greetz,
Darky^
« Last Edit: January 07, 2007, 04:35:05 pm by Darky » Logged
Snake
Member

Posts: 184


« Reply #2 on: January 15, 2007, 05:31:50 am »

If there is a anticheat-cvars.txt in both baseq2 and mod dir, will anticheat read both? Say baseq2 first for general settings, and mod dir later for mod/server specific settings?

(Darky, i don't see how people could use the wh.dll and have a valid anticheat connection. Perhaps you mean when NOT using valid anticheat, but then all bets are off anyway, even though your cvar limits would stop a few users)
Logged
R1CH
Administrator
Member

Posts: 2625



« Reply #3 on: January 15, 2007, 05:56:56 am »

It uses the same ordering as any normal Q2 filesystem lookup would use, ie, moddir/paks, moddir/file, baseq2/paks, baseq2/file. Use the 'path' command to see your current search order. It reads the first file it finds and won't continue looking for others. Perhaps an "include" directive may be added if enough people want this kind of functionality.
Logged
Darky
Member

Posts: 17


« Reply #4 on: January 16, 2007, 04:59:45 pm »

Hi,

Snake, if i get out the cvar bans then every one can connect whit a wh.dll, the anticheat wont do anything about it.
Its on optional, not on full anticheat becouse a lot of people still use nocheat and such.

R1ch,
I have a problem whit this config. If i put in the cvar bans whit the tabs it wont load it. If i put in one command at the first line without the tabs the config loads...... any idea? its a windows server.

Greetz,
Darky


This wont load:
gl_driver   ne   opengl32   opengl32
vid_ref   ne   soft,gl,r1gl,ncgl   gl

But this wil:
gl_driver ne opengl32 opengl32
gl_driver   ne   opengl32   opengl32
vid_ref   ne   soft,gl,r1gl,ncgl   gl
Logged
R1CH
Administrator
Member

Posts: 2625



« Reply #5 on: January 16, 2007, 05:45:34 pm »

Those are spaces, not tabs. You have to use tabs.

Also in case you aren't aware, anticheat-cvars.txt only works on anticheat enabled clients...
Logged
Darky
Member

Posts: 17


« Reply #6 on: January 17, 2007, 01:24:01 pm »

Oke,

This may sound strange to you and you may even think im doing it wrong but plz read my last post again.
I know i need to use tabs and nog spaces, but for some reason i realy need to start whit a fauly input to make the rest work.

So i din't write it wrong or anything.

This should load "but it wont":
gl_driver   ne   opengl32   opengl32
vid_ref   ne   soft,gl,r1gl,ncgl   gl

And this shouldn't load But it does (well at least the first line shouldn't work):
gl_driver ne opengl32 opengl32
gl_driver   ne   opengl32   opengl32
vid_ref   ne   soft,gl,r1gl,ncgl   gl

Greetz,
Darky
Logged
R1CH
Administrator
Member

Posts: 2625



« Reply #7 on: January 17, 2007, 06:08:56 pm »

Works fine for me. Check you have tabs in all the proper places and that there is a new line at the end of each line and nothing else (no spaces or tabs etc).
Logged
Pages: [1]
Print
r1ch.net  |  r1ch.net stuff  |  Anticheat  |  Topic: How to setup anticheat-cvars.txt
Jump to:  

Powered by SMF 1.1.19 | SMF © 2013, Simple Machines