AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Client Cvar Rules (https://forums.alliedmods.net/showthread.php?t=18769)

PM 10-01-2005 16:58

Client Cvar Rules
 
1 Attachment(s)
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.

nightscreem 10-01-2005 17:06

cool nice job
good plugin

BAILOPAN 10-01-2005 17:17

This is really quite powerful :o very nice

neggard 10-02-2005 17:18

What is the differens in this plugin, HLGuard have this already.

PM 10-03-2005 14:05

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.

onosrider 10-07-2005 07:13

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.

.MechanimaL. 10-17-2005 19:40

very nice plugin! good job!

8)

could you add the feature, to show the client which values are allowed in his "kicked ... " notice ?

EKS 10-18-2005 14:36

Nice plugin like allways PM

Little Chang 10-19-2005 17:38

This plugin is outstanding, thanks PM

Danni 10-29-2005 11:56

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



All times are GMT -4. The time now is 07:19.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.