Raised This Month: $114 Target: $400
 28% 

Client Cvar Rules


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   General Purpose        Approver:   BAILOPAN (72)
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 10-01-2005 , 17:58   Client Cvar Rules
Reply With Quote #1

Hello.

Today I'd like to release a plugin which I've written a long time ago in order to test the "query client cvar value" functionality of newer AMX Mod X versions.

As the name says, the plugin lets you specify rules for client cvars.

NOTE: Requires AMXx >= 1.56 (1.60 will work, as it says >=). Also, your server has to be up-to-date (have Valve's august-engine-update), otherwise you'll probably get either a lot of runtime errors or crashes.

The plugin registers one server command: amx_cvarrules.

USAGE
Every command also has a shorter alias (? for list, + for add, - for del)

Code:
amx_cvarrules list
amx_cvarrules ?
lists all registered rules


Code:
amx_cvarrules add RULE
amx_cvarrules + RULE
adds a rule


Code:
amx_cvarrules del RULE ID
amx_cvarrules - RULE ID
removes a rule by its id (printed by amx_cvarrules list)


Code:
amx_cvarrules del CVAR
amx_cvarrules - CVAR
removes all rules for the specified cvar.


amx_cvarrules add accepts the rule definition in an interesting format.
Code:
amx_cvarrules add CVAR OPERATOR COMPARE_VALUE more stuff
Let's look at an example:
Code:
amx_cvarrules add ex_interp !f 0.1
Here, the CVAR is ex_interp. The OPERATOR is !f, which is "not equal; compare as float". The COMPARE_VALUE is 0.1. There is no more stuff, so the default behaviour for the !f operator is:
If the user is found with a value different than 0.1, set it to 0.1 for him, and log it to the server logs. If it happens again on that user, log it again and kick him.

You can specify after how many "failed queries" logging/kicking/"shouting" should occur:
Code:
amx_cvarrules add ex_interp !f 0.1 shout1 log1 kick3
This makes the plugin "shout" when the first query fails. This means that it informs all players in the server that the client was found with ex_interp not set to (some value). It starts logging there as well, but kicks the user on the third failed query. Setting any of these to 0 disables them. The default is shout0 log1 kick2.

There's also an other interesting flag:
Code:
amx_cvarrules add ex_interp !f 0.1 dis
dis stands for "disable". This means that when the client has the right value set, it makes the cvar unchangable for him until he restarts HL. Of course, you can mix dis, shout, log, kick, or whatever.

There are more operators.
Code:
=   equal (compare as text)
=f  equal (compare as number)
=c  equal (compare as text, ignore case)
!   not equal (compare as text)
!f  not equal (compare as number)
!c  not equal (compare as text, ignore case)
<   less (compare as number)
>   greater (compare as number)
<=  less or equal (compare as number)
>=  greater or equal (compare as number)
The operators !, !f, !c, < and > have default "fallback values". A fallback value is the value the plugin will try to set the cvar to if the query fails. The default fallback value for these operators is the compare value you pass (as we've seen earlier). For the other operators, you have to set a fallback value yourself (of course, you can set your own fallback value for !, !f, !c, < and > as well). Or you can disable the fallback value altogether.

Setting the fallback value works like this:
Code:
ex_interp =f 0.05 @ 0.1
I don't know why anyone would to this, but it means: If ex_interp is set to 0.05, set it to 0.1.

Disabling the fallback value works like this:
Code:
ex_interp !f !
You may want to use this for whatever reason. You'd maybe set kick0 or kick1 then.


By the way, note that amx_cvarrules add checks for duplicates of the same rule, so it's safe to use it in a file like config.cfg, which may possibly be executed more than once.

Well anyway, have fun.

EDIT: Yes, the plugin won't compile, because the web-compiler doesn't have the latest includes yet. Download the .sma and compile it on your own. Mwahahahah!!AHAHAHAH1h1AHAhahQHqha.

EDIT2: BAIL has phixed the web-compiler.
Attached Files
File Type: sma Get Plugin or Get Source (cvarrules.sma - 5299 views - 20.2 KB)
__________________
hello, i am pm
PM is offline
nightscreem
Veteran Member
Join Date: Jul 2004
Location: Belgium
Old 10-01-2005 , 18:06  
Reply With Quote #2

cool nice job
good plugin
__________________
- Bye bye!
nightscreem is offline
BAILOPAN
Join Date: Jan 2004
Old 10-01-2005 , 18:17  
Reply With Quote #3

This is really quite powerful very nice
__________________
egg
BAILOPAN is offline
neggard
Member
Join Date: Mar 2004
Location: Sweden
Old 10-02-2005 , 18:18  
Reply With Quote #4

What is the differens in this plugin, HLGuard have this already.
neggard is offline
Send a message via MSN to neggard
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 10-03-2005 , 15:05  
Reply With Quote #5

Quote:
Originally Posted by neggard
What is the differens in this plugin, HLGuard have this already.
I've got no idea what HLGuard has or doesn't have, sorry.
Besides, you may only want to enforce a cvar and not run HLGuard.
__________________
hello, i am pm
PM is offline
onosrider
Member
Join Date: Jul 2005
Old 10-07-2005 , 08:13  
Reply With Quote #6

dosen't work with amxx 1.60 and natural-selection. about 10 or 20 seconds after map/roundstat the server crashes. testet on ns 3.05 linux and win32 too.
onosrider is offline
.MechanimaL.
New Member
Join Date: Oct 2005
Old 10-17-2005 , 20:40  
Reply With Quote #7

very nice plugin! good job!



could you add the feature, to show the client which values are allowed in his "kicked ... " notice ?
.MechanimaL. is offline
EKS
Veteran Member
Join Date: Mar 2004
Location: Norway
Old 10-18-2005 , 15:36  
Reply With Quote #8

Nice plugin like allways PM
__________________
Github archive for plugins, the repos for the other c++ projects are there to.
EKS is offline
Little Chang
Junior Member
Join Date: May 2004
Location: Denmark
Old 10-19-2005 , 18:38  
Reply With Quote #9

This plugin is outstanding, thanks PM
Little Chang is offline
Danni
Junior Member
Join Date: Jan 2005
Old 10-29-2005 , 12:56  
Reply With Quote #10

If I change a cvar in game, the new value is not detected, and i can contune playing with a value that my rules should detect and fix. It works fine when i connect initialy, it detects and forces a normal value, but 10 mins into the game, i can change and go undetected.

Code:
amx_cvarrules add ex_interp !f 0.1 shout1 log1 kick3
amx_cvarrules add ex_extrapmax !f 1.2 shout1 log1 kick3

amx_cvarrules add _cl_minimap !f 2 shout1 log1 kick3
amx_cvarrules add cl_fog !f 0 shout1 log1 kick3

amx_cvarrules add r_fullbright !f 0 shout1 log1 kick3
amx_cvarrules add gl_monolights !f 0 shout1 log1 kick3
amx_cvarrules add gl_overbright !f 0 shout1 log1 kick3
Danni is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:55.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode