Force cl_ rates on clients

How do I force cl_ rates setting on connecting players?

I want to change some settings on players the join my server.

cl_cmdrate 16
cl_updaterate 16

I found this code, but have no idea if it works at all, as it’s from 2012.


hook.Add( "PlayerInitialSpawn", "ForceRates", function( ply )

	timer.Simple( 3, function()
	
		if ValidEntity( ply ) then
		
			ply:ConCommand( "cl_updaterate 16" )
			ply:ConCommand( "cl_cmdrate 16" )
		
		end
	
	end )


Any help would be really appreciated.

Thanks
Lazaruz

sv_maxupdaterate

And if you don’t know if it works test it lol?

that only change the server sided settings.
I want to change the client setting.

I can’t test on my server as it currently have 50/50 players online.
Thats why im asking if it might work or not.

sv_maxupdaterate forces how high the CLIENT setting can be. Or maybe I’m mistaken, anyways here’s updated working code.



hook.Add( "PlayerInitialSpawn", "ForceRates", function( ply )
	timer.Simple( 3, function()
	
		if IsValid(ply) then
		
			ply:ConCommand( "cl_updaterate 16" )
			ply:ConCommand( "cl_cmdrate 16" )
		
		end
	
	end)
end)


Yeah I just tested it, sv_maxupdaterate is cap on the client setting.

Thanks for your help.
Appreciated!