Advertisement
sparkspg

Untitled

May 19th, 2014
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.81 KB | None | 0 0
  1. local teleBoxes = {
  2.         {Center = Vector(-1865.32, -393.72, -4863.968750), Size = Vector(50,23,60), TelePos = Vector(-1845.35,-342.75,-4840.97),TelePos2 = Vector(-1873.943237,-340.656250,-4777.968750),TelePos3 = Vector(-1871.898682,-340.746216,-4719.968750), ComeBack = (Vector(-1866.575073,-414.372101,-4863.968750))},    
  3.         {Center = Vector(-1700.471069,-393.72,-4863.968750), Size = Vector(50,23,60), TelePos = Vector(-2034.09,-501.35,-4766.344),TelePos2 = Vector(-1693.230347,-337.328156,-4777.968750),TelePos3 = Vector(-1693.230347,-337.328156,-4719.570313),ComeBack = (Vector(-1866.575073,-414.372101,-4863.968750))},
  4.         {Center = Vector(-1866.508301,-505,-4863.968750), Size = Vector(50,23,60), TelePos = Vector(-1825.217285,-557.164001,-4831.598633),TelePos2 = Vector(-1862.846558,-554.872559,-4777.968750),TelePos3 = Vector(-1868.771729,-554.842834,-4719.968750),ComeBack = (Vector(-1866.575073,-414.372101,-4863.968750))},
  5.         {Center = Vector(-1700.999390,-504.649078,-4863.968750), Size = Vector(50,23,60), TelePos = Vector(-1699.032227,-554.086487,-4831.968750),TelePos2 = Vector(-1683.000488,-557.165771,-4777.968750),TelePos3 = Vector(-1688.121826,-559.982605,-4719.968750),ComeBack = (Vector(-1866.575073,-414.372101,-4863.968750))}
  6.         }
  7.  
  8. for k,v in ipairs(teleBoxes) do
  9.         local vCenter,boxSize = v.Center, v.Size
  10.         local mins,maxs = vCenter-Vector(boxSize.x,boxSize.y, 0), vCenter+boxSize
  11.    
  12.         teleBoxes[k].Mins = mins
  13.         teleBoxes[k].Maxs = maxs
  14. end
  15.  
  16. if SERVER then
  17.         AddCSLuaFile()
  18.        
  19.         hook.Add("KeyPress", "KeyPress.TeleportBox", function(ply, key,bed)
  20.                 for k,v in ipairs(teleBoxes) do
  21.                         local vCenter,boxSize = v.Center, v.Size
  22.                         local mins,maxs = v.Mins, v.Maxs
  23.                        
  24.                         if (key == IN_USE) and ply:GetPos():WithinAABox(mins, maxs) then
  25.                        
  26.         ply:DrawWorldModel(false)
  27.         ply:DrawViewModel(false)
  28.         ply:SetNoTarget(true)
  29.         ply:SetParent(RagDoll)
  30.         local RagDoll = ents.Create("prop_ragdoll")
  31.         RagDoll:SetModel(ply:GetModel())
  32.         RagDoll:SetName(ply:GetName())
  33.         RagDoll:SetColor(ply:GetColor())
  34.         RagDoll:SetMaterial(ply:GetMaterial())
  35.         RagDoll:SetPos(v.TelePos)
  36.         //if !RagDoll:GetPos(v.TelePos) then RagDoll.Bed1Used = false end
  37.         if RagDoll:GetPos(v.TelePos) then RagDoll.Bed1Used = true end
  38.         if RagDoll:GetPos(v.TelePos2) then RagDoll.Bed2Used = true end
  39.         if RagDoll:GetPos(v.TelePos3) then RagDoll.Bed3Used = true end
  40.         if !RagDoll.Bed1Used then RagDoll:SetPos(v.TelePos) end
  41.         if RagDoll.Bed1Used then RagDoll:SetPos(v.TelePos2) end
  42.         if RagDoll.Bed2Used then RagDoll:SetPos(v.TelePos3) end
  43.         //RagDoll:SetPos(v.TelePos)
  44.         RagDoll:SetAngles(Angle(-40,0,0))
  45.         RagDoll:SetHealth(ply:Health())
  46.         RagDoll:SetOwner(ply)
  47.         RagDoll:Spawn()
  48.         RagDoll:Activate()
  49.         ply:Spectate( OBS_MODE_CHASE )
  50.         ply:SpectateEntity( RagDoll )
  51.         ply:SetEyeAngles(Angle(0,90,0))
  52.         timer.Simple(12, function()
  53.  
  54.        
  55.                     Unrag(ply, RagDoll)
  56.                 ply:SetPos(v.ComeBack) end)            
  57.                                
  58.                                     //ply:SetAngles(7.24,-90.96,0.0):Angle() end)
  59.                                
  60.                         end
  61.                 end
  62.         end)
  63. else
  64.         hook.Add("PostDrawOpaqueRenderables", "PDOR.TeleBoxDebug", function()
  65.                 for k,v in ipairs(teleBoxes) do
  66.                         local vCenter,boxSize = v.Center, v.Size
  67.                         render.DrawWireframeBox(vCenter, Angle(), -Vector(boxSize.x,boxSize.y, 0), boxSize, Color(0,0,255), true)
  68.                 end
  69.         end)
  70. end
  71. function Unrag(ply,RagDoll)
  72.     ply:SetDSP( 4, false)
  73.     ply:Spectate(0)
  74.     ply:SpectateEntity()
  75.     ply:UnSpectate( RagDoll )
  76.     ply:Spawn()
  77.     //ply:SetPos(v.ComeBack)
  78.     RagDoll:Remove()
  79.     ply:DrawWorldModel(true)
  80.     ply:DrawViewModel(true)
  81.     ply:SetNoTarget(false)
  82.     ply:Freeze(false)
  83.     //ply:SetHealth(health)
  84.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement