SWEP.Deploy() shows C4 (TTT)

I have a script that I am trying to make show the positions of C4 on deploy while also removing it on holster and so far I am having little luck with this as I am not very good with lua. I made an attempt and the error given off when I placed a C4 was


[ERROR] lua/weapons/weapon_c4scanner/shared.lua:31: attempt to index global 'self' (a nil value)
  1. unknown - lua/weapons/weapon_c4scanner/shared.lua:31
   2. SelectWeapon - [C]:-1
    3. unknown - gamemodes/terrortown/gamemode/weaponry.lua:189
     4. unknown - lua/includes/modules/concommand.lua:69


The important parts of the script are:
[lua]
SWEP.WeaponID = AMMO_C4

function SWEP.Deploy()
net.Start(“TTT_C4Warn”)
net.WriteUInt(self:EntIndex(), 16)
net.WriteBit(armed)
if armed then
net.WriteVector(self:GetPos())
net.WriteFloat(self:GetExplodeTime())
end
net.Send(GetTraitorFilter(true))
end

function SWEP.Holster()
self:SendWarn(false)
end[/lua]

Thank you to anyone in advance that helps :slight_smile:

You should have SWEP:Deploy and SWEP:Holster.

I’ll try this, cheers

Ok, it fixed the errors and I now have
[lua]function SWEP:Deploy()
if SERVER then
function ENT:SendWarn(armed)
net.Start(“TTT_C4Warn”)
net.WriteUInt(self:EntIndex(), 16)
net.WriteBit(armed)
if armed then
net.WriteVector(self:GetPos())
net.WriteFloat(self:GetExplodeTime())
end
net.Send(GetTraitorFilter(true))
end
self:SendWarn(true)
end
end

function SWEP:Holster()
self:SendWarn(false)
end
[/lua]
It doesn’t seem to be finding any C4s though when I put them down. I’m pretty stuck with this one.