Raised This Month: $51 Target: $400
 12% 

Solved [HELP] Getting Player's Sensitivity Setting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hellmonja
Senior Member
Join Date: Oct 2015
Old 01-08-2018 , 07:57   [HELP] Getting Player's Sensitivity Setting
Reply With Quote #1

How do you get a players mouse sensitivity? I did it like this:
PHP Code:
cvar_sensitivity get_cvar_pointer("sensitivity"); 
Then try to retrieve it:
PHP Code:
get_pcvar_num(cvar_sensitivity); 
But it always returns "0" where as my setting is "3"...
__________________

Last edited by hellmonja; 01-24-2018 at 10:14. Reason: Nirvana's 2nd studio album...
hellmonja is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-08-2018 , 08:11   Re: [HELP] Getting Player's Sensitivity Setting
Reply With Quote #2

query_client_cvar maybe. What you did works only for server cvars.
__________________

Last edited by HamletEagle; 01-08-2018 at 08:11.
HamletEagle is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-08-2018 , 08:25   Re: [HELP] Getting Player's Sensitivity Setting
Reply With Quote #3

I know it's not related, but why would you ever want to know client's sensitivity setting?
__________________
klippy is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 01-08-2018 , 08:38   Re: [HELP] Getting Player's Sensitivity Setting
Reply With Quote #4

Quote:
Originally Posted by KliPPy View Post
I know it's not related, but why would you ever want to know client's sensitivity setting?
I'm giving clients +10 to their sensitivity while they're zoomed-in with any sniper rifle...
__________________
hellmonja is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-08-2018 , 09:18   Re: [HELP] Getting Player's Sensitivity Setting
Reply With Quote #5

As far as I am aware you can't (and shouldn't even if you can) change client's sensitivity. Also, how much would +10 affect them depends on DPI and other settings, meaning that the change is not constant and reliable, favoring some players over the others. And if someone disconnected while zoomed in their sensitivity would stay changed and you wouldn't be able to revert it. Just don't do it. There's zoom_sensitivity_ratio client cvar if someone wants that effect for themselves.
__________________

Last edited by klippy; 01-08-2018 at 09:21.
klippy is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 01-09-2018 , 00:20   Re: [HELP] Getting Player's Sensitivity Setting
Reply With Quote #6

Quote:
Originally Posted by KliPPy View Post
As far as I am aware you can't (and shouldn't even if you can) change client's sensitivity. Also, how much would +10 affect them depends on DPI and other settings, meaning that the change is not constant and reliable, favoring some players over the others. And if someone disconnected while zoomed in their sensitivity would stay changed and you wouldn't be able to revert it. Just don't do it. There's zoom_sensitivity_ratio client cvar if someone wants that effect for themselves.
I suppose you're right. I actually did not know about zoom_sensitivity_ratio prior to this and would be easier to use that instead. Although regarding setting staying altered after the client leaves the game, there's a way to prevent that-- for educational purposes of course.

Since I'm storing each players sensitivity in g_sensitivity[33] when a player connects, I can set it back again when the player leaves.
PHP Code:
client_disconnect(id)
{
     
set_cvar_num("sensitivity"g_sensitivity[id]);

Either way, thank you for the information and advise. I now know of query_client_cvar and zoom_sensitivity_ratio...
__________________

Last edited by hellmonja; 01-09-2018 at 00:22.
hellmonja is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-09-2018 , 08:00   Re: [HELP] Getting Player's Sensitivity Setting
Reply With Quote #7

With that code you'll change the server's sensitivity.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-09-2018 , 08:18   Re: [HELP] Getting Player's Sensitivity Setting
Reply With Quote #8

Don't make it too sensitive please.
__________________
klippy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-09-2018 , 09:31   Re: [HELP] Getting Player's Sensitivity Setting
Reply With Quote #9

Quote:
Originally Posted by hellmonja View Post
Although regarding setting staying altered after the client leaves the game, there's a way to prevent that-- for educational purposes of course.
It is impossible for the server to restore any settings for the player because you cannot send commands to a player that isn't in the server (i.e. has already disconnected).
__________________

Last edited by fysiks; 01-09-2018 at 09:32.
fysiks is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 01-10-2018 , 04:41   Re: [HELP] Getting Player's Sensitivity Setting
Reply With Quote #10

Quote:
Originally Posted by OciXCrom View Post
With that code you'll change the server's sensitivity.
You mean if I do this:
PHP Code:
set_cvar_num("zoom_sensitivity_ratio"3); 
Everyone's setting changes? So what is the correct way of changing that particular player's setting?...
__________________
hellmonja 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 05:27.


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