PDA

View Full Version : AMX CVAR Guard


Wilson [29th ID]
04-10-2007, 04:17 AM
AMX CVAR GUARD
by Wilson [29th ID]

DESCRIPTION
Executes commands listed in an ini file on every incoming client upon
their connection to the server, and optionally can prevent the client
from changing the command to anything else.

WARNING
If the "lock" option is enabled, so that clients cannot set the commands
to anything else, the client will have to exit their game before they
can set it to anything else. No permanent effects, but sometimes people
get confused.

NOTE
Blocking commands only works for client CVARs, which are "settings".
See cvarguard.ini for examples of these cvars.

USAGE
Place cvarguard.ini in amxmodx/configs directory.
Follow instructions in that file for adding commands.
Use the below CVARs to enable this plugin in your server.

amx_cvarguard <1/0>
Enables or Disables the plugin

amx_cvarguard_lock <1/0>
Enables or Disables the "lock" feature, preventing clients from
changing commands to anything else

NOTE: This is not another "looping client_cmd" plugin. This uses a way to redefine client cvars so that the setting they control cannot be changed.

tegu
04-10-2007, 10:48 AM
Another great from Wilson. Thank you and we will get to installing it tonight!

mantk
04-12-2007, 02:04 PM
It’s possible to modify the plugin to verify that cvars is in a rank of values and in case that isn’t change to a default value, examples:

rate 15000-30000:20000
cl_particlefx 1,2:1

- indicates that it must be between 15000 and 30000
, indicates that it must be one of those values
: indicates that next value is the default value

Good work Wilson

jondoe
04-13-2007, 05:14 AM
Hey Wilson, can this be used to block players from changing their names ?.
It looks like it could i'm just not sure. very nice indeed.

Kiel |17.SS|
04-13-2007, 08:31 PM
Also, when they leave the server, does their settings go back to what it was originally?

Kiel |17.SS|
04-14-2007, 01:05 AM
Ah, I just tested it, and it doesn't go back to what it origionally was. Is it possible though to make it a toggle?

diamond-optic
04-14-2007, 09:09 PM
well theres no way to do anything on the client itself when they disconnect...

Kiel |17.SS|
04-14-2007, 09:39 PM
So you can't have it so when the client leaves, it'll just return to normal, or when the plugin is turned off, it goes back to normal?

diamond-optic
04-14-2007, 09:57 PM
So you can't have it so when the client leaves, it'll just return to normal, or when the plugin is turned off, it goes back to normal?


well you could have it set things back if you turn it off...

tho the plugin would have to query each cvar from each player when they connect.. save them to variables.. then probably have to use a command to turn it off (not just setting a cvar to 0 or anything) to trigger resetting the clients settings to whats saved in the variable.. tho again.. it would only work for players who are still connected.. and the cvar query doesnt always work all that well :-\

jondoe
04-14-2007, 11:21 PM
I'm looking for a simple plugin that will not allow anyone to change their name once they enter my servers. I have players come in a change there names 4 or 5 times or more while playing in my servers. this has got to stop. :|

MBosta
05-02-2007, 10:33 PM
yea this works great, for an update, i'd love for it have a range, like cl_updaterate 60-100, and it would pick from between there.

sparky99
06-15-2007, 02:45 AM
HLguard has that ability for a range of settings. Its a bit of a pain to set up using the supplied defaults seem to be for CS. But if you D/L the latest Cvar configs and do some editing for DoD you should be right.

Just go to the FORUMS for the latest stuff not the D/L link on the home page and be prepared to be kicked untill you get it just right

Antihax
06-15-2007, 12:31 PM
Yay, another plugin to allow server admins to screw with peoples rates. Please don't use this plugin for rate enforcement, the servers already offer that with normal config settings, leave users rates settings alone. I already see two posts with stupid settings.

rate 15000-30000:20000
cl_updaterate 60-100

These two affect how much data the server sends to the one client which has no effect on everyone elses gameplay.

They probably don't even realise the one people complain about when a user is "rating" and skipping everywhere is cl_rate, not rate, and you cannot adjust that one remotely.

