Another drug gun fail

I’ve been trying to make a weapon which drugs someone for the ttt game mode. I based it off the tranquilizer from gjail but I wanted it also to hurt the player, slow them down. I don’t know how to make it get the player and affect them specifically and I’ve been trying to do this for about 4 hours now. It’s a real mess right now, I just got kind of annoyed and I don’t know what I’m doing anymore. If someone could help I would really really appreciate it.

[lua] if( SERVER ) then
AddCSLuaFile( “shared.lua” )
SWEP.Weight = 10
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
end

if( CLIENT ) then
SWEP.PrintName = “Drug Gun”
SWEP.Slot = 1
SWEP.SlotPos = 1
SWEP.DrawAmmo = true
SWEP.DrawCrosshair = true
SWEP.ViewModelFOV = 62
SWEP.ViewModelFlip = true
killicon.AddFont( “weapon_tranquilizer”, “CSKillIcons”, “u”, Color( 255, 80, 0, 255 ) )
end

SWEP.Base = “weapon_base”

SWEP.Author = “Meoowe”
SWEP.Instructions = “”
SWEP.Contact = “”
SWEP.Purpose = “”

SWEP.Primary.ClipSize = 6
SWEP.Primary.DefaultClip = 6
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = “XBowBolt”
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = “none”

util.PrecacheSound(“Weapon_crossbow.Single”)

SWEP.ViewModel = “models/weapons/v_pist_fiveseven.mdl”
SWEP.WorldModel = “models/weapons/w_pist_fiveseven.mdl”

function SWEP:Initialize()
if( SERVER ) then
self:SetWeaponHoldType( “pistol” )
end
end

function SWEP:Deploy()
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
return true
end

function SWEP:PrimaryAttack()
if !self:CanPrimaryAttack() then return end
self.Weapon:SetNextPrimaryFire(CurTime()+0.2)
self.Weapon:SetNextSecondaryFire(CurTime()+0.2)
self.Owner:MuzzleFlash()
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
self.Weapon:EmitSound(“Weapon_crossbow.Single”)
self:TakePrimaryAmmo( 1 )
self.Owner:ViewPunch( Angle( math.Rand(-0.5,-0.2), math.Rand(-0.2,0.2), 0 ) )
local bullet = {}
bullet.Num = 1
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Spread = Vector( 0.01, 0.01, 0 )
bullet.Tracer = 4
bullet.Force = 3
bullet.Damage = 3
if( SERVER ) then
bullet.Callback = function( ,tr, )
if tr.Hit and tr.Entity:IsValid() and tr.Entity:IsPlayer()
then
local rp = RecipientFilter()
rp:AddPlayer(tr.Entity)
umsg.Start(“DeathByDrugs”, rp)
umsg.Start(“Tranq”, rp)
umsg.End()
timer.Simple(1, startdieinghahaha, rp)
end
end
end
self.Owner:FireBullets( bullet )
end

function startdieinghahaha( caller, ply )

if player:IsValid() and player:Alive()
then

if math.random(1, 22) == 3 then player:Ignite(10, 5) end
timer.Simple(math.random(5, 20), DeathAndDecay, player)
end
usermessage.Hook(“DeathByDrugs”, startdieinghahaha)

function DeathAndDecay( caller, ply )
ply:SetHealth( -10)
ply:SetWalkSpeed(-10)
ply:SetRunSpeed(-10)
timer.Simple(1, startdieinghahaha, ply)
end
end

function SWEP:SecondaryAttack()
end

function SWEP:Reload()
self.Weapon:DefaultReload( ACT_VM_RELOAD )
end

if( CLIENT ) then

local EffScale = nil

local function Tranq( um )
EffScale = (EffScale or CurTime()+30 ) + 20
if EffScale > CurTime()+15 then EffScale = CurTime()+15 end
end
usermessage.Hook(“Tranq”, Tranq)

local function RenderTranq()
local CT = CurTime()
if EffScale then
if EffScale > CT then
local Left = EffScale - CT
if Left > 10 then Left = 10 end
DrawBloom( 1 - Left * 0.05,
1 + Left * 0.1,
9,
9,
1,
1,
1,
1,
1 )
DrawMotionBlur( 3 - Left * 0.09,
1,
Left * 0.005 )
elseif EffScale <= CT then
EffScale = nil
end
end
end
hook.Add(“RenderScreenspaceEffects”, “RenderTranq”, RenderTranq)

end

function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha )
draw.SimpleText( “u”, “CSSelectIcons”, x + wide/2, y + tall*0.2, Color( 255, 210, 0, 255 ), TEXT_ALIGN_CENTER )
end

– lua_openscript errortown\entities\weapons\weapon_ttt_tranquilizer/shared.lua [/lua]

Post your code if you want us to help.

He posted the code, Stop using IE(lua tags wont show)

[lua] local rp = RecipientFilter()
rp:AddPlayer(tr.Entity)
umsg.Start(“DeathByDrugs”, rp)
umsg.Start(“Tranq”, rp)
umsg.End()[/lua]

Mangled code. Should be

[lua] umsg.Start(“DeathByDrugs”, tr.Entity)
umsg.End()
umsg.Start(“Tranq”, tr.Entity)
umsg.End()[/lua]

Was on a school computer. Sorry.