Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- easylua.Start(Ply"flyyte") -- this is just a helper thing so you have vars like "me" in the script which is yourself
- local ENT = {}
- ENT.Type = "anim"
- ENT.Base = "base_entity"
- ENT.Model = Model("models/props_borealis/bluebarrel001.mdl")
- ENT.ClassName = "my_test_entity"
- if CLIENT then
- function ENT:Draw()
- self:DrawModel()
- end
- end
- if SERVER then
- function ENT:Initialize()
- self:SetModel( self.Model ) -- self is ENT
- self:PhysicsInit( SOLID_VPHYSICS )
- self:SetMoveType( MOVETYPE_VPHYSICS )
- self:SetSolid( SOLID_VPHYSICS )
- self:PhysWake()
- end
- function ENT:Think()
- self:NextThink(CurTime() + 1) -- think once a second. make it 0 to think every frame
- return true
- end
- end
- -- more hooks can be found at http://wiki.garrysmod.com/?title=Entity_Hooks
- scripted_ents.Register(ENT, ENT.ClassName, true)
- -- uncomment this if you want to make it update without the need to respawn it
- --for key, entity in pairs(ents.FindByClass(ENT.ClassName)) do
- -- table.Merge(entity:GetTable(), ENT)
- -- entity:Initialize() -- this will call ENT:Initialize()
- --end
- if SERVER then
- 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
- end
- easylua.End()
Advertisement
Add Comment
Please, Sign In to add comment