I wanted to turn the ttt_health_station into a pain station. It would be an item traitors buy and drop. Looks just like the health station but it does damage. Below is the ttt_health_station shared.lua found in garrysmod/terrortown/entities/weapons. Also I was wondering am I going to have to edit the ttt_health_station shared.lua found in garrysmod/terrortown/entities/entities? I am not really sure what it is, most of the commands are ENT. or self.entity instead of SWEP. Please any help with this would be very much appreciated!
And sorry if I didn’t get the code to show up in a box not sure not sure if I did it right.
[
if SERVER then
AddCSLuaFile( “shared.lua” )
end
SWEP.HoldType = “normal”
if CLIENT then
SWEP.PrintName = “Pain Station”
SWEP.Slot = 6
SWEP.ViewModelFOV = 10
SWEP.EquipMenuData = {
type=“Weapon”,
model=“models/props/cs_office/microwave.mdl”,
desc="Allows people to heal when placed.
Slow recharge. Anyone can use it, and
it can be damaged. Can be checked for
DNA samples of its users."
};
SWEP.Icon = “VGUI/ttt/icon_health”
end
SWEP.Base = “weapon_tttbase”
SWEP.ViewModel = “models/weapons/v_crowbar.mdl”
SWEP.WorldModel = “models/props/cs_office/microwave.mdl”
SWEP.DrawCrosshair = true
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = “none”
SWEP.Primary.Delay = 1.0
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = true
SWEP.Secondary.Ammo = “none”
SWEP.Secondary.Delay = 1.0
– This is special equipment
SWEP.Kind = WEAPON_EQUIP
SWEP.CanBuy = {ROLE_TRAITOR} – only detectives can buy
SWEP.LimitedStock = true – only buyable once
SWEP.WeaponID = AMMO_HEALTHSTATION
SWEP.AllowDrop = false
SWEP.NoSights = true
function SWEP:OnDrop()
self:Remove()
end
function SWEP:PrimaryAttack()
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self:HealthDrop()
end
function SWEP:SecondaryAttack()
self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )
self:HealthDrop()
end
local throwsound = Sound( “Weapon_SLAM.SatchelThrow” )
– ye olde droppe code
function SWEP:HealthDrop()
if SERVER then
local ply = self.Owner
if not ValidEntity(ply) then return end
if self.Planted then return end
local vsrc = ply:GetShootPos()
local vang = ply:GetAimVector()
local vvel = ply:GetVelocity()
local vthrow = vvel + vang * 200
local health = ents.Create("ttt_health_station")
if ValidEntity(health) then
health:SetPos(vsrc + vang * 10)
health:SetOwner(ply)
health:Spawn()
health:PhysWake()
local phys = health:GetPhysicsObject()
if ValidEntity(phys) then
phys:SetVelocity(vthrow)
end
self:Remove()
self.Planted = true
end
end
self.Weapon:EmitSound(throwsound)
end
function SWEP:Reload()
return false
end
function SWEP:OnRemove()
if CLIENT and ValidEntity(self.Owner) and self.Owner == LocalPlayer() and self.Owner:Alive() then
RunConsoleCommand(“lastinv”)
end
end
if CLIENT then
local hudtxt = {text=“Click to place the health station”, font=“TabLarge”, xalign=TEXT_ALIGN_RIGHT}
function SWEP:DrawHUD()
hudtxt.pos = {ScrW() - 80, ScrH() - 80}
draw.Text(hudtxt)
draw.TextShadow(hudtxt, 2)
end
end
function SWEP:Deploy()
if SERVER and IsValid(self.Owner) then
self.Owner:DrawViewModel(false)
end
return true
end
function SWEP:DrawWorldModel()
end
function SWEP:DrawWorldModelTranslucent()
end
]
edit sorry didn’t work, how do i get the code to show up in its own little window?