Loading

Paste #pa7vplnyl

  1. TeleportLocations = {
  2.     mine_to_ug_top = "mineugtop",
  3.     mine_to_ug_bot = "mineugbot",
  4.     ug_to_mine_top = "minetop",
  5.     ug_to_mine_bot = "minebot"
  6. }
  7.  
  8. function Teleport(trigger)
  9.     print ("You are coming from " .. trigger.caller:GetName())
  10.    
  11.     local hname = trigger.caller:GetName()
  12.     local activatorPlayer = trigger.activator
  13.     local new_position
  14.  
  15.     if TeleportLocations[hname] then new_position = Entities:FindByName(nil, TeleportLocations[hname])
  16.    
  17.     activatorPlayer:Stop()
  18.     activatorPlayer:SetAbsOrigin(new_position:GetAbsOrigin())
  19.    
  20.     PlayerResource:SetCameraTarget(0,activatorPlayer)
  21.     Timers.CreateTimer(0.1,
  22.         function()
  23.             PlayerResource:SetCameraTarget(0,nil)
  24.         end
  25.     )
  26. end