Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ENT.Type = "anim"
- ENT.PrintName = "Spawnable Box"
- ENT.Author = "CGHippo"
- ENT.Contact = "Don't"
- ENT.Purpose = "Get health"
- ENT.Instructions = "Press E on me!"
- function ENT:Think()
- local pos = self:GetPos()
- local curve = math.abs(math.sin( CurTime() * 25 )) * 25 -- x = speed. Higher the number, the faster the motion. y = size. Higher the number, the bigger the change in position.
- self:SetPos( Vector(pos.x,pos.y,curve) )
- self:NextThink( CurTime() )
- return true
- end
- -- SHARED.LUA ABOVE --
- AddCSLuaFile( "cl_init.lua" ) -- Make sure clientside
- AddCSLuaFile( "shared.lua" ) -- and shared scripts are sent.
- AddCSLuaFile( "init.lua" )
- include( "shared.lua" )
- function ENT:Initialize()
- self:SetModel( "models/dav0r/hoverball.mdl" )
- self:PhysicsInit( SOLID_VPHYSICS ) -- Make us work with physics,
- self:SetMoveType( MOVETYPE_FLYGRAVITY ) -- after all, gmod is a physics
- self:SetSolid( SOLID_VPHYSICS ) -- Toolbox
- local phys = self:GetPhysicsObject()
- if (phys:IsValid()) then
- phys:Wake()
- end
- end
- function ENT:Use( activator, caller )
- if ( activator:IsPlayer() ) then
- activator:SetHealth( 150 )
- self:Remove()
- end
- end
- function ENT:Think()
- -- We don't need to think, we are just a prop after all!
- end
- -- INIT.LUA ABOVE --
- include('shared.lua')
- local rotate = {}
- function ENT:Draw()
- //Drawing the model
- self:DrawModel()
- local ang = self:GetAngles()
- cam.Start3D2D( self:GetPos(), ang, .5 )
- draw.RoundedBox( 1, -25, 25, 50, 20, Color(35, 35, 35, 255) )
- cam.End3D2D()
- cam.Start3D2D( self:GetPos(), Angle( 0, -90, 90 ), .5 )
- draw.DrawText( "Press E on me!", "TargetID", 0, 0, Color( 255, 255, 255, 255 ) )
- cam.End3D2D()
- end
- -- CL_INIT.LUA ABOVE --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement