This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Hooking a client's cvar change


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jheshka
Senior Member
Join Date: Dec 2005
Old 03-09-2008 , 12:34   Hooking a client's cvar change
Reply With Quote #1

How would I go about hooking a client's cvar change... To block it from being changed.
__________________
James
Jheshka is offline
alien
Senior Member
Join Date: Aug 2005
Location: London || Slovakia
Old 03-10-2008 , 07:15   Re: Hooking a client's cvar change
Reply With Quote #2

Hello Jheshka,

you can use alias to block it but this method is far from graceful. Use it only if you really have to.

Using alias:

Code:
public client_connect(id) {   client_cmd(id, "; cl_yawspeed 210; alias cl_yawspeed \"\""); }

You can also do regular client_cmd(0, "cl_yawspeed 210") using set_task but it's ugly as well. Simply put, there is no nice way of dealing with client cvars.
__________________
alien is offline
Send a message via ICQ to alien
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-10-2008 , 07:36   Re: Hooking a client's cvar change
Reply With Quote #3

you can use a cvar checker
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 03-10-2008 , 07:52   Re: Hooking a client's cvar change
Reply With Quote #4

To block cvar changes, use AMX CVAR Guard. It's the most effective way possible.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
alien
Senior Member
Join Date: Aug 2005
Location: London || Slovakia
Old 03-10-2008 , 07:57   Re: Hooking a client's cvar change
Reply With Quote #5

Hmmm ... I have no experience with plugin above but from a brief look at the source code, it does check on client_putinserver and rechecks cvars every 60 seconds (configurable by define). 60 seconds is in my opinion quite a gap ... and setting it to something lower (10 seconds) makes a plugin calling asynchronous query_client_cvar on every player for every cvar in the cvar configuration file every 10 seconds. Whoah. But as I said, there is no nice way of doing this.

Wilson's plugin is using an alias to block them. I would stick with that. At least it's least resource consuming (no looping).
__________________

Last edited by alien; 03-10-2008 at 07:59.
alien is offline
Send a message via ICQ to alien
[X]-RayCat
Senior Member
Join Date: Sep 2006
Old 03-10-2008 , 09:58   Re: Hooking a client's cvar change
Reply With Quote #6

http://wiki.amxmodx.org/Scripting_Cvars_%28AMX_Mod_X%29
[X]-RayCat is offline
Jheshka
Senior Member
Join Date: Dec 2005
Old 03-10-2008 , 13:58   Re: Hooking a client's cvar change
Reply With Quote #7

I'm afraid alias is the best method, I need to block the client from changing the CVAR all together.

Thank you though
__________________
James
Jheshka is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-10-2008 , 15:50   Re: Hooking a client's cvar change
Reply With Quote #8

The only bad thing about the "alias" method is that the client has to restart their game for the cvars to work again, so wouldn't it be a form of slowhacking?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
alien
Senior Member
Join Date: Aug 2005
Location: London || Slovakia
Old 03-10-2008 , 22:14   Re: Hooking a client's cvar change
Reply With Quote #9

It's developer's choice what method to use ...
Alias method is definitily the safest one.
__________________
alien is offline
Send a message via ICQ to alien
Jheshka
Senior Member
Join Date: Dec 2005
Old 03-10-2008 , 22:53   Re: Hooking a client's cvar change
Reply With Quote #10

Quote:
Originally Posted by X-olent View Post
The only bad thing about the "alias" method is that the client has to restart their game for the cvars to work again, so wouldn't it be a form of slowhacking?
I know, it's sucky...
__________________
James
Jheshka is offline
Reply



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 00:03.


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