From 8ba6edfe146c87b836c98962382b7e5b3c92cb08 Mon Sep 17 00:00:00 2001 From: thecraftianman <64441307+thecraftianman@users.noreply.github.com> Date: Mon, 23 Jun 2025 18:15:50 -0400 Subject: [PATCH 1/6] Improve SWEP visuals/audio --- lua/weapons/laserpointer/cl_init.lua | 65 ++++++++++++++++++++++----- lua/weapons/laserpointer/init.lua | 40 +---------------- lua/weapons/laserpointer/shared.lua | 66 +++++++++++++++++++++++++--- lua/weapons/remotecontroller.lua | 33 +++++++++----- 4 files changed, 140 insertions(+), 64 deletions(-) diff --git a/lua/weapons/laserpointer/cl_init.lua b/lua/weapons/laserpointer/cl_init.lua index adf984a6fd..50829b3e34 100644 --- a/lua/weapons/laserpointer/cl_init.lua +++ b/lua/weapons/laserpointer/cl_init.lua @@ -9,33 +9,76 @@ SWEP.DrawCrosshair = true local color_red = Color(255, 0, 0) local laser = Material("cable/redlaser") +-- Adapted from the example in https://wiki.facepunch.com/gmod/Entity:GetAttachment +local function formatViewModelAttachment(origin) + local view = render.GetViewSetup() + + local eye_pos = view.origin + local eye_ang = view.angles + local offset = origin - eye_pos + local forward = eye_ang:Forward() + + local view_x = math.tan(view.fovviewmodel_unscaled * math.pi / 360) + + if view_x == 0 then + forward:Mul(forward:Dot(offset)) + eye_pos:Add(forward) + + return eye_pos + end + + local world_x = math.tan(view.fov_unscaled * math.pi / 360) + + if world_x == 0 then + forward:Mul(forward:Dot(offset)) + eye_pos:Add(forward) + + return eye_pos + end + + local right = eye_ang:Right() + local up = eye_ang:Up() + + local factor = view_x / world_x + right:Mul(right:Dot(offset) * factor) + up:Mul(up:Dot(offset) * factor) + + forward:Mul(forward:Dot(offset)) + + eye_pos:Add(right) + eye_pos:Add(up) + eye_pos:Add(forward) + + return eye_pos +end + function SWEP:Setup(ply) if ply:IsValid() then local viewmodel = ply:GetViewModel() if not viewmodel:IsValid() then return end - local attachmentIndex = viewmodel:LookupAttachment("muzzle") - if attachmentIndex == 0 then attachmentIndex = viewmodel:LookupAttachment("1") end + local attachment_index = viewmodel:LookupAttachment("muzzle") + if attachment_index == 0 then attachment_index = viewmodel:LookupAttachment("1") end - if LocalPlayer():GetAttachment(attachmentIndex) then + if LocalPlayer():GetAttachment(attachment_index) then self.VM = viewmodel - self.Attach = attachmentIndex + self.Attach = attachment_index end end end -function SWEP:Initialize() - self:Setup(self:GetOwner()) -end - function SWEP:Deploy() self:Setup(self:GetOwner()) end function SWEP:ViewModelDrawn() - if self:GetLaserEnabled() and self.VM then + local vm = self.VM + + if self:GetLaserEnabled() and vm then + local startpos = vm:GetAttachment(self.Attach).Pos + render.SetMaterial(laser) - render.DrawBeam(self.VM:GetAttachment(self.Attach).Pos, self:GetOwner():GetEyeTrace().HitPos, 2, 0, 12.5, color_red) + render.DrawBeam(formatViewModelAttachment(startpos), self:GetOwner():GetEyeTrace().HitPos, 2, 0, 12.5, color_red) end end @@ -61,4 +104,4 @@ function SWEP:DrawWorldModel() render.SetMaterial(laser) render.DrawBeam(startpos, endpos, 2, 0, 12.5, color_red) end -end +end \ No newline at end of file diff --git a/lua/weapons/laserpointer/init.lua b/lua/weapons/laserpointer/init.lua index f5f2f6c1e1..96b124980e 100644 --- a/lua/weapons/laserpointer/init.lua +++ b/lua/weapons/laserpointer/init.lua @@ -2,47 +2,11 @@ AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") -SWEP.Weight = 8 -SWEP.AutoSwitchTo = false -SWEP.AutoSwitchFrom = false - -SWEP.Receiver = nil -SWEP.Pointing = false - -function SWEP:Initialize() - self.Pointing = false -end - function SWEP:Equip(newOwner) if IsValid(newOwner.LasReceiver) then self.Receiver = newOwner.LasReceiver newOwner.LasReceiver = nil - newOwner:PrintMessage(HUD_PRINTTALK, "Relinked Sucessfully") - end -end - -function SWEP:PrimaryAttack() - self.Pointing = not self.Pointing - self:SetLaserEnabled(self.Pointing) - - if self.Pointing and IsValid(self.Receiver) then - Wire_TriggerOutput(self.Receiver,"Active", 1) - else - Wire_TriggerOutput(self.Receiver,"Active", 0) - end -end - -function SWEP:SecondaryAttack() - local owner = self:GetOwner() - if not IsValid(owner) then return end - - local trace = owner:GetEyeTrace() - - if IsValid(trace.Entity) and trace.Entity:GetClass() == "gmod_wire_las_receiver" and gamemode.Call("CanTool", owner, trace, "wire_las_receiver") then - self.Receiver = trace.Entity - owner:PrintMessage(HUD_PRINTTALK, "Linked Sucessfully") - - return true + newOwner:PrintMessage(HUD_PRINTTALK, "Relinked Successfully!") end end @@ -70,4 +34,4 @@ function SWEP:Think() self.Receiver.VPos = point end -end +end \ No newline at end of file diff --git a/lua/weapons/laserpointer/shared.lua b/lua/weapons/laserpointer/shared.lua index ebfcc3280e..3cd357f604 100644 --- a/lua/weapons/laserpointer/shared.lua +++ b/lua/weapons/laserpointer/shared.lua @@ -1,14 +1,15 @@ SWEP.Author = "" SWEP.Contact = "" -SWEP.Purpose = "" -SWEP.Instructions = "Left Click to designate targets. Right click to select laser receiver." +SWEP.Purpose = "Input source for Laser Pointer Receivers in Wiremod." +SWEP.Instructions = "Left click to designate targets. Right click to select laser receiver." SWEP.Category = "Wiremod" SWEP.Spawnable = true SWEP.AdminOnly = false -SWEP.viewModel = "models/weapons/v_pistol.mdl" -SWEP.worldModel = "models/weapons/w_pistol.mdl" +SWEP.UseHands = true +SWEP.ViewModel = "models/weapons/c_pistol.mdl" +SWEP.WorldModel = "models/weapons/w_pistol.mdl" SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 @@ -20,6 +21,61 @@ SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" +SWEP.Weight = 8 +SWEP.AutoSwitchTo = false +SWEP.AutoSwitchFrom = false + +SWEP.Receiver = nil +SWEP.Pointing = false + +local singleplayer = game.SinglePlayer() + function SWEP:SetupDataTables() - self:NetworkVar("Bool", 0, "LaserEnabled") + self:NetworkVar("Bool", 0, "LaserEnabled") +end + +function SWEP:Initialize() + self.Pointing = false + + if CLIENT then + self:Setup(self:GetOwner()) + end end + +function SWEP:PrimaryAttack() + self.Pointing = not self.Pointing + self:SetLaserEnabled(self.Pointing) + + if CLIENT or singleplayer then + local pitch = self.Pointing and 120 or 80 + self:EmitSound("ambient/energy/newspark03.wav", 100, pitch, 0.5) + + return + end + + if self.Pointing and IsValid(self.Receiver) then + Wire_TriggerOutput(self.Receiver, "Active", 1) + else + Wire_TriggerOutput(self.Receiver, "Active", 0) + end +end + +function SWEP:SecondaryAttack() + local owner = self:GetOwner() + if not IsValid(owner) then return end + + local trace = owner:GetEyeTrace() + + if IsValid(trace.Entity) and trace.Entity:GetClass() == "gmod_wire_las_receiver" and gamemode.Call("CanTool", owner, trace, "wire_las_receiver") then + if SERVER then + self.Receiver = trace.Entity + owner:PrintMessage(HUD_PRINTTALK, "Linked Successfully!") + elseif (CLIENT or singleplayer) and IsFirstTimePredicted() then + self:EmitSound("buttons/bell1.wav") + end + + return true + elseif (CLIENT or singleplayer) and IsFirstTimePredicted() then + self:EmitSound("buttons/button16.wav", 100, 50, 0.5) + end +end \ No newline at end of file diff --git a/lua/weapons/remotecontroller.lua b/lua/weapons/remotecontroller.lua index c0f9c04c06..364a36c147 100644 --- a/lua/weapons/remotecontroller.lua +++ b/lua/weapons/remotecontroller.lua @@ -2,9 +2,10 @@ AddCSLuaFile() SWEP.Author = "Divran" -- Originally by ShaRose, rewritten by Divran at 2011-04-03 SWEP.Contact = "" -SWEP.Purpose = "Remote control for Pod Controllers in wire." -SWEP.Instructions = "Left Click on Pod Controller to link up, and use to start controlling." +SWEP.Purpose = "Remote control for Pod Controllers in Wiremod." +SWEP.Instructions = "Left click on a Pod Controller to link up, and use to start controlling." SWEP.Category = "Wiremod" +SWEP.IconOverride = "entities/weapon_pistol.png" SWEP.PrintName = "Remote Control" SWEP.Slot = 0 @@ -24,20 +25,33 @@ SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" -SWEP.viewModel = "models/weapons/v_pistol.mdl" -SWEP.worldModel = "models/weapons/w_pistol.mdl" -if CLIENT then return end +SWEP.UseHands = true +SWEP.ViewModel = "models/weapons/c_pistol.mdl" +SWEP.WorldModel = "models/weapons/w_pistol.mdl" + +local singleplayer = game.SinglePlayer() function SWEP:PrimaryAttack() local ply = self:GetOwner() local trace = ply:GetEyeTrace() - if IsValid(trace.Entity) and trace.Entity:GetClass() == "gmod_wire_pod" and gamemode.Call("PlayerUse", ply, trace.Entity) then - self.Linked = trace.Entity - ply:ChatPrint("Remote Controller linked.") + + if IsValid(trace.Entity) and trace.Entity:GetClass() == "gmod_wire_pod" then + if SERVER and gamemode.Call("PlayerUse", ply, trace.Entity) then + self.Linked = trace.Entity + ply:ChatPrint("Remote Controller linked.") + elseif (CLIENT or singleplayer) and IsFirstTimePredicted() then + self:EmitSound("buttons/bell1.wav") + end + elseif (CLIENT or singleplayer) and IsFirstTimePredicted() then + self:EmitSound("buttons/button16.wav", 100, 50) end end +function SWEP:SecondaryAttack() end + +if CLIENT then return end + function SWEP:Holster() local ply = self:GetOwner() if IsValid(ply) and self.Linked then @@ -112,5 +126,4 @@ end hook.Add("PlayerNoClip", "wire_remotecontroller_antinoclip", function(ply, cmd) if ply.using_wire_remote_control then return false end -end) - +end) \ No newline at end of file From 76a8a2ba654252e69fd25e1b4f1b01af20379477 Mon Sep 17 00:00:00 2001 From: thecraftianman <64441307+thecraftianman@users.noreply.github.com> Date: Fri, 27 Jun 2025 12:38:09 -0400 Subject: [PATCH 2/6] Replace deprecated function --- lua/weapons/laserpointer/init.lua | 16 +++++++++------- lua/weapons/laserpointer/shared.lua | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lua/weapons/laserpointer/init.lua b/lua/weapons/laserpointer/init.lua index 96b124980e..7806c0d05c 100644 --- a/lua/weapons/laserpointer/init.lua +++ b/lua/weapons/laserpointer/init.lua @@ -11,7 +11,9 @@ function SWEP:Equip(newOwner) end function SWEP:Think() - if self.Pointing and IsValid(self.Receiver) then + local receiver = self.Receiver + + if self.Pointing and IsValid(receiver) then local owner = self:GetOwner() if not IsValid(owner) then return end @@ -26,12 +28,12 @@ function SWEP:Think() local point = trace.HitPos - Wire_TriggerOutput(self.Receiver, "X", point.x) - Wire_TriggerOutput(self.Receiver, "Y", point.y) - Wire_TriggerOutput(self.Receiver, "Z", point.z) - Wire_TriggerOutput(self.Receiver, "Pos", point) - Wire_TriggerOutput(self.Receiver, "RangerData", trace) + WireLib.TriggerOutput(receiver, "X", point.x) + WireLib.TriggerOutput(receiver, "Y", point.y) + WireLib.TriggerOutput(receiver, "Z", point.z) + WireLib.TriggerOutput(receiver, "Pos", point) + WireLib.TriggerOutput(receiver, "RangerData", trace) - self.Receiver.VPos = point + receiver.VPos = point end end \ No newline at end of file diff --git a/lua/weapons/laserpointer/shared.lua b/lua/weapons/laserpointer/shared.lua index 3cd357f604..c8d3f7437a 100644 --- a/lua/weapons/laserpointer/shared.lua +++ b/lua/weapons/laserpointer/shared.lua @@ -54,9 +54,9 @@ function SWEP:PrimaryAttack() end if self.Pointing and IsValid(self.Receiver) then - Wire_TriggerOutput(self.Receiver, "Active", 1) + WireLib.TriggerOutput(self.Receiver, "Active", 1) else - Wire_TriggerOutput(self.Receiver, "Active", 0) + WireLib.TriggerOutput(self.Receiver, "Active", 0) end end From 596539beec9e0d4bc2115903a2974e9dc09d76cb Mon Sep 17 00:00:00 2001 From: thecraftianman <64441307+thecraftianman@users.noreply.github.com> Date: Mon, 30 Jun 2025 13:19:16 -0400 Subject: [PATCH 3/6] Address some feedback --- lua/weapons/laserpointer/init.lua | 5 ++--- lua/weapons/remotecontroller.lua | 13 ++++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lua/weapons/laserpointer/init.lua b/lua/weapons/laserpointer/init.lua index 7806c0d05c..faa4b98d13 100644 --- a/lua/weapons/laserpointer/init.lua +++ b/lua/weapons/laserpointer/init.lua @@ -11,9 +11,7 @@ function SWEP:Equip(newOwner) end function SWEP:Think() - local receiver = self.Receiver - - if self.Pointing and IsValid(receiver) then + if self.Pointing and IsValid(self.Receiver) then local owner = self:GetOwner() if not IsValid(owner) then return end @@ -27,6 +25,7 @@ function SWEP:Think() end local point = trace.HitPos + local receiver = self.Receiver WireLib.TriggerOutput(receiver, "X", point.x) WireLib.TriggerOutput(receiver, "Y", point.y) diff --git a/lua/weapons/remotecontroller.lua b/lua/weapons/remotecontroller.lua index 364a36c147..b069bba476 100644 --- a/lua/weapons/remotecontroller.lua +++ b/lua/weapons/remotecontroller.lua @@ -30,20 +30,19 @@ SWEP.UseHands = true SWEP.ViewModel = "models/weapons/c_pistol.mdl" SWEP.WorldModel = "models/weapons/w_pistol.mdl" -local singleplayer = game.SinglePlayer() - function SWEP:PrimaryAttack() local ply = self:GetOwner() local trace = ply:GetEyeTrace() + local ent = trace.Entity - if IsValid(trace.Entity) and trace.Entity:GetClass() == "gmod_wire_pod" then - if SERVER and gamemode.Call("PlayerUse", ply, trace.Entity) then - self.Linked = trace.Entity + if IsValid(ent) and ent:GetClass() == "gmod_wire_pod" then + if SERVER and gamemode.Call("PlayerUse", ply, ent) then + self.Linked = ent ply:ChatPrint("Remote Controller linked.") - elseif (CLIENT or singleplayer) and IsFirstTimePredicted() then + elseif (CLIENT or game.SinglePlayer()) and IsFirstTimePredicted() then self:EmitSound("buttons/bell1.wav") end - elseif (CLIENT or singleplayer) and IsFirstTimePredicted() then + elseif (CLIENT or game.SinglePlayer()) and IsFirstTimePredicted() then self:EmitSound("buttons/button16.wav", 100, 50) end end From 4cb97b35948874d02164e2e472f6a426f2a92c47 Mon Sep 17 00:00:00 2001 From: thecraftianman <64441307+thecraftianman@users.noreply.github.com> Date: Tue, 8 Jul 2025 14:27:23 -0400 Subject: [PATCH 4/6] Rework laser viewmodel code --- lua/weapons/laserpointer/cl_init.lua | 78 +++++----------------------- lua/weapons/laserpointer/shared.lua | 8 --- 2 files changed, 14 insertions(+), 72 deletions(-) diff --git a/lua/weapons/laserpointer/cl_init.lua b/lua/weapons/laserpointer/cl_init.lua index 50829b3e34..4fdbe94c50 100644 --- a/lua/weapons/laserpointer/cl_init.lua +++ b/lua/weapons/laserpointer/cl_init.lua @@ -9,76 +9,26 @@ SWEP.DrawCrosshair = true local color_red = Color(255, 0, 0) local laser = Material("cable/redlaser") --- Adapted from the example in https://wiki.facepunch.com/gmod/Entity:GetAttachment -local function formatViewModelAttachment(origin) +-- Scale screen coords by linear proportion of viewmodel and world fov +local function WorldToViewModel(point) local view = render.GetViewSetup() - - local eye_pos = view.origin - local eye_ang = view.angles - local offset = origin - eye_pos - local forward = eye_ang:Forward() - - local view_x = math.tan(view.fovviewmodel_unscaled * math.pi / 360) - - if view_x == 0 then - forward:Mul(forward:Dot(offset)) - eye_pos:Add(forward) - - return eye_pos - end - - local world_x = math.tan(view.fov_unscaled * math.pi / 360) - - if world_x == 0 then - forward:Mul(forward:Dot(offset)) - eye_pos:Add(forward) - - return eye_pos - end - - local right = eye_ang:Right() - local up = eye_ang:Up() - - local factor = view_x / world_x - right:Mul(right:Dot(offset) * factor) - up:Mul(up:Dot(offset) * factor) - - forward:Mul(forward:Dot(offset)) - - eye_pos:Add(right) - eye_pos:Add(up) - eye_pos:Add(forward) - - return eye_pos -end - -function SWEP:Setup(ply) - if ply:IsValid() then - local viewmodel = ply:GetViewModel() - if not viewmodel:IsValid() then return end - - local attachment_index = viewmodel:LookupAttachment("muzzle") - if attachment_index == 0 then attachment_index = viewmodel:LookupAttachment("1") end - - if LocalPlayer():GetAttachment(attachment_index) then - self.VM = viewmodel - self.Attach = attachment_index - end - end -end - -function SWEP:Deploy() - self:Setup(self:GetOwner()) + local factor = math.tan(math.rad(view.fovviewmodel_unscaled) * 0.5) / math.tan(math.rad(view.fov_unscaled) * 0.5) + point = WorldToLocal(point, angle_zero, view.origin, view.angles) + point:Mul(Vector(1, factor, factor)) + point = LocalToWorld(point, angle_zero, view.origin, view.angles) + return point end -function SWEP:ViewModelDrawn() - local vm = self.VM +function SWEP:PostDrawViewModel(vm, wep, ply) + if self:GetLaserEnabled() then + local att = vm:GetAttachment(vm:LookupAttachment("muzzle") or 0) + if not att then return end - if self:GetLaserEnabled() and vm then - local startpos = vm:GetAttachment(self.Attach).Pos + local startpos = WorldToViewModel(att.Pos) + local endpos = ply:GetEyeTrace().HitPos render.SetMaterial(laser) - render.DrawBeam(formatViewModelAttachment(startpos), self:GetOwner():GetEyeTrace().HitPos, 2, 0, 12.5, color_red) + render.DrawBeam(startpos, endpos, 2, 0, 12.5, color_red) end end diff --git a/lua/weapons/laserpointer/shared.lua b/lua/weapons/laserpointer/shared.lua index c8d3f7437a..9366a38852 100644 --- a/lua/weapons/laserpointer/shared.lua +++ b/lua/weapons/laserpointer/shared.lua @@ -34,14 +34,6 @@ function SWEP:SetupDataTables() self:NetworkVar("Bool", 0, "LaserEnabled") end -function SWEP:Initialize() - self.Pointing = false - - if CLIENT then - self:Setup(self:GetOwner()) - end -end - function SWEP:PrimaryAttack() self.Pointing = not self.Pointing self:SetLaserEnabled(self.Pointing) From ba778bd8adc99f9fd2e82602920e6d4d576faff0 Mon Sep 17 00:00:00 2001 From: thecraftianman <64441307+thecraftianman@users.noreply.github.com> Date: Sat, 12 Jul 2025 13:04:14 -0400 Subject: [PATCH 5/6] Remove IsFirstTimePredicted checks for sounds --- lua/weapons/laserpointer/shared.lua | 4 ++-- lua/weapons/remotecontroller.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/weapons/laserpointer/shared.lua b/lua/weapons/laserpointer/shared.lua index 9366a38852..304707acff 100644 --- a/lua/weapons/laserpointer/shared.lua +++ b/lua/weapons/laserpointer/shared.lua @@ -62,12 +62,12 @@ function SWEP:SecondaryAttack() if SERVER then self.Receiver = trace.Entity owner:PrintMessage(HUD_PRINTTALK, "Linked Successfully!") - elseif (CLIENT or singleplayer) and IsFirstTimePredicted() then + elseif CLIENT or singleplayer then self:EmitSound("buttons/bell1.wav") end return true - elseif (CLIENT or singleplayer) and IsFirstTimePredicted() then + elseif CLIENT or singleplayer then self:EmitSound("buttons/button16.wav", 100, 50, 0.5) end end \ No newline at end of file diff --git a/lua/weapons/remotecontroller.lua b/lua/weapons/remotecontroller.lua index b069bba476..aae7f93858 100644 --- a/lua/weapons/remotecontroller.lua +++ b/lua/weapons/remotecontroller.lua @@ -39,10 +39,10 @@ function SWEP:PrimaryAttack() if SERVER and gamemode.Call("PlayerUse", ply, ent) then self.Linked = ent ply:ChatPrint("Remote Controller linked.") - elseif (CLIENT or game.SinglePlayer()) and IsFirstTimePredicted() then + elseif CLIENT or game.SinglePlayer() then self:EmitSound("buttons/bell1.wav") end - elseif (CLIENT or game.SinglePlayer()) and IsFirstTimePredicted() then + elseif CLIENT or game.SinglePlayer() then self:EmitSound("buttons/button16.wav", 100, 50) end end From 5ad737500dbf8df37e5370f41c6cf66f41b77a95 Mon Sep 17 00:00:00 2001 From: thecraftianman <64441307+thecraftianman@users.noreply.github.com> Date: Sun, 13 Jul 2025 11:38:41 -0400 Subject: [PATCH 6/6] Fix sounds in singleplayer --- lua/weapons/laserpointer/shared.lua | 6 ++++-- lua/weapons/remotecontroller.lua | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lua/weapons/laserpointer/shared.lua b/lua/weapons/laserpointer/shared.lua index 304707acff..3878a9ea08 100644 --- a/lua/weapons/laserpointer/shared.lua +++ b/lua/weapons/laserpointer/shared.lua @@ -42,7 +42,7 @@ function SWEP:PrimaryAttack() local pitch = self.Pointing and 120 or 80 self:EmitSound("ambient/energy/newspark03.wav", 100, pitch, 0.5) - return + if CLIENT then return end end if self.Pointing and IsValid(self.Receiver) then @@ -62,7 +62,9 @@ function SWEP:SecondaryAttack() if SERVER then self.Receiver = trace.Entity owner:PrintMessage(HUD_PRINTTALK, "Linked Successfully!") - elseif CLIENT or singleplayer then + end + + if CLIENT or singleplayer then self:EmitSound("buttons/bell1.wav") end diff --git a/lua/weapons/remotecontroller.lua b/lua/weapons/remotecontroller.lua index aae7f93858..15877ac9ef 100644 --- a/lua/weapons/remotecontroller.lua +++ b/lua/weapons/remotecontroller.lua @@ -39,7 +39,9 @@ function SWEP:PrimaryAttack() if SERVER and gamemode.Call("PlayerUse", ply, ent) then self.Linked = ent ply:ChatPrint("Remote Controller linked.") - elseif CLIENT or game.SinglePlayer() then + end + + if CLIENT or game.SinglePlayer() then self:EmitSound("buttons/bell1.wav") end elseif CLIENT or game.SinglePlayer() then