One in the chamber swep.

So I am doing a gun for a one in the chamber sort of ttt minigame and I want the SWEP to give you an extra bullet when you kill someone.

My question is, how would I go about doing that?

The code for the gun (Although it is just a ttt deagle with modified stats):


AddCSLuaFile()

SWEP.HoldType			= "pistol"

if CLIENT then
   SWEP.PrintName			= "Deagle"			
   SWEP.Author				= "TTT"

   SWEP.Slot				= 1
   SWEP.SlotPos			= 1

   SWEP.Icon = "vgui/ttt/icon_deagle"
end

SWEP.Base				= "weapon_tttbase"

SWEP.Spawnable = true
SWEP.Kind = WEAPON_PISTOL
SWEP.WeaponID = AMMO_DEAGLE

SWEP.Primary.Ammo       = "AlyxGun" -- hijack an ammo type we don't use otherwise
SWEP.Primary.Recoil			= 0
SWEP.Primary.Damage = 500
SWEP.Primary.Delay = 0
SWEP.Primary.Cone = 0.001
SWEP.Primary.ClipSize = 1
SWEP.Primary.ClipMax = 2
SWEP.Primary.DefaultClip = 1
SWEP.Primary.Automatic = false

SWEP.HeadshotMultiplier = 10

SWEP.AutoSpawnable      = false
SWEP.AmmoEnt = "degbullets"
SWEP.Primary.Sound			= Sound( "Weapon_Deagle.Single" )

SWEP.UseHands			= true
SWEP.ViewModelFlip		= false
SWEP.ViewModelFOV		= 60
SWEP.ViewModel			= "models/weapons/cstrike/c_pist_deagle.mdl"
SWEP.WorldModel			= "models/weapons/w_pist_deagle.mdl"

SWEP.IronSightsPos = Vector(-6.361, -3.701, 2.15)
SWEP.IronSightsAng = Vector(0, 0, 0)

You’d need to extract and modify it yourself, but looking at the code for the fretta gamemode should give some ideas:

What I would do is create a function within the swep that restores a bullet, and then just call it through a PlayerDeath hook.

obviously you’d check if the gamemode is active or not