Advertisement
PlayersZero

Gmod smokebomb

Feb 5th, 2019
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.69 KB | None | 0 0
  1. //SMOKEBOMB START
  2. local CanUse_smoke = true
  3. local timeCD = 60
  4.  
  5. hook.Add("Think", "smokebomb_in_use", function (ply)
  6.     local ply = LocalPlayer()
  7.     if ply:PS_HasItemEquipped("smokebomb") then
  8.         if input.IsKeyDown(KEY_G) and CanUse_smoke == true then
  9.             local smokeduration = 3
  10.             local pos = ply:GetPos()
  11.             local ang = ply:GetAngles()
  12.             local h = ScrH()
  13.             local l = ScrW()
  14.             local smoke1 = Model("particle/particle_smokegrenade")
  15.             local smoke2 = Model("particle/particle_noisesphere")
  16.             local function makeSmoke()
  17.                 for i = 1, 25 do
  18.                     local smokes = {smoke1, smoke2}
  19.                     local emm = ParticleEmitter(pos)
  20.                     local ent_smoke = emm:Add(table.Random(smokes), pos)
  21.                     if ent_smoke then
  22.                         local gray = math.random(50, 150)
  23.                         ent_smoke:SetColor(gray, gray, gray)
  24.                         ent_smoke:SetLifeTime(0)
  25.                         ent_smoke:SetStartAlpha(255)
  26.                         ent_smoke:SetEndAlpha(200)
  27.                         ent_smoke:SetVelocity(VectorRand() * math.Rand(900, 1300))
  28.                         ent_smoke:SetDieTime(math.Rand(50, 70))
  29.                         ent_smoke:SetStartSize(350)
  30.                         ent_smoke:SetEndSize(math.random(1, 40))
  31.                         ent_smoke:SetRoll(math.random(-180, 180))
  32.                         ent_smoke:SetRollDelta(math.Rand(-0.1, 0.1))
  33.                         ent_smoke:SetAirResistance(600)
  34.                         ent_smoke:SetCollide(true)
  35.                         ent_smoke:SetBounce(0.4)
  36.                         ent_smoke:SetLighting(false)
  37.                         CanUse_smoke = false
  38.                         timer.Simple(timeCD, function ()
  39.                             CanUse_smoke = true
  40.                         end)
  41.                     end
  42.                 end
  43.             end
  44.             makeSmoke()
  45.         end
  46.     end
  47. end)
  48. //SMOKEBOMB END
  49. //Coded from scratch by Zero
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement