MCiLuZiioNz

Untitled

May 25th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. -- Somewhere in an an autorun file 'lua/autorun/client'
  2. if !ConVarExists("cl_dynamic_tracer") then
  3.     CreateClientConVar("cl_dynamic_tracer", 1, true, false, "Enable/Disable dynamic lighting on Star Wars weapons")
  4. end
  5.  
  6. -- In the actual function file for the tracer effect
  7. -- If you want to check for the ConVar
  8. local DynamicTrace = GetConVar("cl_dynamic_tracer")
  9.  
  10. function EFFECT:Think()
  11.     self.LifeTime = self.LifeTime - FrameTime();
  12.     self.StartTime = self.StartTime + FrameTime();
  13.     if (DynamicTrace:GetBool()) then
  14.         local spawn = util.CRC(tostring(self:GetPos()))
  15.         local dlight = DynamicLight( self:EntIndex() + spawn)
  16.         local endDistance = self.Speed * self.StartTime;
  17.         local endPos = self.StartPos + self.Normal * endDistance;
  18.         if ( dlight ) then
  19.             dlight.pos = endPos
  20.             dlight.r = 0
  21.             dlight.g = 0
  22.             dlight.b = 153
  23.             dlight.brightness = 3
  24.             dlight.Decay = 1000
  25.             dlight.Size = 300
  26.             dlight.DieTime = CurTime() + 3
  27.         end
  28.        
  29.     end
  30.     return self.LifeTime > 0;
  31. end
Advertisement
Add Comment
Please, Sign In to add comment