Sunday, December 5, 2010

Clientside Dvar Monitoring

One of the things I used to like about punkbuster was it allowed you to monitor client dvars to see if they were within a valid range.  There are a bunch of dvars that a user could set to give them an unfair advantage.  Since MW2 and BO use VAC, this feature is no longer available.  After doing some research I believe it is possible to do via scripting so I coded up some stuff today that should effectively give the PB dvar monitoring functionality.  I cannot be sure it works until the tools come out of course.

I put in a file that server admins can modify/override to change these settings and it looks something like this:

Load()
{
    restrictions = [];
    restrictions["cl_maxpackets"] = "IN 30 100";
   
    return restrictions;
}

I followed a syntax nearly identical to what PB did with the exception of include and exclude can support more than one string.

From evenbalance.com:
PB_SV_CVAR [cvar_name] IN [from_value] [optional_to_value]
If you wish to require that a particular cvar always equals a certain value or falls within a specified range of values, use the "IN" type.  For example, "PB_SV_CVAR handicap IN 10" means that each player's handicap cvar must always equal 10 on your game server.  Issuing "PB_SV_CVAR handicap IN 5 15" means that handicap must always fall inside the 5 to 15 range (inclusive).

PB_SV_CVAR [cvar_name] OUT [from_value] [optional_to_value]
If you wish to require that a particular cvar never equals a certain value or falls within a specified range of values, use the "OUT" type.  For example, "PB_SV_CVAR handicap OUT 0" means that each player's handicap cvar must never equal 0 on your game server.  Issuing "PB_SV_CVAR handicap OUT 11 99" means that handicap must never fall inside the 11 to 99 range (inclusive).

PB_SV_CVAR [cvar_name] INCLUDE [text]
If you wish to require that a particular cvar always includes the specified [text] inside its value, use the "INCLUDE" type.  For example, "PB_SV_CVAR r_drawbuffer INCLUDE gl_back" means that each player's r_drawbuffer cvar must always have the text "gl_back" somewhere in the value.

PB_SV_CVAR [cvar_name] EXCLUDE [text]
If you wish to require that a particular cvar never includes the specified [text] inside its value, use the "EXCLUDE" type.  For example, "PB_SV_CVAR name EXCLUDE ^" means that each player's name cvar must never have the text "^" somewhere in the value (note: the ^ symbol is used to change text colors so using the example would mean that no one could put fancy colors in their playing name on your server without getting kicked once detected by PunkBuster).



Assuming this stuff actually works, I will decide what to do if a player violates ones of these.  For now I have it to just report the violation or set the dvar within a valid range.

No comments:

Post a Comment