Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.79 KB | None | 0 0
  1. script_name("tp")
  2.  
  3. ev = require("lib.samp.events")
  4. speed = 70
  5.  
  6. function main()
  7. while not isSampAvailable() do
  8. wait(0)
  9. end
  10.  
  11. while not sampIsLocalPlayerSpawned() do
  12. wait(0)
  13. end
  14.  
  15. wait(0)
  16.  
  17. if isCharInAnyCar(PLAYER_PED) then
  18. freezeCarPositionAndDontLoadCollision(storeCarCharIsInNoSave(playerPed), false)
  19. end
  20.  
  21. lua_thread.create(dates)
  22. sampAddChatMessage("Машино-ТелеПорт by Розвідка України и th Loaded | /tph - help", 4294967295.0)
  23. require("lib.bass").BASS_ChannelSetAttribute(slot1, BASS_ATTRIB_VOL, 0.04)
  24. require("lib.bass").BASS_ChannelPlay(slot1, false)
  25. sampRegisterChatCommand("tpg", start)
  26. sampRegisterChatCommand("tps", function ()
  27. data = 3
  28. stop = true
  29. end)
  30. sampRegisterChatCommand("tpspeed", function (slot0)
  31. speed = tonumber(slot0)
  32.  
  33. sampAddChatMessage("Скорость: " .. slot0 .. "", 4294967295.0)
  34. end)
  35. sampRegisterChatCommand("tph", function ()
  36. sampAddChatMessage("/tpg - начать ТП | /tps - остановить ТП | /tpspeed - установить скорость ТП", 4294967295.0)
  37. end)
  38. end
  39.  
  40. function start(slot0)
  41. result, mPosX, mPosY, _ = getTargetBlipCoordinates()
  42. slot0 = tonumber(slot0)
  43.  
  44. if result == true then
  45. if slot0 then
  46. if slot0 > 1 then
  47. higth = slot0
  48.  
  49. if isCharInAnyCar(PLAYER_PED) then
  50. data = 1
  51. else
  52. sampAddChatMessage("Вы должны находится в машине", 4294967295.0)
  53. end
  54. else
  55. sampAddChatMessage("Установите высоту больше единицы для ТелеПортации - /tpg *higth*", 4294967295.0)
  56. end
  57. else
  58. sampAddChatMessage("Установите высоту для ТелеПортации - /tpg *higth*", 4294967295.0)
  59. end
  60. else
  61. sampAddChatMessage("Поставьте метку для ТелеПортации", 4294967295.0)
  62. end
  63. end
  64.  
  65. function dates()
  66. while true do
  67. wait(0)
  68.  
  69. if data == 1 then
  70. gold_up()
  71. wait(speed)
  72. elseif data == 2 then
  73. gold_go()
  74. wait(speed)
  75. elseif data == 3 then
  76. gold_down()
  77. wait(speed)
  78. end
  79. end
  80. end
  81.  
  82. function gold_up()
  83. send = true
  84. tp_process = true
  85.  
  86. freezeCarPositionAndDontLoadCollision(storeCarCharIsInNoSave(playerPed), true)
  87.  
  88. slot5, slot6, slot2 = getCharCoordinates(playerPed)
  89.  
  90. setCharCoordinates(playerPed, slot0, slot1, slot2 + 10)
  91.  
  92. if slot2 > higth - 10 then
  93. data = 2
  94. end
  95.  
  96. send = false
  97. end
  98.  
  99. function gold_go()
  100. send = true
  101. slot0, slot1, slot2 = getCharCoordinates(playerPed)
  102.  
  103. setCarHeading(storeCarCharIsInNoSave(playerPed), getHeadingFromVector2d(mPosX - slot0, mPosY - slot1))
  104.  
  105. if getDistanceBetweenCoords2d(mPosX, mPosY, slot0, slot1) < 20 then
  106. data = 3
  107. else
  108. slot0, slot1, slot2 = getOffsetFromCharInWorldCoords(playerPed, 0, 20, 0)
  109.  
  110. setCharCoordinates(playerPed, slot3, slot4, higth)
  111. end
  112.  
  113. send = false
  114. end
  115.  
  116. function gold_down()
  117. send = true
  118. slot5, slot6, slot2 = getCharCoordinates(playerPed)
  119.  
  120. setCharCoordinates(playerPed, slot0, slot1, slot2 - 10)
  121.  
  122. if stop == true then
  123. if slot2 < getGroundZFor3dCoord(mPosX, mPosY, 999) + 20 then
  124. setCharCoordinates(playerPed, slot0, slot1, getGroundZFor3dCoord(slot0, slot1, 999))
  125.  
  126. tp_process = false
  127. stop = false
  128.  
  129. freezeCarPositionAndDontLoadCollision(storeCarCharIsInNoSave(playerPed), false)
  130.  
  131. data = 0
  132. end
  133. elseif slot2 < getGroundZFor3dCoord(mPosX, mPosY, 999) + 20 then
  134. setCharCoordinates(playerPed, mPosX, mPosY, getGroundZFor3dCoord(mPosX, mPosY, 999))
  135.  
  136. tp_process = false
  137.  
  138. freezeCarPositionAndDontLoadCollision(storeCarCharIsInNoSave(playerPed), false)
  139.  
  140. data = 0
  141. end
  142.  
  143. send = false
  144. end
  145.  
  146. function ev.onSendVehicleSync(slot0)
  147. if tp_process == true then
  148. slot0.moveSpeed.z = -0.2
  149. end
  150.  
  151. if not send == true then
  152. return slot0
  153. else
  154. return false
  155. end
  156. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement