Исходник Source Teleport fo Arizona Rp | by Damag

damag

Женюсь на официантке в моем любимом баре
Автор темы
Проверенный
1,152
1,192
Всем здрасти! После как я увидел, где продают говно-сурс от телепорта, решил слить я его вам, но только лучше. Бывают овер много киков(Сервер Говно)
В коде вы можете сами настроить задержу и дистанцию тп, дабы избежать киков!
Можно пошаманить, и сделать овер крутой телепорт.
Сливаю его, чтобы вы его доработали и пользовались, я не хочу чтобы на вас наварились недо-скриптеры!
Если хотите нормальный телпепорт вам к астапу.(Не реклама)



видео:


И конечно говно-код:
Lua:
local q = require 'lib.samp.events'
local samp = require 'lib.samp.events'
local vector = require 'vector3d'
local tp, sync = false, false
local tpCount, timer = 0, 0


function main()
    while not isSampAvailable() do wait(0) end
    sampAddChatMessage("{808080}[teleport_by_damag]: {FFFFFF}”спешно загружен.", 0xFFFFFF)
    sampAddChatMessage("{808080}[teleport_by_damag]: {FFFFFF} мд: /dtp - тп на метку; /dtpc - тп на чекпоинт", 0xFFFFFF)
    sampRegisterChatCommand('dtp', function()
    lua_thread.create(function()
        if tp then return sampAddChatMessage('уже телепортируемс¤', -1) end
        
            blip, blipX, blipY, blipZ = getTargetBlipCoordinatesFixed()
            if blip then
                sync = true
                charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
                local distan = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
                if distan < 23 then return setCharCoordinates(playerPed, blipX, blipY, blipZ) end
                setCharCoordinates(playerPed, blipX, blipY, blipZ)
                tp = true
                printStringNow('~y~iSetPlayerPos: ~p~true', 4000)
            end
        end)
    end)
    sampRegisterChatCommand('dtpc', function()
    lua_thread.create(function()
        if tp then return sampAddChatMessage('уже телепортируемс§', -1) end
        
            blip, blipX, blipY, blipZ = SearchMarker(blipX, blipY, blipZ)
            if blip then
                sync = true
                tpp = true
                charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
                local distan = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
                if distan < 23 then return setCharCoordinates(playerPed, blipX, blipY, blipZ) end
                tp = true
                setCharCoordinates(playerPed, blipX, blipY, blipZ)
                wait(228)
                printStringNow('~y~iSetPlayerPos: ~p~true', 4000)
            end
        end)
    end)
        while true do wait(0)
            if os.clock() - timer > 4000 and sync then
              timer, tpCount = 0, 0
              sync = true
              sampForceOnfootSync()
              sync = false
            end
            if tp then
                if getDistanceBetweenCoords3d(blipX, blipY, blipZ, charPosX, charPosY, charPosZ) > 23 then
                    vectorX = blipX - charPosX
                    vectorY = blipY - charPosY
                    vectorZ = blipZ - charPosZ
                    local vec = vector(vectorX, vectorY, vectorZ)
                    vec:normalize()
                    charPosX = charPosX + vec.x * 23
                    charPosY = charPosY + vec.y * 23
                    charPosZ = charPosZ + vec.z * 23
                    --tpc()
                    --ttp()
                    sendOnfootSync(charPosX, charPosY, charPosZ)
                    sendOnfootSync(charPosX, charPosY, charPosZ)
                    
                    tpCount = tpCount + 1
                    if tpCount == 35 then
                    sampForceOnfootSync()
                    sendOnfootSync(charPosX, charPosY, charPosZ)
                    printStringNow('~y~iSetPlayerPos: ~g~true', 434)
                      sendOnfootSync(charPosX, charPosY + 55, charPosZ)
                      wait(1828)
                       sampForceOnfootSync()
                       sendOnfootSync(charPosX, charPosY, charPosZ)
                       wait(math.random(2000,888))
                       sendOnfootSync(charPosX, charPosY, charPosZ)
                      sampForceOnfootSync()
                      wait(228)
                      tpCount = 0
                      printStringNow('~y~iSetPlayerPos: ~r~false', 434)
                      sendOnfootSync(charPosX, charPosY, charPosZ)
                    end
                else
                  sendOnfootSync(charPosX, charPosY, charPosZ + 2)
                  printStringNow('~y~iSetPlayerPos: ~b~false', 898)
                  sendOnfootSync(charPosX, charPosY + 55, charPosZ + 3)
                  sync = false
                  sendOnfootSync(charPosX, charPosY, charPosZ + 2)
                  wait(1000)
                  printStringNow("~>~ ~p~successful ~s~teleport ~<~",2500)
                  addOneOffSound(0.0, 0.0, 0.0, 1139)
                  sync = true
                  sendOnfootSync(charPosX, charPosY, charPosZ + 2)
                  sync = false
                  wait(75)
                  setCharCoordinates(playerPed, blipX, blipY, blipZ + 1)
                  tp = false
                  timer, tpCount = 0, 0
                end
            end
        end
    wait(-1)
