pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

Lua paste-bin - collaborative debugging tool View Help


Posted by Anonymous on Tue 16th Jan 17:11
download | new post

  1. function ENT:TrackEntity( ent )
  2.  
  3.         if ( !ent || !ent:IsValid() ) then return end
  4.        
  5.         local WPos = ent:GetPos()
  6.         WPos.y = 64;
  7.         WPos = WPos + Vector( 20, 0, 100 )
  8.  
  9.         if (self.Entity:GetPos() - WPos):Length() > 400 then        self.Entity:SetPos(WPos)    Msg("to far away!\n")       end
  10.        
  11.         local v = ent:GetVelocity()
  12.         v.y = 0
  13.        
  14.         local adjustVec = Vector(self.Entity:GetPos().x, self.Entity:GetPos().y, WPos.z)
  15.  
  16.         if (v.z == 0) then
  17.                 self.Entity:SetPos( adjustVec )
  18.         end
  19.        
  20.         if (SERVER) then
  21.                 self.Entity:SetLocalVelocity( v )
  22.         end
  23.        
  24.         local Ang = ent:GetPos() - WPos
  25.         Ang = Ang:Angle()
  26. Ang.Pitch = 0
  27.         self.Entity:SetAngles(Ang)
  28.  
  29. end

Submit a correction or amendment below. (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Use syntax highlighting

To highlight particular lines, prefix each line with @@


Remember my settings