diamond-optic
06-16-2007, 09:14 PM
ive been under the impression that cl_rate was phased out and no longer actually used and only rate is.. at least im pretty sure it says that around the steam forums somewhere

but yea.. i never understood why ppl want to mess with others rates...

sv_maxupdaterate
sv_minupdaterate
sv_maxrate
sv_minrate

control is already built into the server...

knife108
08-29-2007, 07:57 AM
i'd added some cmd in cvarguard.ini as follow



lightgamma 2.5
gamma 3
cl_particlefx 2
+map
+duck
_cl_minimap 3



but this plugin can not lock the cmd "+map" and "+duck"

:lol


pls fix them ! thx


BTW the online compiler (http://www.dodplugins.net/compiler/upload.php?compiler=1.76c) has wrong report:

Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

temp.sma(1) : error 013: no entry point (no public functions)

1 Error.
Could not locate output file ../amxx/amx_cvarguard.1.76c.amx (compile failed).

Wilson [29th ID]
08-29-2007, 10:55 AM
First of all, why in god's name would you want to block +duck? Or +map?

Second, these commands cannot be blocked as they are not aliases.

EDIT: I just read your other thread about the minimap.

The command you will want to use to block the minimap is as follows:
cl_dmshowplayers 0

This will allow full usability of the minimap, but prevent players from showing up on it.

knife108
08-29-2007, 02:11 PM
;7354']First of all, why in god's name would you want to block +duck? Or +map?

Second, these commands cannot be blocked as they are not aliases.

EDIT: I just read your other thread about the minimap.

The command you will want to use to block the minimap is as follows:
cl_dmshowplayers 0

This will allow full usability of the minimap, but prevent players from showing up on it.




I'd added cl_dmshowplayers 0 into cvarguard.ini file and this command had been locked.

the minimap will display on screen but can't see the position of others .

Thx a lot Wilson lol

zeromips
09-01-2007, 10:08 PM
Why mess with the minimap in the first place with this plugin?

Campbell [82nd AB]
04-02-2008, 12:03 PM
Wilson is there a way to force stopsound for everyone who joins my server?

Wilson [29th ID]
04-03-2008, 10:38 AM
zeromips, for realism purposes. They didn't have radar in WWII.

Campbell, no. That's a client-side command and has nothing to do with this plugin. It's not possible to block that command.

sparky99
04-04-2008, 09:53 PM
;9620']zeromips, for realism purposes. They didn't have radar in WWII.

Campbell, no. That's a client-side command and has nothing to do with this plugin. It's not possible to block that command.

The above plugin dod_connection has code to enable stopsound on client connect. But does not "block" it. I think thats wat he wants.

Kristiansen
01-05-2010, 03:11 PM
Is this plugin broken now? I can load it but it won't enforce anything. I used it some years ago with success.

webmaze
01-05-2010, 09:29 PM
it doesn't work now. you should just use loop. remember it's slow hacking...

Zeta

Kristiansen
01-05-2010, 11:28 PM
In english? Lol i dont know what you mean by loop or slow hack.

Tank
01-06-2010, 08:02 AM
Slow hacking is a term used when admins are changing client sided controls...

For example if I change your mouse1 button to kill instead of +attack this is considered slowhacking.

I assume the person was referring to the stopsound comment and sees that as slowhacking. As far as the loop comment, I have no idea.

Dr.G
01-06-2010, 11:10 AM
If this plugin doesnt work it should be moved to Old/Discontinued Plugins. And hereby it is.

If anyone fix it please do say so, and it will be moved back.


- Cheers

Kristiansen
01-06-2010, 12:21 PM
Ah yeah I'm not using it for stopsound and it cannot be used for that either, it's forcing CVARs on the client. I just want to force something during certain gameplays such as removing icons over their head.

webmaze
01-07-2010, 10:40 AM
a couple of moths ago, i can't remember how many, one of valve's updates broke this plugin. this is what is use to disable dubious scripts and a couple more cvars. it works sending the commands every X time to all clients, over and over. it's a very dirty dirty hack of the original plugin, but it works:


#include <amxmodx>
#include <amxmisc>

#pragma semicolon 1

#define PLUGIN "CVAR Guard"
#define VERSION "1.0Zloop"
#define AUTHOR "29th"

#define MAX_CVARS 32
#define MAX_CVAR_LEN 32
#define MAX_FILEPATH_LEN 128
#define MAX_FILE_LINE_LEN 128

#define LOOPZ 15.0

new g_cvarEnabled;
new g_cvarLock;

// Path to list of commands, from amxmodx/configs directory
new const g_szFileName[] = "cvarguard.ini";

// Command that blocked cvars are hooked to
new const g_szBlockedCmd[] = "command_blocked_restart_game";

// Message displayed when blocked cvar is executed by client
new const g_szBlockMessage[] = "That command is blocked on this server";

enum { cvar, value };
new const g_commands[MAX_CVARS][2][MAX_CVAR_LEN];

public plugin_init() {
register_plugin( PLUGIN, VERSION, AUTHOR );
register_clcmd( g_szBlockedCmd, "clcmd_blockedcmd" );
}

public plugin_precache() {
g_cvarEnabled = register_cvar( "amx_cvarguard", "1" );
g_cvarLock = register_cvar( "amx_cvarguard_lock", "1" );
if( cvar_enabled() )
{
new szFilePath[128];
get_configsdir( szFilePath, 127 );
format( szFilePath, 127, "%s/%s", szFilePath, g_szFileName );

if ( file_exists( szFilePath ) )
read_config( szFilePath );
}
}

// Reads ini file
public read_config( const szFilePath[] ) {
new szLine[MAX_FILE_LINE_LEN];
new line_count, line_len, index;

new szCvar[MAX_CVAR_LEN];
new szValue[MAX_CVAR_LEN];

while( read_file( szFilePath, line_count++, szLine, MAX_FILE_LINE_LEN, line_len ) ) {
if( line_len && ( !equal( szLine, "//", 2 ) ) )
{
parse( szLine, szCvar, MAX_CVAR_LEN-1, szValue, MAX_CVAR_LEN-1 );

g_commands[index][cvar] = szCvar;
g_commands[index][value] = szValue;

index++;
}
}
}

public client_connect( id ) {
if( cvar_enabled() ) loop_commands( id );
}

public loop_commands( id ) {
for( new i; i < MAX_CVARS; i++ )
{
if( g_commands[i][cvar][0] )
execute_command( id, i );
}
if ( cvar_lock() )
set_task(LOOPZ,"loop_commands",id);
}

public execute_command( id, index ) {
new szClCmd[128];
format( szClCmd, 127, "%s %s", g_commands[index][cvar], g_commands[index][value] );
if ( cvar_lock() )
set_task(LOOPZ,"loop_commands",id);
}

public execute_command( id, index ) {
new szClCmd[128];
format( szClCmd, 127, "%s %s", g_commands[index][cvar], g_commands[index][value] );
client_cmd( id, szClCmd );
}

// Hook the blocked command to display the error message
// when the client tries to alter the command
public clcmd_blockedcmd( id ) {
client_print( id, print_console, g_szBlockMessage );
return PLUGIN_HANDLED;
}

///////////////////

stock cvar_enabled() return get_pcvar_num( g_cvarEnabled );
stock cvar_lock() return get_pcvar_num( g_cvarLock );



kind regards.

Zeta

Kristiansen
01-09-2010, 01:44 PM
As a side note, I might add that it seems as the original plugin does change the client's cvars, its the "lock" feature that is out of order. The cvars can be changed back by the client.

diamond-optic
01-10-2010, 06:15 PM
it doesnt work anymore because valve blocked setting aliases on cvars i think

h0_noMan
04-02-2010, 08:50 PM
it doesnt work anymore because valve blocked setting aliases on cvars i think

You cant no longer create aliases that have the name of a CVAR.
There is no way to actually block client value of CVARs.

incubus
06-02-2010, 01:35 PM
You cant no longer create aliases that have the name of a CVAR.
There is no way to actually block client value of CVARs.

you dont need aliases, Just make the plugin loop but only have it check like once every 40 seconds and then force the cvars that you want.