FSNeZ

call.lua

Nov 14th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. local command_name = "call"
  2.  
  3. safe_pcall(function()
  4.  
  5. local local_player_manager = Managers.player
  6. if not local_player_manager or not local_player_manager.is_server then
  7. EchoConsole("Not the host!")
  8. return
  9. end
  10.  
  11. local local_player = local_player_manager:local_player()
  12. local local_player_unit = local_player.player_unit
  13. if not Unit.alive(local_player_unit) then
  14. EchoConsole("No teleport destination!")
  15. return
  16. end
  17.  
  18. local player_position = Unit.local_position(local_player_unit, 0)
  19.  
  20. for _, bot_player in ipairs(Managers.player:bots()) do
  21. local bot_unit = bot_player.player_unit
  22. if Unit.alive(bot_unit) then
  23.  
  24. if ScriptUnit.has_extension(bot_unit, "status_system") then
  25. local status_extension = ScriptUnit.extension(bot_unit, "status_system")
  26.  
  27. if not status_extension.knocked_down and not status_extension.dead and ScriptUnit.has_extension(bot_unit, "locomotion_system") then
  28. local locomotion_extension = ScriptUnit.extension(bot_unit, "locomotion_system")
  29.  
  30. if not locomotion_extension._disabled then
  31. status_extension.fall_height = -1 * math.huge
  32. locomotion_extension.teleport_to(locomotion_extension, player_position)
  33. status_extension.fall_height = -1 * math.huge
  34. end
  35. end
  36. end
  37. end
  38. end
  39. end)
Advertisement
Add Comment
Please, Sign In to add comment