about summary refs log tree commit diff
path: root/src/game/server/entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/server/entities')
-rw-r--r--src/game/server/entities/character.cpp6
-rw-r--r--src/game/server/entities/character.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp
index ee6b1019..01ed8693 100644
--- a/src/game/server/entities/character.cpp
+++ b/src/game/server/entities/character.cpp
@@ -532,6 +532,12 @@ void CCharacter::GiveNinja()
 	GameServer()->CreateSound(m_Pos, SOUND_PICKUP_NINJA);
 }
 
+void CCharacter::GiveAmmo(int Weapon, int Ammo)
+{
+	if(m_aWeapons[Weapon].m_Got && m_aWeapons[Weapon].m_Ammo > -1)
+		m_aWeapons[Weapon].m_Ammo = min(m_aWeapons[Weapon].m_Ammo + Ammo, min(g_Config.m_SvWeaponsAmmo, g_pData->m_Weapons.m_aId[Weapon].m_Maxammo));
+}
+
 void CCharacter::SetEmote(int Emote, int Tick)
 {
 	m_EmoteType = Emote;
diff --git a/src/game/server/entities/character.h b/src/game/server/entities/character.h
index 8bd1d3da..ece33e45 100644
--- a/src/game/server/entities/character.h
+++ b/src/game/server/entities/character.h
@@ -58,6 +58,7 @@ public:
 
 	bool GiveWeapon(int Weapon, int Ammo);
 	void GiveNinja();
+	void GiveAmmo(int Weapon, int Ammo);
 
 	void SetEmote(int Emote, int Tick);