end



function q.onSetPlayerPos(p)
    if sync then
        timer = os.clock()
        return false
    end
end

function q.onSendPlayerSync(data)
    if tp then return false end
end

function samp_create_sync_data(sync_type, copy_from_player)
    local ffi = require 'ffi'
    local sampfuncs = require 'sampfuncs'
    -- from SAMP.Lua
    local raknet = require 'samp.raknet'
    --require 'samp.synchronization'

    copy_from_player = copy_from_player or true
    local sync_traits = {
        player = {'PlayerSyncData', raknet.PACKET.PLAYER_SYNC, sampStorePlayerOnfootData},
        vehicle = {'VehicleSyncData', raknet.PACKET.VEHICLE_SYNC, sampStorePlayerIncarData},
        passenger = {'PassengerSyncData', raknet.PACKET.PASSENGER_SYNC, sampStorePlayerPassengerData},
        aim = {'AimSyncData', raknet.PACKET.AIM_SYNC, sampStorePlayerAimData},
        trailer = {'TrailerSyncData', raknet.PACKET.TRAILER_SYNC, sampStorePlayerTrailerData},
        unoccupied = {'UnoccupiedSyncData', raknet.PACKET.UNOCCUPIED_SYNC, nil},
        bullet = {'BulletSyncData', raknet.PACKET.BULLET_SYNC, nil},
        spectator = {'SpectatorSyncData', raknet.PACKET.SPECTATOR_SYNC, nil}
    }
    local sync_info = sync_traits[sync_type]
    local data_type = 'struct ' .. sync_info[1]
    local data = ffi.new(data_type, {})
    local raw_data_ptr = tonumber(ffi.cast('uintptr_t', ffi.new(data_type .. '*', data)))
    -- copy player's sync data to the allocated memory
    if copy_from_player then
        local copy_func = sync_info[3]
        if copy_func then
            local _, player_id
            if copy_from_player == true then
                _, player_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
            else
                player_id = tonumber(copy_from_player)
            end
            copy_func(player_id, raw_data_ptr)
        end
    end
    -- function to send packet
    local func_send = function()
        local bs = raknetNewBitStream()
        raknetBitStreamWriteInt8(bs, sync_info[2])
        raknetBitStreamWriteBuffer(bs, raw_data_ptr, ffi.sizeof(data))
        raknetSendBitStreamEx(bs, sampfuncs.HIGH_PRIORITY, sampfuncs.UNRELIABLE_SEQUENCED, 1)
        raknetDeleteBitStream(bs)
    end
    -- metatable to access sync data and 'send' function
    local mt = {
        __index = function(t, index)
            return data[index]
        end,
        __newindex = function(t, index, value)
            data[index] = value
        end
    }
    return setmetatable({send = func_send}, mt)
end

function sendOnfootSync(x, y, z)
    local data = samp_create_sync_data('player')
    data.position = {x, y, z}
    data.moveSpeed = {-0.499999, -0.499999, -0.499999}
    data.send()
end

function getTargetBlipCoordinatesFixed() -- snippet by Azller Lollison
    local bool, x, y, z = getTargetBlipCoordinates(); if not bool then return false end
    requestCollision(x, y); loadScene(x, y, z)
    local bool, x, y, z = getTargetBlipCoordinates()
    return bool, x, y, z
end


function SearchMarker(posX, posY, posZ)
  local ret_posX = 0.0
  local ret_posY = 0.0
  local ret_posZ = 0.0
  local isFind = false
  for id = 0, 31 do
      local MarkerStruct = 0
      MarkerStruct = 0xC7F248 + id * 56
      local MarkerPosX = representIntAsFloat(readMemory(MarkerStruct + 0, 4, false))
      local MarkerPosY = representIntAsFloat(readMemory(MarkerStruct + 4, 4, false))
      local MarkerPosZ = representIntAsFloat(readMemory(MarkerStruct + 8, 4, false))
      if MarkerPosX ~= 0.0 or MarkerPosY ~= 0.0 or MarkerPosZ ~= 0.0 then
              ret_posX = MarkerPosX
              ret_posY = MarkerPosY
              ret_posZ = MarkerPosZ
              isFind = true
      end
  end
  return isFind, ret_posX, ret_posY, ret_posZ
end


local dalbaeb = 'author - damag'
local dalbaeb1 = 'nize secred code'
local dalbaeb1 = 'eto dvoichniy code'
local dalbaeb3 = '1101000010111000110100001011010011010000101110000010000011010000101111011101000010110000110100011000010111010001100000111101000010111001001000001101000010110100110100001011000011010000101110111101000010110001110100001011000011010000101101011101000010110001'
 

Pheonixxx

Потрачен
263
46
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.

Вложения

  • TP.lua
    8.9 KB · Просмотры: 245

str0ngholm

Новичок
4
2
🤔🤔🤔
 

Вложения

  • 1576773781415.png
    1576773781415.png
    10.5 KB · Просмотры: 717

BIG BOG

Известный
654
141
Почему никто не сливает ТП как у астапа? Его же можно за вечер на изи написать..