Ghost Spec deathmatch error

Cake anti cheat says that “addons/ttt_spectator_deathmatch-master/lua/weapons/weapon_ghost_crowbar.lua: 122-128” is exploitable to crash the server how would I go about fixing it.

this is lines 121 - 129
if SERVER then
net.Receive(“BulletGhost”, function()
local str = net.ReadString()
local vector = net.ReadVector()
local num = net.ReadUInt(32)
if num == 0 then num = nil end
sound.Play(str, vector, num)
end)
end

You can’t crash the server with it, but you can ear rape the server with it. About fixing it I have no idea.

Thanks, You really are number 1.

You can check if all the information being sent from the client is legit, not some malicious volume or wrong vector because some clients can just send fake info.

Remove this part. (https://github.com/Tommy228/TTT_Spectator_Deathmatch/blob/master/lua/weapons/weapon_ghost_crowbar.lua#L121-L129)

And add here an if CLIENT-Check. https://github.com/Tommy228/TTT_Spectator_Deathmatch/blob/master/lua/weapons/weapon_ghost_base.lua#L254-L260
It should be
[lua]
if CLIENT then
net.Receive(“BulletGhost”, function()
local str = net.ReadString()
local vector = net.ReadVector()
local num = net.ReadUInt(32)
if num == 0 then num = nil end
sound.Play(str, vector, num)
end)
end
[/lua]
Then everything will be fine.