Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
BulletGhost Exploit fix
Browse files Browse the repository at this point in the history
Now BulletGhost is really client side

- Removed useless checks before GiveGhostWeapons()
  • Loading branch information
MinIsMin committed Jun 6, 2017
1 parent 890b1cd commit b5039dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 1 addition & 3 deletions lua/sv_specdm_overrides.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ hook.Add("PlayerSpawn", "PlayerSpawn_SpecDM", function(ply)
if ply:IsGhost() then
ply.has_spawned = true
ply:UnSpectate()
if IsValid(ply) and ply:IsGhost() and ply:GetWeapons() == nil then
ply:GiveGhostWeapons()
end
ply:GiveGhostWeapons()
hook.Call("PlayerSetModel", GAMEMODE, ply)
end
end)
Expand Down
16 changes: 8 additions & 8 deletions lua/weapons/weapon_ghost_base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ if CLIENT then
-- This sets the icon shown for the weapon in the DNA sampler, search window,
-- equipment menu (if buyable), etc.
SWEP.Icon = "vgui/ttt/icon_nades" -- most generic icon I guess

net.Receive("SpecDM_BulletGhost", function()
local str = net.ReadString()
local vector = net.ReadVector()
local num = net.ReadUInt(19)
if num == 0 then num = nil end
sound.Play(str, vector, num)
end)

-- You can make your own weapon icon using the template in:
-- /garrysmod/gamemodes/terrortown/template/
Expand Down Expand Up @@ -250,14 +258,6 @@ function SWEP:PrimaryAttack(worldsnd)
owner:ViewPunch( Angle( math.Rand(-0.2,-0.1) * self.Primary.Recoil, math.Rand(-0.1,0.1) * self.Primary.Recoil, 0 ) )
end

net.Receive("SpecDM_BulletGhost", function()
local str = net.ReadString()
local vector = net.ReadVector()
local num = net.ReadUInt(19)
if num == 0 then num = nil end
sound.Play(str, vector, num)
end)

function SWEP:DryFire(setnext)
if CLIENT and LocalPlayer() == self.Owner then
self:EmitSound( "Weapon_Pistol.Empty" )
Expand Down

0 comments on commit b5039dc

Please sign in to comment.