AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   return a client cvar (https://forums.alliedmods.net/showthread.php?t=75127)

the1991 07-30-2008 20:28

return a client cvar
 
so i was looking at fullupdate_blocker and what the plugin does is binds over the fullupdate command with a new function so that a player cannot use fullupdate.
Code:

register_clcmd("fullupdate","fullupdate")
if i wanted to make it so that i could restore normal use of fullupdate, what command would i use to "rebind" it to the regular client cvar.

Drak 07-31-2008 13:55

Re: return a client cvar
 
Well if that command is registered like that, you couldn't restore it. Because the command would always be "fullupdate".
You can just make a CVar that can disable/enable the use of it.

the1991 07-31-2008 19:47

Re: return a client cvar
 
that would be a good alternative, but how does one disable a cvar? i guess you can catch the command with client_command, but then how do you keep the command from being executed? sorry if i'm ignorant...i'm only just learning these modules. :)

Drak 07-31-2008 20:30

Re: return a client cvar
 
Code:
#include <amxmodx> new p_Enable public plugin_int() {     register_plugin("Block Fullupdate","0.1a","Drak");     p_Enable = register_cvar("amx_blockfullupdate","1"); } public client_command(id) {     if(get_pcvar_num(p_Enable))     {         new Command[33]         read_argv(0,Command,32);         if(equal(Command,"fullupdate"))             return PLUGIN_HANDLED_MAIN     } }

This should work, not sure. But "amx_blockfullupdate 1/0" will enable disable the usage of it.

the1991 08-01-2008 15:21

Re: return a client cvar
 
well done sir! that's a very useful bit of code to me. a quick question about client_command. what exactly triggers it. for instance, does any client cvar change go to that function. does something like a weapon drop?

Drak 08-01-2008 16:57

Re: return a client cvar
 
Quote:

Originally Posted by the1991 (Post 663001)
well done sir! that's a very useful bit of code to me. a quick question about client_command. what exactly triggers it. for instance, does any client cvar change go to that function. does something like a weapon drop?

Only commands trigger it. Client-Side CVars will not trigger that function.
And because weapon drop ("drop") is a command, that would trigger it.

hasta 01-19-2009 09:29

Re: return a client cvar
 
error when compil
Quote:

home/groups/amxmodx/tmp3/textjnGOie.sma(20) : warning 209: function "client_command" should return a value
how ti fix?

Exolent[jNr] 01-19-2009 12:23

Re: return a client cvar
 
Code:
#include <amxmodx> new p_Enable public plugin_int() {     register_plugin("Block Fullupdate","0.1a","Drak");     p_Enable = register_cvar("amx_blockfullupdate","1"); } public client_command(id) {     if(get_pcvar_num(p_Enable))     {         new Command[33]         read_argv(0,Command,32);         if(equal(Command,"fullupdate"))             return PLUGIN_HANDLED_MAIN     }     return PLUGIN_CONTINUE }

dRk13 05-26-2009 12:53

Re: return a client cvar
 
and if i want to make the same with cl_pitchspeed? can I?

Exolent[jNr] 05-26-2009 16:12

Re: return a client cvar
 
cl_pitchspeed is a cvar, so it cannot be detected as a command.
You will need to use a cvar enforcing plugin.


All times are GMT -4. The time now is 05:29.

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