CapsAdmin

Untitled

Mar 26th, 2011
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. easylua.Start(Ply"flyyte") -- this is just a helper thing so you have vars like "me" in the script which is yourself
  2.  
  3. local ENT = {}
  4.  
  5. ENT.Type = "anim"
  6. ENT.Base = "base_entity"
  7.  
  8. ENT.Model = Model("models/props_borealis/bluebarrel001.mdl")
  9. ENT.ClassName = "my_test_entity"
  10.  
  11. if CLIENT then
  12.     function ENT:Draw()
  13.         self:DrawModel()
  14.     end
  15. end
  16.    
  17. if SERVER then
  18.     function ENT:Initialize()
  19.         self:SetModel( self.Model ) -- self is ENT
  20.        
  21.         self:PhysicsInit( SOLID_VPHYSICS )
  22.         self:SetMoveType( MOVETYPE_VPHYSICS )
  23.         self:SetSolid( SOLID_VPHYSICS )
  24.         self:PhysWake()
  25.     end
  26.    
  27.     function ENT:Think()
  28.        
  29.         self:NextThink(CurTime() + 1) -- think once a second. make it 0 to think every frame
  30.         return true
  31.     end
  32. end
  33.  
  34. -- more hooks can be found at http://wiki.garrysmod.com/?title=Entity_Hooks
  35.  
  36. scripted_ents.Register(ENT, ENT.ClassName, true)
  37.  
  38. -- uncomment this if you want to make it update without the need to respawn it
  39.  
  40. --for key, entity in pairs(ents.FindByClass(ENT.ClassName)) do
  41. --  table.Merge(entity:GetTable(), ENT)
  42. --  entity:Initialize() -- this will call ENT:Initialize()
  43. --end
  44.  
  45. if SERVER then
  46.     create(ENT.ClassName) -- this helper function is made by easylua. It will spawn an entity on the ground where you're looking, and you can undo it with z
  47. end
  48.  
  49. easylua.End()
Advertisement
Add Comment
Please, Sign In to add comment