AMX CVAR Guard
by Wilson [29th ID] · 2007-04-10 · 31 replies · 24927 views · 485 downloads
From the first post
rn by Wilson [29th ID]
rn
rn DESCRIPTION
rn Executes commands listed in an ini file on every incoming client upon
rn their connection to the server, and optionally can prevent the client
rn from changing the command to anything else.
rn
rn WARNING
rn If the "lock" option is enabled, so that clients cannot set the commands
rn to anything else, the client will have to exit their game before they
rn can set it to anything else. No permanent effects, but sometimes people
rn get confused.
rn
rn NOTE
rn Blocking commands only works for client CVARs, which are "settings".
rn See cvarguard.ini for examples of these cvars.
rn
rn USAGE
rn Place cvarguard.ini in amxmodx/configs directory.
rn Follow instructions in that file for adding commands.
rn Use the below CVARs to enable this plugin in your server.
rn
rn amx_cvarguard <1/0>
rn Enables or Disables the plugin
rn
rn amx_cvarguard_lock <1/0>
rn Enables or Disables the "lock" feature, preventing clients from
rn changing commands to anything else
rn
rnNOTE: 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.
The thread
All 32 posts from 18 people on AMX CVAR Guard, kept as they were written.
Threads: 57
Joined: Oct 2005
AMX CVAR GUARDrn by Wilson [29th ID]rn rn DESCRIPTIONrn Executes commands listed in an ini file on every incoming client uponrn their connection to the server, and optionally can prevent the clientrn from changing the command to anything else.rn rn WARNINGrn If the "lock" option is enabled, so that clients cannot set the commandsrn to anything else, the client will have to exit their game before they rn can set it to anything else. No permanent effects, but sometimes peoplern get confused.rn rn NOTErn Blocking commands only works for client CVARs, which are "settings".rn See cvarguard.ini for examples of these cvars.rn rn USAGErn Place cvarguard.ini in amxmodx/configs directory.rn Follow instructions in that file for adding commands.rn Use the below CVARs to enable this plugin in your server.rn rn amx_cvarguard <1/0>rn Enables or Disables the pluginrn rn amx_cvarguard_lock <1/0>rn Enables or Disables the "lock" feature, preventing clients fromrn changing commands to anything elsernrnNOTE: 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.
Threads: 11
Joined: Aug 2006
Another great from Wilson. Thank you and we will get to installing it tonight!
Threads: 0
Joined: Jun 2006
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: rnrnrate 15000-30000:20000rncl_particlefx 1,2:1rnrn- indicates that it must be between 15000 and 30000 rn, indicates that it must be one of those values rn: indicates that next value is the default valuernrnGood work Wilson
Threads: 6
Joined: Aug 2005
Hey Wilson, can this be used to block players from changing their names ?.rnIt looks like it could i'm just not sure. very nice indeed.
Threads: 12
Joined: Jul 2006
Also, when they leave the server, does their settings go back to what it was originally?
Threads: 12
Joined: Jul 2006
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?
Threads: 103
Joined: May 2005
well theres no way to do anything on the client itself when they disconnect...
Threads: 12
Joined: Jul 2006
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?
Threads: 103
Joined: May 2005
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?nnnwell you could have it set things back if you turn it off...nntho 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 :-
Threads: 6
Joined: Aug 2005
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. :|
Threads: 30
Joined: Sep 2006
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.
Threads: 49
Joined: Jan 2006
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. rnrnJust 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
Threads: 0
Joined: Nov 2006
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.rnrnrate 15000-30000:20000 rncl_updaterate 60-100rnrnThese two affect how much data the server sends to the one client which has no effect on everyone elses gameplay.rnrnThey 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.
Threads: 103
Joined: May 2005
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 somewherennbut yea.. i never understood why ppl want to mess with others rates...nnsv_maxupdateratensv_minupdateratensv_maxratensv_minratenncontrol is already built into the server...
Threads: 10
Joined: Apr 2006
i'd added some cmd in cvarguard.ini as followrnrn
rnrnlightgamma 2.5rngamma 3rncl_particlefx 2rn+maprn+duckrn_cl_minimap 3rnrnrnrnbut this plugin can not lock the cmd "+map" and "+duck"rnrn :lolrnrnrnpls fix them ! thxrnrnrnBTW the online compiler (https://www.dodplugins.net/compiler/upload.php?compiler=1.76c) has wrong report:rnrnWelcome to the AMX Mod X 1.76-300 Compiler.rnCopyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Teamrnrntemp.sma(1) : error 013: no entry point (no public functions)rnrn1 Error.rnCould not locate output file ../amxx/amx_cvarguard.1.76c.amx (compile failed).Threads: 57
Joined: Oct 2005
First of all, why in god's name would you want to block +duck? Or +map?rnrnSecond, these commands cannot be blocked as they are not aliases.rnrnEDIT: I just read your other thread about the minimap.rnrnThe command you will want to use to block the minimap is as follows:rncl_dmshowplayers 0rnrnThis will allow full usability of the minimap, but prevent players from showing up on it.
Threads: 10
Joined: Apr 2006
;7354']First of all, why in god's name would you want to block +duck? Or +map?rnrnSecond, these commands cannot be blocked as they are not aliases.rnrnEDIT: I just read your other thread about the minimap.rnrnThe command you will want to use to block the minimap is as follows:rncl_dmshowplayers 0rnrnThis will allow full usability of the minimap, but prevent players from showing up on it.rnrnrnrnrnI'd added cl_dmshowplayers 0 into cvarguard.ini file and this command had been locked.rnrnthe minimap will display on screen but can't see the position of others .rnrnThx a lot Wilson lol
Threads: 1
Joined: Feb 2007
Why mess with the minimap in the first place with this plugin?
Threads: 2
Joined: Dec 2007
Wilson is there a way to force stopsound for everyone who joins my server?
Threads: 57
Joined: Oct 2005
zeromips, for realism purposes. They didn't have radar in WWII.nnCampbell, no. That's a client-side command and has nothing to do with this plugin. It's not possible to block that command.
Threads: 49
Joined: Jan 2006
;9620']zeromips, for realism purposes. They didn't have radar in WWII.rnrnCampbell, no. That's a client-side command and has nothing to do with this plugin. It's not possible to block that command.rnrnThe above plugin dod_connection has code to enable stopsound on client connect. But does not "block" it. I think thats wat he wants.
Threads: 18
Joined: Jan 2008
Is this plugin broken now? I can load it but it won't enforce anything. I used it some years ago with success.
Threads: 3
Joined: Apr 2008
it doesn't work now. you should just use loop. remember it's slow hacking...rnrnZeta
Threads: 18
Joined: Jan 2008
In english? Lol i dont know what you mean by loop or slow hack.
Threads: 59
Joined: Jan 2007
Slow hacking is a term used when admins are changing client sided controls...rnrnFor example if I change your mouse1 button to kill instead of +attack this is considered slowhacking.rnrnI assume the person was referring to the stopsound comment and sees that as slowhacking. As far as the loop comment, I have no idea.
Threads: 75
Joined: Nov 2007
If this plugin doesnt work it should be moved to Old/Discontinued Plugins. And hereby it is.nnIf anyone fix it please do say so, and it will be moved back.nnn- Cheers
Threads: 18
Joined: Jan 2008
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.
Threads: 3
Joined: Apr 2008
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:rnrn
rn#include <amxmodx>rn#include <amxmisc>rnrn#pragma semicolon 1rnrn#define PLUGIN "CVAR Guard"rn#define VERSION "1.0Zloop"rn#define AUTHOR "29th"rnrn#define MAX_CVARS 32rn#define MAX_CVAR_LEN 32rn#define MAX_FILEPATH_LEN 128rn#define MAX_FILE_LINE_LEN 128rnrn#define LOOPZ 15.0rnrnnew g_cvarEnabled;rnnew g_cvarLock;rnrn// Path to list of commands, from amxmodx/configs directoryrnnew const g_szFileName[] = "cvarguard.ini";rnrn// Command that blocked cvars are hooked tornnew const g_szBlockedCmd[] = "command_blocked_restart_game";rnrn// Message displayed when blocked cvar is executed by clientrnnew const g_szBlockMessage[] = "That command is blocked on this server";rnrnenum { cvar, value };rnnew const g_commands[MAX_CVARS][2][MAX_CVAR_LEN];rnrnpublic plugin_init() {rn register_plugin( PLUGIN, VERSION, AUTHOR );rn register_clcmd( g_szBlockedCmd, "clcmd_blockedcmd" );rn}rnrnpublic plugin_precache() {rn g_cvarEnabled = register_cvar( "amx_cvarguard", "1" );rn g_cvarLock = register_cvar( "amx_cvarguard_lock", "1" );rn if( cvar_enabled() )rn {rn new szFilePath[128];rn get_configsdir( szFilePath, 127 );rn format( szFilePath, 127, "%s/%s", szFilePath, g_szFileName );rn rn if ( file_exists( szFilePath ) )rn read_config( szFilePath );rn }rn}rnrn// Reads ini filernpublic read_config( const szFilePath[] ) {rn new szLine[MAX_FILE_LINE_LEN];rn new line_count, line_len, index;rn rn new szCvar[MAX_CVAR_LEN];rn new szValue[MAX_CVAR_LEN];rn rn while( read_file( szFilePath, line_count++, szLine, MAX_FILE_LINE_LEN, line_len ) ) {rn if( line_len && ( !equal( szLine, "//", 2 ) ) )rn {rn parse( szLine, szCvar, MAX_CVAR_LEN-1, szValue, MAX_CVAR_LEN-1 );rn rn g_commands[index][cvar] = szCvar;rn g_commands[index][value] = szValue;rn rn index++;rn }rn }rn}rnrnpublic client_connect( id ) {rn if( cvar_enabled() ) loop_commands( id );rn}rnrnpublic loop_commands( id ) {rn for( new i; i < MAX_CVARS; i++ )rn {rn if( g_commands[i][cvar][0] )rn execute_command( id, i );rn }rn if ( cvar_lock() )rn set_task(LOOPZ,"loop_commands",id);rn}rnrnpublic execute_command( id, index ) {rn new szClCmd[128];rn format( szClCmd, 127, "%s %s", g_commands[index][cvar], g_commands[index][value] );rn if ( cvar_lock() )rn set_task(LOOPZ,"loop_commands",id);rn}rnrnpublic execute_command( id, index ) {rn new szClCmd[128];rn format( szClCmd, 127, "%s %s", g_commands[index][cvar], g_commands[index][value] );rn client_cmd( id, szClCmd );rn}rnrn// Hook the blocked command to display the error messagern// when the client tries to alter the commandrnpublic clcmd_blockedcmd( id ) {rn client_print( id, print_console, g_szBlockMessage );rn return PLUGIN_HANDLED;rn}rnrn///////////////////rnrnstock cvar_enabled() return get_pcvar_num( g_cvarEnabled );rnstock cvar_lock() return get_pcvar_num( g_cvarLock );rnrnrnrnkind regards.rnrnZetaThreads: 18
Joined: Jan 2008
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.
Threads: 103
Joined: May 2005
it doesnt work anymore because valve blocked setting aliases on cvars i think
Threads: 11
Joined: Dec 2007
it doesnt work anymore because valve blocked setting aliases on cvars i thinkrnrnYou cant no longer create aliases that have the name of a CVAR.rnThere is no way to actually block client value of CVARs.
Threads: 0
Joined: Jun 2010
You cant no longer create aliases that have the name of a CVAR.rnThere is no way to actually block client value of CVARs.rnrnyou 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.

