Gamemode.PlayerStepSoundTime

From GMod Wiki

Revision as of 08:54, 24 May 2011 by Wizard (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Event Hook
Hook NamePlayerStepSoundTime
SyntaxGM:PlayerStepSoundTime( Player ply, Enum iType, Boolean bWalking )
DescriptionReturn the time between footsteps.
ReturnsInteger
Lua StateNewerShared.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerStepSoundTime]Gamemode.PlayerStepSoundTime [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]

Examples

DescriptionThis is how it is defined in the base gamemode.
Used onNewerShared.png
Code
function PlayerStepSoundTime( ply, iType, bWalking )
 
	local fStepTime = 350
	local fMaxSpeed = ply:GetMaxSpeed()
 
	if ( iType == STEPSOUNDTIME_NORMAL || iType == STEPSOUNDTIME_WATER_FOOT ) then
 
		if ( fMaxSpeed <= 100 ) then 
			fStepTime = 400
		elseif ( fMaxSpeed <= 300 ) then 
			fStepTime = 350
		else 
			fStepTime = 250 
		end
 
	elseif ( iType == STEPSOUNDTIME_ON_LADDER ) then
 
		fStepTime = 450 
 
	elseif ( iType == STEPSOUNDTIME_WATER_KNEE ) then
 
		fStepTime = 600 
 
	end
 
	// Step slower if crouching
	if ( ply:Crouching() ) then
		fStepTime = fStepTime + 50
	end
 
	return fStepTime
 
end 
OutputN/A


Additional Notes

SHARED | 0000000000000000 | 00000000000000000 | NORMAL
SHARED | 0000000000000001 | 00000000000000001 | ON_LADDER
SHARED | 0000000000000002 | 00000000000000010 | WATER_KNEE
SHARED | 0000000000000003 | 00000000000000011 | WATER_FOOT

See the enumeration list.

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox