Gamemode.SetPlayerSpeed

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NameSetPlayerSpeed
SyntaxGM:SetPlayerSpeed( Player ply, Integer walk, Integer run )
DescriptionSetPlayerSpeed allows us to override the players speed.
ReturnsNil
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.SetPlayerSpeed]Gamemode.SetPlayerSpeed [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionThis example makes the default movement speed 250 and makes the sprint speed 500.
Used onNewerServer.png
Code
function playerSetSpeed(ply)
 
	GAMEMODE:SetPlayerSpeed(ply, 250, 500)
	// 250 is the default move speed
	// 500 is the speed when you hold the sprint key
end
 
hook.Add( "PlayerSpawn", "playerSetSpeedtest", playerSetSpeed )
OutputThe player moves at 250 and he sprints at 500.


Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox