CMoveData/SetMaxClientSpeed

From Garry's Mod
Jump to: navigation, search
 CMoveData:SetMaxClientSpeed( )

Contents

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.

NOTE

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

Arguments

number maxSpeed

The new maximum speed

Examples

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 )


Examples

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 )


Personal tools
Navigation