Revision Difference
WEAPON:AdjustMouseSensitivity#567604
<function name="AdjustMouseSensitivity" parent="WEAPON" type="hook">
<description>Allows you to adjust the mouse sensitivity. This hook only works if you haven't overridden <page>GM:AdjustMouseSensitivity</page>.</description>
<description>Allows you to adjust the weapon's mouse sensitivity. This hook only works if you haven't overridden <page>GM:AdjustMouseSensitivity</page>.</description>
<realm>Client</realm>
<args>⤶
<arg name="defaultSensitivity" type="number" added="2026.03.12">The old sensitivity⤶
⤶
In general this will be 0, which is equivalent to a sensitivity of 1.</arg>⤶
<arg name="localFOV" type="number" added="2026.03.12">The player's current FOV.</arg>⤶
<arg name="defaultFOV" type="number" added="2026.03.12">The player's default FOV.</arg>⤶
</args>⤶
<rets>
<ret name="" type="number">Sensitivity scale</ret>⤶
<ret name="" type="number">A multiplier of the player's normal sensitivity (0.5 would be half as sensitive, 2 would be twice as sensitive).</ret>⤶
</rets>
</function>
<example>
<description>Makes your sensitivity twice slower</description>⤶
<description>Properly scales the player's sensitivity with their FOV while obeying `zoom_sensitivity_ratio`, mimicking the behavior of the built-in weapons.</description>⤶
<code>
function SWEP:AdjustMouseSensitivity()
return 0.5⤶
local ratio = GetConVar("zoom_sensitivity_ratio")
⤶
function SWEP:AdjustMouseSensitivity(default, localFOV, defaultFOV)⤶
if localFOV == defaultFOV then⤶
return 1⤶
end⤶
⤶
return (localFOV / defaultFOV) * ratio:GetFloat()⤶
end
</code>
⤶
</example></example>
Garry's Mod
Rust
Steamworks
Wiki Help