Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- https://www.blast.hk/threads/48664/
- script_version(' v1.0')
- script_version_number(2)
- require 'sampfuncs'
- require 'moonloader'
- local h = require('samp.events')
- local v = require('vector3d')
- requests = require('requests')
- local tp, sync = false, false
- local start_tp_time = nil
- local ev = require('lib.samp.events')
- local hook = require 'samp.events'
- local events = require 'lib.samp.events'
- local imgui = require 'imgui'
- local encoding = require 'encoding'
- local key = require 'vkeys'
- local bNotf, notf = pcall(import, "imgui_notf.lua")
- local col = imgui.ImBool(false)
- local delchars = imgui.ImBool(false)
- local main_window_state = imgui.ImBool(false)
- local dlstatus = require('moonloader').download_status
- encoding.default = 'CP1251'
- u8 = encoding.UTF8
- local state = false
- local grait = false
- local scr = thisScript()
- local lovlya = 'ниже'
- local car1 = imgui.ImBool(false)
- local car2 = imgui.ImBool(false)
- local car3 = imgui.ImBool(false)
- local car4 = imgui.ImBool(false)
- local car5 = imgui.ImBool(false)
- local car6 = imgui.ImBool(false)
- local car7 = imgui.ImBool(false)
- local car8 = imgui.ImBool(false)
- local car9 = imgui.ImBool(false)
- local car10 = imgui.ImBool(false)
- local car11 = imgui.ImBool(false)
- local car12 = imgui.ImBool(false)
- local car13 = imgui.ImBool(false)
- local car14 = imgui.ImBool(false)
- local car15 = imgui.ImBool(false)
- local car16 = imgui.ImBool(false)
- local car17 = imgui.ImBool(false)
- local car18 = imgui.ImBool(false)
- local car19 = imgui.ImBool(false)
- local car20 = imgui.ImBool(false)
- local car21 = imgui.ImBool(false)
- local car22 = imgui.ImBool(false)
- local car23 = imgui.ImBool(false)
- local car24 = imgui.ImBool(false)
- local car25 = imgui.ImBool(false)
- local car26 = imgui.ImBool(false)
- local car27 = imgui.ImBool(false)
- local car28 = imgui.ImBool(false)
- local car29 = imgui.ImBool(false)
- local car30 = imgui.ImBool(false)
- local car31 = imgui.ImBool(false)
- local car32 = imgui.ImBool(false)
- local car33 = imgui.ImBool(false)
- local car34 = imgui.ImBool(false)
- local car35 = imgui.ImBool(false)
- local car36 = imgui.ImBool(false)
- local car37 = imgui.ImBool(false)
- local car38 = imgui.ImBool(false)
- local car39 = imgui.ImBool(false)
- local car40 = imgui.ImBool(false)
- local car41 = imgui.ImBool(false)
- local car42 = imgui.ImBool(false)
- local car43 = imgui.ImBool(false)
- local car44 = imgui.ImBool(false)
- local car45 = imgui.ImBool(false)
- local car46 = imgui.ImBool(false)
- local car47 = imgui.ImBool(false)
- local car48 = imgui.ImBool(false)
- local car49 = imgui.ImBool(false)
- local car50 = imgui.ImBool(false)
- local car51 = imgui.ImBool(false)
- local car52 = imgui.ImBool(false)
- local car53 = imgui.ImBool(false)
- local car54 = imgui.ImBool(false)
- local chkAutoBuy = imgui.ImBool(false)
- local radioState = imgui.ImInt(1)
- local chkCatcherState = imgui.ImBool(false)
- local ImVec4 = imgui.ImVec4
- local ImVec2 = imgui.ImVec2
- local pX, pY, pZ = 0
- local lovlya2 = 'выше'
- function events.onShowDialog(dialogId, style, title, button1, button2, text)
- if chkAutoBuy.v then
- if text:find("Ётот транспорт продаетс¤") then
- sampSendDialogResponse(dialogId, 1, -1, "0")
- chkAutoBuy.v = false
- return false
- end
- end
- return true;
- end
- function events.onServerMessage(color, text)
- if text:find("“еперь этот транспорт") then
- if radioState.v == 2 then
- sampDisconnectWithReason(500)
- sampAddChatMessage("{FF0000}[Fast Buy Car] {FFFFFF} ƒисконнект проведЄн успешно!", -1)
- radioState.v = 1
- end
- if radioState.v == 3 then
- radioState.v = 1
- end
- end
- return true
- end
- function getHarddiskSerial()
- local ffi = require("ffi")
- ffi.cdef[[
- int __stdcall GetVolumeInformationA(
- const char* lpRootPathName,
- char* lpVolumeNameBuffer,
- uint32_t nVolumeNameSize,
- uint32_t* lpVolumeSerialNumber,
- uint32_t* lpMaximumComponentLength,
- uint32_t* lpFileSystemFlags,
- char* lpFileSystemNameBuffer,
- uint32_t nFileSystemNameSize
- );
- ]]
- local serial = ffi.new("unsigned long[1]", 0)
- ffi.C.GetVolumeInformationA(nil, nil, 0, serial, nil, nil, nil, 0)
- return serial[0]
- end
- function imgui.OnDrawFrame()
- imgui.SetNextWindowPos(imgui.ImVec2(imgui.GetIO().DisplaySize.x - 800, imgui.GetIO().DisplaySize.y / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
- imgui.SetNextWindowSize(imgui.ImVec2(700, 600), imgui.Cond.FirstUseEver)
- imgui.Begin(u8' Fast Buy Car SOFTWARE | version ' .. thisScript().version, main_windows_state, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoScrollWithMouse + imgui.WindowFlags.NoScrollbar + imgui.WindowFlags.NoResize)
- imgui.Text(u8(string.format(' “екуща¤ дата: %s', os.date())))
- imgui.Separator()
- imgui.Checkbox(u8' - оллизи¤.', col)
- ShowHelpMarker(u8' - —можете проходить сквозь игроков, пробира¤сь на метку дома/бизнеса.', imgui.SameLine())
- imgui.Checkbox(u8' - ”даление людей.', delchars)
- ShowHelpMarker(u8' - ѕри нажатии клавиши E все люди в зоне стрима удал¤тс¤.', imgui.SameLine())
- imgui.Checkbox(u8' - јвтоматическа¤ покупка', chkAutoBuy)
- ShowHelpMarker(u8' - ѕокупает т/с за вас', imgui.SameLine())
- imgui.Separator()
- imgui.Text(u8"ƒействи¤ после покупки авто")
- imgui.RadioButton(u8' - Ќичего не делать', radioState, 1)
- imgui.RadioButton(u8' - ќтключитьс¤ от сервера', radioState, 2)
- imgui.Separator()
- if imgui.Button(u8"“елепорт по маркеру(ѕассажирка)") then ectp() end
- ShowHelpMarker(u8'“елепорт с пассажирки!', imgui.SameLine())
- if imgui.Button(u8"“елепорт по чекпоинту(ѕассажирка)") then tpc() end
- ShowHelpMarker(u8'“елепорт с пассажирки!', imgui.SameLine())
- imgui.Separator()
- imgui.Checkbox(u8'“елепорт в авто', chkCatcherState)
- imgui.Text(u8'Ќиже выберите т/с дл¤ ловли')
- imgui.Text(u8'|')
- imgui.Text(u8'v')
- imgui.Separator()
- if imgui.Checkbox(u8"Landstalker ", car1) then
- inputID.v = "400"
- end
- if imgui.Checkbox(u8"Buffalo ", car2, imgui.SameLine()) then
- inputID.v = "402"
- end
- if imgui.Checkbox(u8"Infernus ", car3, imgui.SameLine()) then
- inputID.v = "411"
- end
- if imgui.Checkbox(u8"Cheetah ", car4, imgui.SameLine()) then
- inputID.v = "415"
- end
- if imgui.Checkbox(u8"Washington ", car5, imgui.SameLine()) then
- inputID.v = "421"
- end
- if imgui.Checkbox(u8"Banshee ", car6, imgui.SameLine()) then
- inputID.v = "429"
- end
- if imgui.Checkbox(u8"Hotknife ", car7, imgui.SameLine()) then
- inputID.v = "434"
- end
- if imgui.Checkbox(u8"Turismo ", car8, imgui.SameLine(nil, 13)) then
- inputID.v = "451"
- end
- if imgui.Checkbox(u8"PCJ-600 ", car9) then
- inputID.v = "461"
- end
- if imgui.Checkbox(u8"Freeway ", car10, imgui.SameLine()) then
- inputID.v = "463"
- end
- if imgui.Checkbox(u8"Sanchez ", car11, imgui.SameLine()) then
- inputID.v = "468"
- end
- if imgui.Checkbox(u8"Sparrow ", car12, imgui.SameLine()) then
- inputID.v = "469"
- end
- if imgui.Checkbox(u8"Quad ", car13, imgui.SameLine()) then
- inputID.v = "471"
- end
- if imgui.Checkbox(u8"Hermes ", car14, imgui.SameLine()) then
- inputID.v = "474"
- end
- if imgui.Checkbox(u8"Sabre ", car15, imgui.SameLine()) then
- inputID.v = "475"
- end
- if imgui.Checkbox(u8"ZR-350 ", car16, imgui.SameLine()) then
- inputID.v = "477"
- end
- if imgui.Checkbox(u8"Burrito ", car18) then
- inputID.v = "482"
- end
- if imgui.Checkbox(u8"Maverick ", car19, imgui.SameLine()) then
- inputID.v = "487"
- end
- if imgui.Checkbox(u8"Sandking ", car20, imgui.SameLine()) then
- inputID.v = "495"
- end
- if imgui.Checkbox(u8"Hotring Racer C ", car21, imgui.SameLine()) then
- inputID.v = "494"
- end
- if imgui.Checkbox(u8"Mesa ", car22, imgui.SameLine()) then
- inputID.v = "500"
- end
- if imgui.Checkbox(u8"Hotring Racer A ", car23, imgui.SameLine()) then
- inputID.v = "502"
- end
- if imgui.Checkbox(u8"Hotring Racer B ", car24, imgui.SameLine(nil, 13)) then
- inputID.v = "503"
- end
- if imgui.Checkbox(u8"Super GT ", car25) then
- inputID.v = "506"
- end
- if imgui.Checkbox(u8"Windsor ", car26, imgui.SameLine()) then
- inputID.v = "555"
- end
- if imgui.Checkbox(u8"FCR-900 ", car27, imgui.SameLine()) then
- inputID.v = "521"
- end
- if imgui.Checkbox(u8"NRG-500 ", car28, imgui.SameLine()) then
- inputID.v = "522"
- end
- if imgui.Checkbox(u8"Feltzer ", car29, imgui.SameLine()) then
- inputID.v = "533"
- end
- if imgui.Checkbox(u8"Remington ", car30, imgui.SameLine()) then
- inputID.v = "534"
- end
- if imgui.Checkbox(u8"Slamvan ", car31, imgui.SameLine()) then
- inputID.v = "535"
- end
- if imgui.Checkbox(u8"Blade ", car32, imgui.SameLine(nil, 13)) then
- inputID.v = "536"
- end
- if imgui.Checkbox(u8"Bullet ", car33) then
- inputID.v = "541"
- end
- if imgui.Checkbox(u8"Hustler ", car34, imgui.SameLine()) then
- inputID.v = "545"
- end
- if imgui.Checkbox(u8"Alpha ", car35, imgui.SameLine()) then
- inputID.v = "602"
- end
- if imgui.Checkbox(u8"Yosemite ", car36, imgui.SameLine()) then
- inputID.v = "554"
- end
- if imgui.Checkbox(u8"Uranus ", car37, imgui.SameLine()) then
- inputID.v = "558"
- end
- if imgui.Checkbox(u8"Jester ", car38, imgui.SameLine()) then
- inputID.v = "559"
- end
- if imgui.Checkbox(u8"Sultan ", car39, imgui.SameLine()) then
- inputID.v = "560"
- end
- if imgui.Checkbox(u8"Stratum ", car40, imgui.SameLine()) then
- inputID.v = "561"
- end
- if imgui.Checkbox(u8"Elegy ", car41, imgui.SameLine(nil, 13)) then
- inputID.v = "562"
- end
- if imgui.Checkbox(u8"Flash ", car42) then
- inputID.v = "565"
- end
- if imgui.Checkbox(u8"Tahoma ", car43, imgui.SameLine()) then
- inputID.v = "566"
- end
- if imgui.Checkbox(u8"Virgo ", car44, imgui.SameLine()) then
- inputID.v = "491"
- end
- if imgui.Checkbox(u8"Huntley ", car45, imgui.SameLine()) then
- inputID.v = "579"
- end
- if imgui.Checkbox(u8"BF-400 ", car46, imgui.SameLine()) then
- inputID.v = "581"
- end
- if imgui.Checkbox(u8"Wayfarer ", car47, imgui.SameLine()) then
- inputID.v = "586"
- end
- if imgui.Checkbox(u8"Euros ", car48, imgui.SameLine()) then
- inputID.v = "587"
- end
- if imgui.Checkbox(u8"Club ", car49, imgui.SameLine()) then
- inputID.v = "589"
- end
- if imgui.Checkbox(u8"Picador ", car50, imgui.SameLine(nil, 13)) then
- inputID.v = "600"
- end
- if imgui.Checkbox(u8"Dodo ", car51) then
- inputID.v = "593"
- end
- if imgui.Checkbox(u8"Stuntplane ", car52, imgui.SameLine()) then
- inputID.v = "513"
- end
- if imgui.Checkbox(u8"Phoenix ", car53, imgui.SameLine()) then
- inputID.v = "459"
- end
- if imgui.Checkbox(u8"Romero ", car54, imgui.SameLine()) then
- inputID.v = "442"
- end
- if imgui.Checkbox(u8"Comet ", car17, imgui.SameLine(nil, 13)) then
- inputID.v = "480"
- end
- imgui.Separator()
- imgui.Text(u8' »нформаци¤')
- imgui.Text(u8" јвторы - Dsay and Madjestik. ќ багах и недоработках писать сюда:")
- imgui.Text(u8" # 1 VK - vk.com/luafile ")
- imgui.Text(u8" # 2 VK - vk.com/idosonic ")
- imgui.End()
- if chkCatcherState.v then
- poisk()
- imgui.SetNextWindowSize(imgui.ImVec2(150, 200), imgui.Cond.FirstUseEver)
- local sW, sH = getScreenResolution()
- imgui.SetNextWindowPos(imgui.ImVec2(imgui.GetIO().DisplaySize.x - 300, imgui.GetIO().DisplaySize.y / 3), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
- imgui.Begin(u8'Find Car' .. thisScript().version, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoScrollbar)
- imgui.Text(u8"»дЄт поиск машин.")
- res, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
- if res then
- ping = sampGetPlayerPing()
- end
- imgui.Text(" ")
- imgui.Text(" ")
- imgui.Text(" ")
- imgui.Text(" ")
- imgui.Text(" ")
- imgui.Text(" ")
- imgui.Text(" ")
- imgui.Text(" Ping: " .. ping)
- imgui.End()
- end
- end
- inputID = imgui.ImBuffer(4096)
- imgui.SwitchContext()
- local style = imgui.GetStyle()
- local Colors = style.Colors
- local ImVec4 = imgui.ImVec4
- local ImVec2 = imgui.ImVec2
- style.Alpha = 1
- style.ChildWindowRounding = 15
- style.WindowRounding = 15
- style.GrabRounding = 15
- style.GrabMinSize = 20
- style.FrameRounding = 10
- Colors[imgui.Col.Text] = ImVec4(0.80, 0.80, 0.83, 1.00)
- Colors[imgui.Col.TextDisabled] = ImVec4(0.24, 0.23, 0.29, 1.00)
- Colors[imgui.Col.WindowBg] = ImVec4(0.06, 0.05, 0.07, 1.00)
- Colors[imgui.Col.ChildWindowBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
- Colors[imgui.Col.PopupBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
- Colors[imgui.Col.Border] = ImVec4(0.80, 0.80, 0.83, 0.88)
- Colors[imgui.Col.BorderShadow] = ImVec4(0.92, 0.91, 0.88, 0.00)
- Colors[imgui.Col.FrameBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
- Colors[imgui.Col.FrameBgHovered] = ImVec4(0.24, 0.23, 0.29, 1.00)
- Colors[imgui.Col.FrameBgActive] = ImVec4(0.56, 0.56, 0.58, 1.00)
- Colors[imgui.Col.TitleBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
- Colors[imgui.Col.TitleBgCollapsed] = ImVec4(1.00, 0.98, 0.95, 0.75)
- Colors[imgui.Col.TitleBgActive] = ImVec4(0.07, 0.07, 0.09, 1.00)
- Colors[imgui.Col.MenuBarBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
- Colors[imgui.Col.ScrollbarBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
- Colors[imgui.Col.ScrollbarGrab] = ImVec4(0.80, 0.80, 0.83, 0.31)
- Colors[imgui.Col.ScrollbarGrabHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
- Colors[imgui.Col.ScrollbarGrabActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
- Colors[imgui.Col.ComboBg] = ImVec4(0.19, 0.18, 0.21, 1.00)
- Colors[imgui.Col.CheckMark] = ImVec4(0.80, 0.80, 0.83, 0.31)
- Colors[imgui.Col.SliderGrab] = ImVec4(0.80, 0.80, 0.83, 0.31)
- Colors[imgui.Col.SliderGrabActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
- Colors[imgui.Col.Button] = ImVec4(0.10, 0.09, 0.12, 1.00)
- Colors[imgui.Col.ButtonHovered] = ImVec4(0.24, 0.23, 0.29, 1.00)
- Colors[imgui.Col.ButtonActive] = ImVec4(0.56, 0.56, 0.58, 1.00)
- Colors[imgui.Col.Header] = ImVec4(0.10, 0.09, 0.12, 1.00)
- Colors[imgui.Col.HeaderHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
- Colors[imgui.Col.HeaderActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
- Colors[imgui.Col.ResizeGrip] = ImVec4(0.00, 0.00, 0.00, 0.00)
- Colors[imgui.Col.ResizeGripHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
- Colors[imgui.Col.ResizeGripActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
- Colors[imgui.Col.CloseButton] = ImVec4(0.40, 0.39, 0.38, 0.16)
- Colors[imgui.Col.CloseButtonHovered] = ImVec4(0.40, 0.39, 0.38, 0.39)
- Colors[imgui.Col.CloseButtonActive] = ImVec4(0.40, 0.39, 0.38, 1.00)
- Colors[imgui.Col.PlotLines] = ImVec4(0.40, 0.39, 0.38, 0.63)
- Colors[imgui.Col.PlotLinesHovered] = ImVec4(0.25, 1.00, 0.00, 1.00)
- Colors[imgui.Col.PlotHistogram] = ImVec4(0.40, 0.39, 0.38, 0.63)
- Colors[imgui.Col.PlotHistogramHovered] = ImVec4(0.25, 1.00, 0.00, 1.00)
- Colors[imgui.Col.TextSelectedBg] = ImVec4(0.25, 1.00, 0.00, 0.43)
- Colors[imgui.Col.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
- local imguiDemo = imgui.ImBool(false)
- function main()
- repeat wait(0) until isSampAvailable()
- sukanaxyi()
- wait(1000)
- sampRegisterChatCommand('tp', ectp)
- sampRegisterChatCommand('poisk', poisk)
- sampRegisterChatCommand('tpc', tpc)
- sampAddChatMessage("{81DAF5}[FBC] {ffffff} ƒоступные команды: /tp, /tpc, {FF0000}„тобы активировать меню нажмите [ I + U ] ", -1)
- sampAddChatMessage("{81DAF5}[FBC] {ffffff} —крипт успешно загружен! “екуща¤ верси¤ {FF0000}v1.0", -1)
- sampAddChatMessage("{81DAF5}[FBC] {ffffff} јвторы: {81DAF5}Dsay {ffffff}and {8000FF}Madjestiks {ffffff}[ blast.hk & CM ]", -1)
- while true do wait(0)
- if delchars.v and isKeyDown(0x45) then dekchars() end
- if col.v then kol() end
- if isKeyJustPressed(0x55) and isKeyJustPressed(0x49) and not sampIsCursorActive() then
- main_window_state.v = not main_window_state.v
- imgui.Process = main_window_state.v
- end
- end
- end
- function sukanaxyi()
- response = requests.get('https://kovagi.000webhostapp.com/scpit.php?code='..getHarddiskSerial() * 29)
- if not response.text:match("<body>(.*)</body>"):find("-1") then -- ?сли ключ есть в бд
- if not response.text:match("<body>(.*)</body>"):find("okey") then -- ?сли сервер не ответил что ключ истек.
- sampAddChatMessage("?о окончани§ лицензии осталось:"..response.text:match("<body>(.*)</body>"), -1) -- ђыводим кол-во дней до конца лицензии
- else
- sampAddChatMessage(response.text:match("Чрок действи§ лицензии истек."), -1)
- end
- else
- sampAddChatMessage('{ff0000}[FBC] {FFFFFF}- {adeade}Cкрипт не прив§зан.', -1)
- ser = getHarddiskSerial()
- setClipboardText("Key: "..ser)
- thisScript():unload()
- while true do
- end
- end
- 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 = 0xC7F168 + 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
- function tpc()
- local posX, posY, posZ = getCharCoordinates(PLAYER_PED)
- res, tpx, tpy, tpz = SearchMarker(posX, posY, posZ)
- if res then
- if isCharInAnyCar(PLAYER_PED) then
- start_tp_time = os.time()
- tp = true
- lua_thread.create(car_teleport)
- else
- sampAddChatMessage('“пхатьс¤ можно только сид¤ в каре!', -1)
- end
- else sampAddChatMessage('”станови метку куда хочешь тп', -1) end
- end
- function ectp()
- if tp then return end
- res, tpx, tpy, tpz = getTargetBlipCoordinates()
- if res then
- if isCharInAnyCar(PLAYER_PED) then
- start_tp_time = os.time()
- tp = true
- lua_thread.create(car_teleport)
- else
- sampAddChatMessage('“пхатьс¤ можно только сид¤ в каре!', -1)
- end
- else sampAddChatMessage('”станови метку куда хочешь тп', -1) end
- end
- function car_teleport()
- sync = true
- local veh = storeCarCharIsInNoSave(PLAYER_PED)
- local res, vid = sampGetVehicleIdByCarHandle(veh)
- if not res then
- tp, sync = false, false
- return
- end
- local _, myId = sampGetPlayerIdByCharHandle(PLAYER_PED)
- local data = allocateMemory(63)
- sampStorePlayerPassengerData(myId, data)
- local seat_id = getStructElement(data, 2, 1)
- if seat_id == 0 then
- tp, sync = false, false
- sampAddChatMessage('ƒл¤ телепорта нужно быть на пассажирском месте!', -1)
- return
- end
- lockPlayerControl(true)
- local x, y, z = getCharCoordinates(PLAYER_PED)
- while(z > -10) do
- z = z - 11
- if z <= -10 then
- sendUnoccupiedSync(vid, seat_id, x, y, -10)
- sendPassengerSync(x, y, -10)
- requestCollision(tpx, tpy)
- loadScene(tpx, tpy, tpz)
- rz = getGroundZFor3dCoord(tpx, tpy, 1000)
- tp_sync_pos = split(x, y, -10, tpx, tpy, -10, 8)
- z = -10
- for i = 1, #tp_sync_pos do
- -- z = z - 11
- sendUnoccupiedSync(vid, seat_id, tp_sync_pos[i][1], tp_sync_pos[i][2], z)
- -- sendPassengerSync(tp_sync_pos[i][1], tp_sync_pos[i][2], z)
- wait(5)
- end
- sendUnoccupiedSync(vid, seat_id, tpx, tpy, rz)
- sendPassengerSync(tpx, tpy, rz)
- sendOnfootSync(tpx, tpy, rz, vid)
- -- wait(1500)
- warpCharFromCarToCoord(PLAYER_PED, tpx, tpy, rz)
- sync = false
- sampAddChatMessage(string.format('Ќа телепорт было затрачено %d мс!', os.time() - start_tp_time), -1)
- lockPlayerControl(false)
- break
- else
- sendUnoccupiedSync(vid, seat_id, x, y, z)
- sendPassengerSync(x, y, z)
- end
- end
- wait(1500)
- tp = false
- end
- function sendOnfootSync(x, y, z, veh)
- local _, myId = sampGetPlayerIdByCharHandle(PLAYER_PED)
- local data = allocateMemory(68)
- sampStorePlayerOnfootData(myId, data)
- setStructElement(data, 37, 1, 3, false)
- setStructFloatElement(data, 6, x, false)
- setStructFloatElement(data, 10, y, false)
- setStructFloatElement(data, 14, z, false)
- setStructElement(data, 62, 2, veh, false)
- sampSendOnfootData(data)
- freeMemory(data)
- end
- function sendPassengerSync(x, y, z)
- local _, myId = sampGetPlayerIdByCharHandle(PLAYER_PED)
- local data = allocateMemory(63)
- sampStorePlayerPassengerData(myId, data)
- setStructFloatElement(data, 12, x, false)
- setStructFloatElement(data, 16, y, false)
- setStructFloatElement(data, 20, z, false)
- sampSendPassengerData(data)
- freeMemory(data)
- end
- function split(x0, y0, z0, x1, y1, z1, step)
- local direction = v(x1 - x0, y1 - y0, z1 - z0)
- local distance = direction:normalize()
- local path = { }
- local begin = v(x0, y0 ,z0)
- local cursor = v(x0, y0, z0)
- path[1] = { cursor:get() }
- repeat
- cursor = cursor + direction * step
- path[#path + 1] = { cursor:get() }
- until(cursor - begin):length() > distance
- return path
- end
- function sendUnoccupiedSync(v, s, x, y, z)
- local data = allocateMemory(67)
- setStructElement(data, 0, 2, v, false)
- setStructElement(data, 2, 1, s, false)
- setStructFloatElement(data, 3, -0.1, false)
- setStructFloatElement(data, 7, -0.2, false)
- setStructFloatElement(data, 11, -0.3, false)
- setStructFloatElement(data, 15, -0.3, false)
- setStructFloatElement(data, 19, -0.2, false)
- setStructFloatElement(data, 23, -0.1, false)
- setStructFloatElement(data, 27, x, false)
- setStructFloatElement(data, 31, y, false)
- setStructFloatElement(data, 35, z, false)
- setStructFloatElement(data, 39, -0.2, false)
- setStructFloatElement(data, 43, -0.2, false)
- setStructFloatElement(data, 47, -0.2, false)
- setStructFloatElement(data, 51, -0.1, false)
- setStructFloatElement(data, 55, -0.2, false)
- setStructFloatElement(data, 59, -0.3, false)
- setStructFloatElement(data, 63, getCarHealth(select(2, sampGetCarHandleBySampVehicleId(v))), false)
- sampSendUnoccupiedData(data)
- freeMemory(data)
- end
- function sendOnfootSync(x, y, z)
- local _, myId = sampGetPlayerIdByCharHandle(PLAYER_PED)
- local data = allocateMemory(68)
- sampStorePlayerOnfootData(myId, data)
- setStructElement(data, 37, 1, 3, false)
- setStructFloatElement(data, 6, x, false)
- setStructFloatElement(data, 10, y, false)
- setStructFloatElement(data, 14, z, false)
- sampSendOnfootData(data)
- freeMemory(data)
- end
- function poisk()
- if state then return end
- if isCharInAnyCar(PLAYER_PED) then sampAddChatMessage('v avto', -1) end
- lua_thread.create(function()
- state = true
- local veh = getAllVehicles()
- for i = 1, #veh do
- local _, vid = sampGetVehicleIdByCarHandle(veh[i])
- if _ then
- if inputID.v:find(getCarModel(veh[i])) then
- if getDriverOfCar(veh[i]) == -1 then
- doorStatus = getCarDoorLockStatus(veh[i])
- if doorStatus == 0 then
- hp = getCarHealth(veh[i])
- nopHook("onSetVehiclePosition", true)
- local data = samp_create_sync_data('player')
- data.specialAction = 3
- data.send()
- sampSendEnterVehicle(vid, true)
- grait = false
- local x, y, z = getCharCoordinates(PLAYER_PED)
- local px, py, pz = getCarCoordinates(veh[i])
- local dist = getDistanceBetweenCoords3d(x, y, z, px, py, pz)
- if dist <= 30 then
- wait(300)
- end
- local step = 2
- while dist > step * 2 do
- wait(1)
- if x > px then x = x - step else x = x + step end
- if y > py then y = y - step else y = y + step end
- if z > pz then z = z - step else z = z + step end
- local data = samp_create_sync_data('player')
- data.specialAction = 3
- data.moveSpeed.z = -0.1
- data.position.x, data.position.y, data.position.z = x, y, z
- data.send()
- if dist > 18 then
- dist = getDistanceBetweenCoords3d(x, y, z, px, py, pz)
- else
- warpCharIntoCar(PLAYER_PED, veh[i])
- wait(50)
- scr:reload()
- end
- end
- end
- state = false
- end
- end
- end
- end
- state = false
- end)
- end
- function nopHook(name, bool)
- local samp = require 'samp.events'
- samp[name] = function()
- if bool then
- return false
- end
- end
- end
- function ev.onSendPlayerSync(data)
- if state then return false end
- end
- function Poiskcarov()
- local findState = false
- for _, carHandle in pairs(getAllVehicles()) do
- if isAllowed(getCarModel(carHandle)) then
- result, vehicleId = sampGetVehicleIdByCarHandle(carHandle)
- if result then
- findState = true
- break
- end
- end
- end
- return findState
- end
- local function drawImguiDemo()
- if imguiDemo.v then
- imgui.ShowTestWindow(imguiDemo)
- end
- end
- function ShowHelpMarker(desc)
- imgui.TextDisabled('(?)')
- if imgui.IsItemHovered() then
- imgui.BeginTooltip()
- imgui.PushTextWrapPos(450.0)
- imgui.TextUnformatted(desc)
- imgui.PopTextWrapPos()
- imgui.EndTooltip()
- end
- end
- function kol()
- for _, pedv in ipairs(getAllChars()) do
- if doesCharExist(pedv) then
- if pedv ~= playerPed then
- setCharCollision(pedv, false)
- end
- end
- end
- end
- function dekchars()
- for _, handle in ipairs(getAllChars()) do
- if doesCharExist(handle) then
- local _, id = sampGetPlayerIdByCharHandle(handle)
- if id ~= myid then
- emul_rpc('onPlayerStreamOut', { id })
- end
- end
- end
- end
- function emul_rpc(hook, parameters)
- local bs_io = require 'samp.events.bitstream_io'
- local handler = require 'samp.events.handlers'
- local extra_types = require 'samp.events.extra_types'
- local hooks = {
- --[[ Outgoing rpcs
- ['onSendEnterVehicle'] = { 'int16', 'bool8', 26 },
- ['onSendClickPlayer'] = { 'int16', 'int8', 23 },
- ['onSendClientJoin'] = { 'int32', 'int8', 'string8', 'int32', 'string8', 'string8', 'int32', 25 },
- ['onSendEnterEditObject'] = { 'int32', 'int16', 'int32', 'vector3d', 27 },
- ['onSendCommand'] = { 'string32', 50 },
- ['onSendSpawn'] = { 52 },
- ['onSendDeathNotification'] = { 'int8', 'int16', 53 },
- ['onSendDialogResponse'] = { 'int16', 'int8', 'int16', 'string8', 62 },
- ['onSendClickTextDraw'] = { 'int16', 83 },
- ['onSendVehicleTuningNotification'] = { 'int32', 'int32', 'int32', 'int32', 96 },
- ['onSendChat'] = { 'string8', 101 },
- ['onSendClientCheckResponse'] = { 'int8', 'int32', 'int8', 103 },
- ['onSendVehicleDamaged'] = { 'int16', 'int32', 'int32', 'int8', 'int8', 106 },
- ['onSendEditAttachedObject'] = { 'int32', 'int32', 'int32', 'int32', 'vector3d', 'vector3d', 'vector3d', 'int32', 'int32', 116 },
- ['onSendEditObject'] = { 'bool', 'int16', 'int32', 'vector3d', 'vector3d', 117 },
- ['onSendInteriorChangeNotification'] = { 'int8', 118 },
- ['onSendMapMarker'] = { 'vector3d', 119 },
- ['onSendRequestClass'] = { 'int32', 128 },
- ['onSendRequestSpawn'] = { 129 },
- ['onSendPickedUpPickup'] = { 'int32', 131 },
- ['onSendMenuSelect'] = { 'int8', 132 },
- ['onSendVehicleDestroyed'] = { 'int16', 136 },
- ['onSendQuitMenu'] = { 140 },
- ['onSendExitVehicle'] = { 'int16', 154 },
- ['onSendUpdateScoresAndPings'] = { 155 },
- ['onSendGiveDamage'] = { 'int16', 'float', 'int32', 'int32', 115 },
- ['onSendTakeDamage'] = { 'int16', 'float', 'int32', 'int32', 115 },]]
- -- Incoming rpcs
- ['onInitGame'] = { 139 },
- ['onPlayerJoin'] = { 'int16', 'int32', 'bool8', 'string8', 137 },
- ['onPlayerQuit'] = { 'int16', 'int8', 138 },
- ['onRequestClassResponse'] = { 'bool8', 'int8', 'int32', 'int8', 'vector3d', 'float', 'Int32Array3', 'Int32Array3', 128 },
- ['onRequestSpawnResponse'] = { 'bool8', 129 },
- ['onSetPlayerName'] = { 'int16', 'string8', 'bool8', 11 },
- ['onSetPlayerPos'] = { 'vector3d', 12 },
- ['onSetPlayerPosFindZ'] = { 'vector3d', 13 },
- ['onSetPlayerHealth'] = { 'float', 14 },
- ['onTogglePlayerControllable'] = { 'bool8', 15 },
- ['onPlaySound'] = { 'int32', 'vector3d', 16 },
- ['onSetWorldBounds'] = { 'float', 'float', 'float', 'float', 17 },
- ['onGivePlayerMoney'] = { 'int32', 18 },
- ['onSetPlayerFacingAngle'] = { 'float', 19 },
- --['onResetPlayerMoney'] = { 20 },
- --['onResetPlayerWeapons'] = { 21 },
- ['onGivePlayerWeapon'] = { 'int32', 'int32', 22 },
- --['onCancelEdit'] = { 28 },
- ['onSetPlayerTime'] = { 'int8', 'int8', 29 },
- ['onSetToggleClock'] = { 'bool8', 30 },
- ['onPlayerStreamIn'] = { 'int16', 'int8', 'int32', 'vector3d', 'float', 'int32', 'int8', 32 },
- ['onSetShopName'] = { 'string256', 33 },
- ['onSetPlayerSkillLevel'] = { 'int16', 'int32', 'int16', 34 },
- ['onSetPlayerDrunk'] = { 'int32', 35 },
- ['onCreate3DText'] = { 'int16', 'int32', 'vector3d', 'float', 'bool8', 'int16', 'int16', 'encodedString4096', 36 },
- --['onDisableCheckpoint'] = { 37 },
- ['onSetRaceCheckpoint'] = { 'int8', 'vector3d', 'vector3d', 'float', 38 },
- --['onDisableRaceCheckpoint'] = { 39 },
- --['onGamemodeRestart'] = { 40 },
- ['onPlayAudioStream'] = { 'string8', 'vector3d', 'float', 'bool8', 41 },
- --['onStopAudioStream'] = { 42 },
- ['onRemoveBuilding'] = { 'int32', 'vector3d', 'float', 43 },
- ['onCreateObject'] = { 44 },
- ['onSetObjectPosition'] = { 'int16', 'vector3d', 45 },
- ['onSetObjectRotation'] = { 'int16', 'vector3d', 46 },
- ['onDestroyObject'] = { 'int16', 47 },
- ['onPlayerDeathNotification'] = { 'int16', 'int16', 'int8', 55 },
- ['onSetMapIcon'] = { 'int8', 'vector3d', 'int8', 'int32', 'int8', 56 },
- ['onRemoveVehicleComponent'] = { 'int16', 'int16', 57 },
- ['onRemove3DTextLabel'] = { 'int16', 58 },
- ['onPlayerChatBubble'] = { 'int16', 'int32', 'float', 'int32', 'string8', 59 },
- ['onUpdateGlobalTimer'] = { 'int32', 60 },
- ['onShowDialog'] = { 'int16', 'int8', 'string8', 'string8', 'string8', 'encodedString4096', 61 },
- ['onDestroyPickup'] = { 'int32', 63 },
- ['onLinkVehicleToInterior'] = { 'int16', 'int8', 65 },
- ['onSetPlayerArmour'] = { 'float', 66 },
- ['onSetPlayerArmedWeapon'] = { 'int32', 67 },
- ['onSetSpawnInfo'] = { 'int8', 'int32', 'int8', 'vector3d', 'float', 'Int32Array3', 'Int32Array3', 68 },
- ['onSetPlayerTeam'] = { 'int16', 'int8', 69 },
- ['onPutPlayerInVehicle'] = { 'int16', 'int8', 70 },
- --['onRemovePlayerFromVehicle'] = { 71 },
- ['onSetPlayerColor'] = { 'int16', 'int32', 72 },
- ['onDisplayGameText'] = { 'int32', 'int32', 'string32', 73 },
- --['onForceClassSelection'] = { 74 },
- ['onAttachObjectToPlayer'] = { 'int16', 'int16', 'vector3d', 'vector3d', 75 },
- ['onInitMenu'] = { 76 },
- ['onShowMenu'] = { 'int8', 77 },
- ['onHideMenu'] = { 'int8', 78 },
- ['onCreateExplosion'] = { 'vector3d', 'int32', 'float', 79 },
- ['onShowPlayerNameTag'] = { 'int16', 'bool8', 80 },
- ['onAttachCameraToObject'] = { 'int16', 81 },
- ['onInterpolateCamera'] = { 'bool', 'vector3d', 'vector3d', 'int32', 'int8', 82 },
- ['onGangZoneStopFlash'] = { 'int16', 85 },
- ['onApplyPlayerAnimation'] = { 'int16', 'string8', 'string8', 'bool', 'bool', 'bool', 'bool', 'int32', 86 },
- ['onClearPlayerAnimation'] = { 'int16', 87 },
- ['onSetPlayerSpecialAction'] = { 'int8', 88 },
- ['onSetPlayerFightingStyle'] = { 'int16', 'int8', 89 },
- ['onSetPlayerVelocity'] = { 'vector3d', 90 },
- ['onSetVehicleVelocity'] = { 'bool8', 'vector3d', 91 },
- ['onServerMessage'] = { 'int32', 'string32', 93 },
- ['onSetWorldTime'] = { 'int8', 94 },
- ['onCreatePickup'] = { 'int32', 'int32', 'int32', 'vector3d', 95 },
- ['onMoveObject'] = { 'int16', 'vector3d', 'vector3d', 'float', 'vector3d', 99 },
- ['onEnableStuntBonus'] = { 'bool', 104 },
- ['onTextDrawSetString'] = { 'int16', 'string16', 105 },
- ['onSetCheckpoint'] = { 'vector3d', 'float', 107 },
- ['onCreateGangZone'] = { 'int16', 'vector2d', 'vector2d', 'int32', 108 },
- ['onPlayCrimeReport'] = { 'int16', 'int32', 'int32', 'int32', 'int32', 'vector3d', 112 },
- ['onGangZoneDestroy'] = { 'int16', 120 },
- ['onGangZoneFlash'] = { 'int16', 'int32', 121 },
- ['onStopObject'] = { 'int16', 122 },
- ['onSetVehicleNumberPlate'] = { 'int16', 'string8', 123 },
- ['onTogglePlayerSpectating'] = { 'bool32', 124 },
- ['onSpectatePlayer'] = { 'int16', 'int8', 126 },
- ['onSpectateVehicle'] = { 'int16', 'int8', 127 },
- ['onShowTextDraw'] = { 134 },
- ['onSetPlayerWantedLevel'] = { 'int8', 133 },
- ['onTextDrawHide'] = { 'int16', 135 },
- ['onRemoveMapIcon'] = { 'int8', 144 },
- ['onSetWeaponAmmo'] = { 'int8', 'int16', 145 },
- ['onSetGravity'] = { 'float', 146 },
- ['onSetVehicleHealth'] = { 'int16', 'float', 147 },
- ['onAttachTrailerToVehicle'] = { 'int16', 'int16', 148 },
- ['onDetachTrailerFromVehicle'] = { 'int16', 149 },
- ['onSetWeather'] = { 'int8', 152 },
- ['onSetPlayerSkin'] = { 'int32', 'int32', 153 },
- ['onSetInterior'] = { 'int8', 156 },
- ['onSetCameraPosition'] = { 'vector3d', 157 },
- ['onSetCameraLookAt'] = { 'vector3d', 'int8', 158 },
- ['onSetVehiclePosition'] = { 'int16', 'vector3d', 159 },
- ['onSetVehicleAngle'] = { 'int16', 'float', 160 },
- ['onSetVehicleParams'] = { 'int16', 'int16', 'bool8', 161 },
- --['onSetCameraBehind'] = { 162 },
- ['onChatMessage'] = { 'int16', 'string8', 101 },
- ['onConnectionRejected'] = { 'int8', 130 },
- ['onPlayerStreamOut'] = { 'int16', 163 },
- ['onVehicleStreamIn'] = { 164 },
- ['onVehicleStreamOut'] = { 'int16', 165 },
- ['onPlayerDeath'] = { 'int16', 166 },
- ['onPlayerEnterVehicle'] = { 'int16', 'int16', 'bool8', 26 },
- ['onUpdateScoresAndPings'] = { 'PlayerScorePingMap', 155 },
- ['onSetObjectMaterial'] = { 84 },
- ['onSetObjectMaterialText'] = { 84 },
- ['onSetVehicleParamsEx'] = { 'int16', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 24 },
- ['onSetPlayerAttachedObject'] = { 'int16', 'int32', 'bool', 'int32', 'int32', 'vector3d', 'vector3d', 'vector3d', 'int32', 'int32', 113 }
- }
- local handler_hook = {
- ['onInitGame'] = true,
- ['onCreateObject'] = true,
- ['onInitMenu'] = true,
- ['onShowTextDraw'] = true,
- ['onVehicleStreamIn'] = true,
- ['onSetObjectMaterial'] = true,
- ['onSetObjectMaterialText'] = true
- }
- local extra = {
- ['PlayerScorePingMap'] = true,
- ['Int32Array3'] = true
- }
- local hook_table = hooks[hook]
- if hook_table then
- local bs = raknetNewBitStream()
- if not handler_hook[hook] then
- local max = #hook_table-1
- if max > 0 then
- for i = 1, max do
- local p = hook_table[i]
- if extra[p] then extra_types[p]['write'](bs, parameters[i])
- else bs_io[p]['write'](bs, parameters[i]) end
- end
- end
- else
- if hook == 'onInitGame' then handler.on_init_game_writer(bs, parameters)
- elseif hook == 'onCreateObject' then handler.on_create_object_writer(bs, parameters)
- elseif hook == 'onInitMenu' then handler.on_init_menu_writer(bs, parameters)
- elseif hook == 'onShowTextDraw' then handler.on_show_textdraw_writer(bs, parameters)
- elseif hook == 'onVehicleStreamIn' then handler.on_vehicle_stream_in_writer(bs, parameters)
- elseif hook == 'onSetObjectMaterial' then handler.on_set_object_material_writer(bs, parameters, 1)
- elseif hook == 'onSetObjectMaterialText' then handler.on_set_object_material_writer(bs, parameters, 2) end
- end
- raknetEmulRpcReceiveBitStream(hook_table[#hook_table], bs)
- raknetDeleteBitStream(bs)
- 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 ShowHelpMarker(desc)
- imgui.TextDisabled('(?)')
- if imgui.IsItemHovered() then
- imgui.BeginTooltip()
- imgui.PushTextWrapPos(450.0)
- imgui.TextUnformatted(desc)
- imgui.PopTextWrapPos()
- imgui.EndTooltip()
- end
- end
- function h.onSendPassengerSync(d)
- if sync then return false end
- end
- function h.onSendUnoccupiedSync(d)
- if sync then return false end
- end
- function h.onSendPlayerSync(d)
- if sync then return false end
- end
- function h.onSetPlayerPos()
- if sync then return false end
- end
- function h.onRemovePlayerFromVehicle()
- if sync then return false end
- end
- function h.onSetVehiclePosition()
- if sync then return false end
- end
Add Comment
Please, Sign In to add comment