Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2010
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.45 KB | None | 0 0
  1. --init.lua--
  2. AddCSLuaFile ( "cl_init.lua" )
  3. AddCSLuaFile ( "shared.lua" )
  4.  
  5. include ('shared.lua' )
  6.  
  7. local Position = self.GetPos()
  8.  
  9. function ENT.Initialize(self)
  10.  
  11.     self.Entity:SetModel( "models/props_lab/jar01b.mdl" )
  12.     self.Entity:PhysicsInit( SOLID_VPHYSICS )
  13.     self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
  14.     self.Entity:SetSolid( SOLID_VPHYSICS )
  15.    
  16.     local phys = self.Entity:GetPhysicsObject()
  17.    
  18.         if (phys:IsValid()) then
  19.             phys:Wake()
  20.         end
  21. end
  22.  
  23. function ENT:Use ( activator, caller )
  24.  
  25.     self:Remove()
  26.     return
  27. end
  28.  
  29. function ENT:Think()
  30.  
  31. end
  32.  
  33. --shared.lua--
  34.  
  35. ENT.Type = "anim"
  36. ENT.Base = "base_gmodentity"
  37.  
  38. ENT.PrintName       = "Drug"
  39. ENT.Author          = "Atwal"
  40. ENT.Contact         = "None"
  41. ENT.Purpose         = "Heal up"
  42. ENT.Instructions    = "Click E to recieve affects"
  43.  
  44. --cl_init.lua--
  45.  
  46. include('shared.lua')
  47.  
  48. function ENT:draw()
  49.  
  50.     self.DrawEntityOutline( 1.0 )
  51.     self.Entity:DrawModel()
  52.    
  53. end
  54.  
  55. function ENT:Emit()
  56.  
  57.     local em = ParticleEmitter(Position)
  58.    
  59.     if math.random(1,5) == 3 then
  60.  
  61.  
  62.      local part = em:Add("sprites/light_glow02_add", Position)
  63.      if part then
  64.           part:SetColor(0,255,0,math.random(255))
  65.           part:SetVelocity(Vector(math.random(-1,1),math.random(-1,1),math.random(-1,1)):GetNormal() * 20)
  66.           part:SetDieTime(0.5)
  67.           part:SetLifeTime(0)
  68.           part:SetStartSize(10)
  69.           part:SetEndSize(0)
  70.      
  71. end
  72. em:Finish()
  73. end
  74. end
  75. hook.Add( "Think", "Particle", ENT:Emit() )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement