Skip to content

Instantly share code, notes, and snippets.

@marcogravbrot
Created December 20, 2020 23:45
Show Gist options
  • Save marcogravbrot/a3a95855329289b8aa734a72cf7b149e to your computer and use it in GitHub Desktop.
Save marcogravbrot/a3a95855329289b8aa734a72cf7b149e to your computer and use it in GitHub Desktop.
CreateConVar("rocketbullets", 0, {}, "Whether or not bullets should be rockets.")
hook.Add("EntityFireBullets", "Rocket bullets", function(ent, data)
if GetConVar("rocketbullets"):GetBool() then
local rocket = ents.Create("rpg_missile")
rocket:SetPos(data.Src + Vector(0, 0, 20))
rocket:SetAngles((data.Dir + data.Spread):GetNormalized():Angle())
rocket:SetOwner(data.Attacker)
rocket:Spawn()
rocket:SetVelocity(data.Dir * 20)
rocket:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
return false
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment