diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 1c76f6556..6794429da 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -56,6 +56,7 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos) { m_EmoteStop = -1; m_LastAction = -1; + m_LastNoAmmoSound = -1; m_ActiveWeapon = WEAPON_GUN; m_LastWeapon = WEAPON_HAMMER; m_QueuedWeapon = -1; @@ -270,7 +271,11 @@ void CCharacter::FireWeapon() { // 125ms is a magical limit of how fast a human can click m_ReloadTimer = 125 * Server()->TickSpeed() / 1000; - GameServer()->CreateSound(m_Pos, SOUND_WEAPON_NOAMMO); + if(m_LastNoAmmoSound+Server()->TickSpeed() <= Server()->Tick()) + { + GameServer()->CreateSound(m_Pos, SOUND_WEAPON_NOAMMO); + m_LastNoAmmoSound = Server()->Tick(); + } return; } diff --git a/src/game/server/entities/character.h b/src/game/server/entities/character.h index aa127979b..d799d8a7d 100644 --- a/src/game/server/entities/character.h +++ b/src/game/server/entities/character.h @@ -97,6 +97,7 @@ private: // last tick that the player took any action ie some input int m_LastAction; + int m_LastNoAmmoSound; // these are non-heldback inputs CNetObj_PlayerInput m_LatestPrevInput;