Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script_name("tp")
- ev = require("lib.samp.events")
- speed = 70
- function main()
- while not isSampAvailable() do
- wait(0)
- end
- while not sampIsLocalPlayerSpawned() do
- wait(0)
- end
- wait(0)
- if isCharInAnyCar(PLAYER_PED) then
- freezeCarPositionAndDontLoadCollision(storeCarCharIsInNoSave(playerPed), false)
- end
- lua_thread.create(dates)
- sampAddChatMessage("Машино-ТелеПорт by Розвідка України и th Loaded | /tph - help", 4294967295.0)
- require("lib.bass").BASS_ChannelSetAttribute(slot1, BASS_ATTRIB_VOL, 0.04)
- require("lib.bass").BASS_ChannelPlay(slot1, false)
- sampRegisterChatCommand("tpg", start)
- sampRegisterChatCommand("tps", function ()
- data = 3
- stop = true
- end)
- sampRegisterChatCommand("tpspeed", function (slot0)
- speed = tonumber(slot0)
- sampAddChatMessage("Скорость: " .. slot0 .. "", 4294967295.0)
- end)
- sampRegisterChatCommand("tph", function ()
- sampAddChatMessage("/tpg - начать ТП | /tps - остановить ТП | /tpspeed - установить скорость ТП", 4294967295.0)
- end)
- end
- function start(slot0)
- result, mPosX, mPosY, _ = getTargetBlipCoordinates()
- slot0 = tonumber(slot0)
- if result == true then
- if slot0 then
- if slot0 > 1 then
- higth = slot0
- if isCharInAnyCar(PLAYER_PED) then
- data = 1
- else
- sampAddChatMessage("Вы должны находится в машине", 4294967295.0)
- end
- else
- sampAddChatMessage("Установите высоту больше единицы для ТелеПортации - /tpg *higth*", 4294967295.0)
- end
- else
- sampAddChatMessage("Установите высоту для ТелеПортации - /tpg *higth*", 4294967295.0)
- end
- else
- sampAddChatMessage("Поставьте метку для ТелеПортации", 4294967295.0)
- end
- end
- function dates()
- while true do
- wait(0)
- if data == 1 then
- gold_up()
- wait(speed)
- elseif data == 2 then
- gold_go()
- wait(speed)
- elseif data == 3 then
- gold_down()
- wait(speed)
- end
- end
- end
- function gold_up()
- send = true
- tp_process = true
- freezeCarPositionAndDontLoadCollision(storeCarCharIsInNoSave(playerPed), true)
- slot5, slot6, slot2 = getCharCoordinates(playerPed)
- setCharCoordinates(playerPed, slot0, slot1, slot2 + 10)
- if slot2 > higth - 10 then
- data = 2
- end
- send = false
- end
- function gold_go()
- send = true
- slot0, slot1, slot2 = getCharCoordinates(playerPed)
- setCarHeading(storeCarCharIsInNoSave(playerPed), getHeadingFromVector2d(mPosX - slot0, mPosY - slot1))
- if getDistanceBetweenCoords2d(mPosX, mPosY, slot0, slot1) < 20 then
- data = 3
- else
- slot0, slot1, slot2 = getOffsetFromCharInWorldCoords(playerPed, 0, 20, 0)
- setCharCoordinates(playerPed, slot3, slot4, higth)
- end
- send = false
- end
- function gold_down()
- send = true
- slot5, slot6, slot2 = getCharCoordinates(playerPed)
- setCharCoordinates(playerPed, slot0, slot1, slot2 - 10)
- if stop == true then
- if slot2 < getGroundZFor3dCoord(mPosX, mPosY, 999) + 20 then
- setCharCoordinates(playerPed, slot0, slot1, getGroundZFor3dCoord(slot0, slot1, 999))
- tp_process = false
- stop = false
- freezeCarPositionAndDontLoadCollision(storeCarCharIsInNoSave(playerPed), false)
- data = 0
- end
- elseif slot2 < getGroundZFor3dCoord(mPosX, mPosY, 999) + 20 then
- setCharCoordinates(playerPed, mPosX, mPosY, getGroundZFor3dCoord(mPosX, mPosY, 999))
- tp_process = false
- freezeCarPositionAndDontLoadCollision(storeCarCharIsInNoSave(playerPed), false)
- data = 0
- end
- send = false
- end
- function ev.onSendVehicleSync(slot0)
- if tp_process == true then
- slot0.moveSpeed.z = -0.2
- end
- if not send == true then
- return slot0
- else
- return false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement