Python1320

Untitled

Dec 1st, 2010
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. local ENT = {}
  2.  
  3. ENT.Type = "anim"
  4. ENT.Base = "base_entity"
  5.  
  6. ENT.Model = Model("")
  7. ENT.ClassName = ""
  8.  
  9. if CLIENT then
  10.  
  11.     function ENT:Draw()
  12.         self:DrawModel()
  13.     end
  14.  
  15. else
  16.     function ENT:Initialize()
  17.         self:SetModel( self.Model )
  18.         self:PhysicsInit( SOLID_VPHYSICS )
  19.         self:SetMoveType( MOVETYPE_VPHYSICS )
  20.         self:SetSolid( SOLID_VPHYSICS )
  21.         self:PhysWake()
  22.     end
  23. end
  24.  
  25. scripted_ents.Register(ENT, ENT.ClassName, true)
  26.  
  27. for key, entity in pairs(ents.FindByClass(ENT.ClassName)) do
  28.     table.Merge(entity:GetTable(), ENT)
  29.     entity:Initialize()
  30. end
  31.  
  32. if SERVER then
  33.     if #ents.FindByClass(ENT.ClassName) > 0 then return end
  34.  
  35.     local player = nero.GetPlayer("caps") --<<<<<<<<<<<<<<<<<<<<<<<< your name here!
  36.     local trace = player:GetEyeTrace()
  37.     local entity = ents.Create(ENT.ClassName)
  38.     entity:Spawn()
  39.     entity:SetPos(trace.HitPos + Vector(0,0,entity:BoundingRadius()))
  40.     entity:DropToFloor()
  41.    
  42.     undo.Create(class)
  43.         undo.SetPlayer(player)
  44.         undo.AddEntity(entity)
  45.     undo.Finish()
  46. end
Add Comment
Please, Sign In to add comment