SHARE
TWEET

aaa)

a guest Oct 21st, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if SERVER then
  2.     local tr
  3.     util.AddNetworkString("puli_ot_babuli")
  4.     hook.Add("EntityFireBullets","",function(a,b)
  5.         tr = util.TraceLine({
  6.             start = b.Src,
  7.             endpos = b.Src + b.Dir * b.Distance,
  8.             filter = function( ent ) if ent:IsPlayer() then return false end if ( ent:GetClass()=="worldspawn" or IsValid(ent) ) then return true end end
  9.         })
  10.         net.Start("puli_ot_babuli")
  11.         net.WriteVector(tr.HitPos)
  12.         net.Broadcast()
  13.     end)
  14. else
  15.     local bullets={}
  16.     local bulletscl={}
  17.     net.Receive("puli_ot_babuli",function()
  18.         bullets[#bullets+1]=net.ReadVector() or Vector()
  19.         if #bullets > 40 then
  20.             table.remove(bullets,1)
  21.         end
  22.     end)
  23.     local tr
  24.     hook.Add("EntityFireBullets","",function(a,b)
  25.         tr = util.TraceLine({
  26.             start = b.Src,
  27.             endpos = b.Src + b.Dir * b.Distance,
  28.             filter = function( ent ) if ent:IsPlayer() then return false end if ( ent:GetClass()=="worldspawn" or IsValid(ent) ) then return true end end
  29.         })
  30.         bulletscl[#bulletscl+1]=tr.HitPos
  31.         if #bulletscl > 40 then
  32.             table.remove(bulletscl,1)
  33.         end
  34.     end)
  35.     hook.Add( "PostDrawTranslucentRenderables", "test", function()
  36.         for i=1,#bullets do
  37.             render.SetColorMaterial()
  38.             render.DrawSphere( bullets[i], 2, 10, 10, Color( 0, 0, 255, 100 ) )
  39.         end
  40.         for i=1,#bulletscl do
  41.             render.SetColorMaterial()
  42.             render.DrawSphere( bulletscl[i], 1.5, 10, 10, Color( 0, 255, 0, 100 ) )
  43.         end
  44.     end)
  45. end
  46.    
  47. print("ok")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top