Garry's Mod Wiki

CMoveData:SetMaxClientSpeed

CMoveData:SetMaxClientSpeed( number maxSpeed )

Description

Sets the maximum player speed. Player won't be able to run or sprint faster then this value.

This also automatically sets CMoveData:SetMaxSpeed when used in the GM:SetupMove hook. You must set it manually in the GM:Move hook.

This must be called on both client and server to avoid prediction errors.

This will not reduce speed in air.

Setting this to 0 will not make the player stationary. It won't do anything.

Arguments

1 number maxSpeed
The new maximum speed

Example

Doesn't let the player to run or sprint faster than 100 units per second.

hook.Add("SetupMove","MySpeed", function( ply, mv ) mv:SetMaxClientSpeed( 100 ) end )

Example

Doubles the players speed properly.

hook.Add( "Move", "testestst", function( ply, mv, usrcmd ) local speed = mv:GetMaxSpeed() * 2 mv:SetMaxSpeed( speed ) mv:SetMaxClientSpeed( speed ) end )

Page Links


Special Pages


Wikis

?

Render Time: 38ms

DB GetPage 3
Generate Html 7
SaveChanges (1) 7
Render Body 0
Render Sidebar 16