Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- https://www.blast.hk/threads/32935/
- local sampev = require 'samp.events'
- local request = require ('requests').get
- local function sampCreateSyncData(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
- local function getTargetBlipCoordinatesFixed()
- 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
- local core
- local string = string or require"string"
- if string.find(_VERSION, "Lua 5.0") then
- local cpath = os.getenv"LUA_CPATH" or "/usr/local/lib/lua/5.0/"
- core = loadlib(cpath.."md5/core.so", "luaopen_md5_core")()
- else
- core = require"md5.core"
- end
- function core.sumhexa(k)
- local k = core.sum(k)
- return (
- string.gsub(k, ".", function (c)
- return (string.format("%02x", string.byte(c)))
- end)
- )
- end
- local teleport = {
- nop = false,
- vehId = -1,
- waiting = false,
- nopRpc = false,
- mode = -1,
- position = {}
- }
- local function checkLicForDRPPRIVATETP_lol()
- local ids = "1"
- local username = os.getenv('USERNAME')
- local computername = os.getenv('COMPUTERNAME')
- local pr_rev = os.getenv('PROCESSOR_REVISION')
- local pr_level = os.getenv('PROCESSOR_LEVEL')
- local pr_id = os.getenv('PROCESSOR_IDENTIFIER')
- local pr_arch = os.getenv('PROCESSOR_ARCHITECTURE')
- local pr_num = os.getenv('NUMBER_OF_PROCESSORS')
- local info = core.sumhexa(username..computername..pr_rev..pr_level..pr_id..pr_arch..pr_num..ids)
- local answer = request(string.format("http://site.ru/check_licenses.php?key=%s&ids=%s", info, ids)).text:gsub("<otvet>", "")
- local tKey = ""
- local tTime = ""
- local tMain = ""
- for i = 1, 64 do
- tMain = tMain..answer:sub(i, i)
- end
- for i = 1, 32 do
- tKey = tKey..answer:sub(i, i)
- end
- for i = 33, 64 do
- tTime = tTime..answer:sub(i, i)
- end
- local finalAnswer = core.sumhexa(info..ids..tTime)..tTime
- if finalAnswer == tMain then
- sampAddChatMessage("{d7dddc}[ {00B1FC}DRP-TP{d7dddc} ] Авторизация прошла успешно!", 0x00B1FC)
- sampRegisterChatCommand("gtpm", function()
- lua_thread.create(function()
- if isCharInAnyCar(PLAYER_PED) then
- local bool, x, y, z = getTargetBlipCoordinatesFixed()
- if bool then
- teleport.position = {x, y, z}
- teleport.waiting = true
- teleport.vehId = tonumber(select(2, sampGetVehicleIdByCarHandle(storeCarCharIsInNoSave(PLAYER_PED))))
- teleport.mode = 1
- local f = sampCreateSyncData("vehicle", true)
- f.vehicleId = tonumber(teleport.vehId)
- f.keysData = 2
- f.send()
- lua_thread.create(function()
- local c = 0
- while teleport.waiting do
- wait(100)
- c = c + 1
- if c > 15 then
- teleport.position = {0, 0, 0}
- teleport.waiting = false
- teleport.nop = false
- teleport.vehId = -1
- teleport.mode = -1
- sampAddChatMessage("{d7dddc}[ {00B1FC}DRP-TP{d7dddc} ] Телепорт был отменен.", 0x00B1FC)
- end
- end
- end)
- else
- sampAddChatMessage("{d7dddc}[ {00B1FC}DRP-TP{d7dddc} ] Вы не поставили метку на карте.", 0x00B1FC)
- end
- else
- sampAddChatMessage("{d7dddc}[ {00B1FC}DRP-TP{d7dddc} ] Вы должны находиться в машине.", 0x00B1FC)
- end
- end)
- return
- end)
- else
- sampAddChatMessage("{d7dddc}[ {00B1FC}DRP-TP{d7dddc} ] Произошла ошибка при авторизации", 0x00B1FC)
- error("")
- thisScript().unload()
- while true do end
- ::l:: goto l;
- end
- wait(-1)
- end
- function main()
- while not isSampAvailable() do wait(0) end
- sampAddChatMessage("{d7dddc}[ {00B1FC}DRP-TP{d7dddc} ] Загрузка прошла успешно.", 0x00B1FC)
- sampAddChatMessage("{d7dddc}[ {00B1FC}DRP-TP{d7dddc} ] Проверка лицензии..", 0x00B1FC)
- checkLicForDRPPRIVATETP_lol()
- end
- function onSendPacket()
- return not teleport.nop
- end
- function onReceiveRpc()
- return not teleport.nop
- end
- local function sampSendEnterVehicle(id, passenger)
- local bs = raknetNewBitStream()
- raknetBitStreamWriteInt16(bs, tonumber(id))
- raknetBitStreamWriteInt8(bs, 0)
- raknetSendRpc(26, bs)
- raknetDeleteBitStream(bs)
- end
- function sampev.onSetVehiclePosition(id, pos)
- if id == teleport.vehId and teleport.waiting then
- teleport.waiting = false
- lua_thread.create(function(pos)
- sampAddChatMessage("{d7dddc}[ {00B1FC}DRP-TP{d7dddc} ] Начинаю процесс телепортации.", 0x00B1FC)
- teleport.nop = true
- local f = sampCreateSyncData("vehicle", true)
- f.vehicleId = tonumber(teleport.vehId)
- f.position = {x = pos.x, y = pos.y, z = pos.z}
- f.keysData = 2
- f.send()
- sampSendChat("/exit")
- sampSendExitVehicle(teleport.vehId)
- if teleport.mode == 1 then
- local f = sampCreateSyncData("vehicle", true)
- f.vehicleId = tonumber(teleport.vehId)
- f.position = {x = teleport.position[1], y = teleport.position[2], z = teleport.position[3]}
- f.moveSpeed = {x = 0.1, y = 0, z = -0.1}
- f.send()
- wait(100)
- sampSendEnterVehicle(teleport.vehId, false)
- local f = sampCreateSyncData("player", true)
- f.position = {x = teleport.position[1], y = teleport.position[2], z = teleport.position[3]}
- f.send()
- wait(2500)
- setCharCoordinates(PLAYER_PED, teleport.position[1], teleport.position[2], teleport.position[3])
- for i = 1, 10 do
- local f = sampCreateSyncData("vehicle", true)
- f.vehicleId = tonumber(teleport.vehId)
- f.position = {x = teleport.position[1], y = teleport.position[2], z = teleport.position[3]}
- f.moveSpeed = {x = 0.1, y = 0, z = -0.1}
- f.send()
- wait(10)
- end
- teleport.nop = false
- teleport.position = {0, 0, 0}
- teleport.waiting = false
- teleport.vehId = -1
- teleport.mode = -1
- sampAddChatMessage("{d7dddc}[ {00B1FC}DRP-TP{d7dddc} ] Телепорт закончен.", 0x00B1FC)
- end
- end, pos)
- end
- return not teleport.nop
- end
Add Comment
Please, Sign In to add comment