[lua]
// Variables that are used on both client and server
SWEP.Base = “weapon_mad_base”
SWEP.ViewModelFOV = 80
SWEP.ViewModel = “models/items/v_medkit2.mdl”
SWEP.WorldModel = “models/items/w_medkit.mdl”
SWEP.Spawnable = false
SWEP.AdminSpawnable = false
SWEP.Primary.Sound = Sound(“items/smallmedkit1.wav”)
SWEP.Secondary.Sound = Sound(“items/medshotno1.wav”)
SWEP.Primary.Recoil = 0
SWEP.Primary.Damage = 0
SWEP.Primary.NumShots = 1
SWEP.Primary.Cone = 0.075
SWEP.Primary.Delay = 1
SWEP.Primary.ClipSize = 100 // Size of a clip
SWEP.Primary.DefaultClip = 100 // Default number of bullets in a clip
SWEP.Primary.Automatic = false // Automatic/Semi Auto
SWEP.Primary.Ammo = “Pistol”
SWEP.Secondary.ClipSize = -1 // Size of a clip
SWEP.Secondary.DefaultClip = -1 // Default number of bullets in a clip
SWEP.Secondary.Automatic = false // Automatic/Semi Auto
SWEP.Secondary.Ammo = “none”
SWEP.ShellEffect = “none” // “effect_mad_shell_pistol” or “effect_mad_shell_rifle” or “effect_mad_shell_shotgun”
SWEP.ShellDelay = 0
SWEP.Pistol = true
SWEP.Rifle = false
SWEP.Shotgun = false
SWEP.Sniper = false
//SWEP.RunArmOffset = Vector (0.041, 0, 5.6778)
//SWEP.RunArmAngle = Vector (-17.6901, 0.321, 0)
SWEP.Power = 0
/---------------------------------------------------------
Name: SWEP:Precache()
Desc: Use this function to precache stuff.
---------------------------------------------------------/
function SWEP:Precache()
util.PrecacheSound("items/smallmedkit1.wav")
util.PrecacheSound("items/medshotno1.wav")
end
/---------------------------------------------------------
Name: SWEP:PrimaryAttack()
Desc: +attack2 has been pressed.
---------------------------------------------------------/
cleanup.Register(“Medic Kit”)
function SWEP:PrimaryAttack()
// Holst/Deploy your fucking weapon
if (not self.Owner:IsNPC() and self.Owner:KeyDown(IN_USE)) then
bHolsted = !self.Weapon:GetNetworkedBool("Holsted", false)
self:SetHolsted(bHolsted)
self.Weapon:SetNextPrimaryFire(CurTime() + 0.3)
self.Weapon:SetNextSecondaryFire(CurTime() + 0.3)
self:SetIronsights(false)
return
end
if not IsFirstTimePredicted() then return end
if self.ActionDelay > CurTime() then return end
self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
self.Weapon:SetNextSecondaryFire(CurTime() + self.Primary.Delay)
self.ActionDelay = (CurTime() + self.Primary.Delay)
self.Owner:SetAnimation(PLAYER_ATTACK1) // 3rd Person Animation
if (SERVER) then
self.Weapon:EmitSound(self.Secondary.Sound)
end
if (CLIENT) then return end
local trace = self.Owner:GetEyeTrace()
if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 100 then
local ent = self.Owner:GetEyeTrace().Entity
if ((ent:IsValid())and(ent:IsPlayer() or ent:IsNPC())) then
local current = ent:Health()
local max = ent:GetMaxHealth()
if ((current < max)and(self:Clip1() > 0)) then
ent:SetHealth( current + 1 )
self:TakePrimaryAmmo(1)
self.Weapon:EmitSound( self.Primary.Sound, 40, 120 )
else
self.Weapon:EmitSound(self.Secondary.Sound, 40, 120 )
end
end
else
self.Weapon:EmitSound(self.Secondary.Sound, 60, 100 )
end
end
/---------------------------------------------------------
Name: SWEP:SecondaryAttack()
Desc: +attack1 has been pressed.
---------------------------------------------------------/
function SWEP:SecondaryAttack()
if self.Owner:Health() >= 100 then
self.Weapon:EmitSound( self.Secondary.Sound, 40, 120 )
else
if(self:Clip1()>0) then
self.Owner:SetHealth( self.Owner:Health() + 1 )
self.Weapon:EmitSound( self.Primary.Sound, 40, 120 )
self:TakePrimaryAmmo(1)
end
end
self.Weapon:SetNextSecondaryFire(CurTime() + 1)
end
/---------------------------------------------------------
Name: SWEP:Deploy()
Desc: Whip it out.
---------------------------------------------------------/
function SWEP:Deploy()
self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
self.Weapon:SetNextPrimaryFire(CurTime() + self.DeployDelay)
self.Weapon:SetNextSecondaryFire(CurTime() + self.DeployDelay)
self.ActionDelay = (CurTime() + self.DeployDelay)
return true
end
[/lua]
It’s a medkit. Yes it is based on madcow’s medkit.
It’s supposed to be like this:
Uses pistol ammo (for now)
When you leftclick on someone, it takes 1 ammo and heals them 1 point.
When you rightclick, it takes 1 ammo and heals you 1 point.
If you can’t decipher it then at least tell me it’s epic fail messed up all wrong so I can stop trying to make it work.