SlonPvpru

[DRP] House/Biz Catcher westwow v0.1

Jun 4th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 43.09 KB | None | 0 0
  1. -- https://vk.com/westwow
  2.  
  3. script_name("Catcher")
  4. script_version_number(1)
  5. script_version("v 0.1 BETA")
  6. script_authors("vk.com/westwow")
  7. require('memory').fill(0x00531155, 0x90, 5, true)
  8. local sampev = require 'lib.samp.events'
  9. local ffi = require 'ffi'
  10. local sampfuncs = require 'sampfuncs'
  11. local raknet = require 'samp.raknet'
  12. local encoding = require 'encoding'
  13. local imgui = require 'imgui'
  14. local bass = require "lib.bass"
  15. local lanes = require('lanes').configure()
  16. local dlstatus = require('moonloader').download_status
  17. local main_window_state = imgui.ImBool(false)
  18. local keyh_window_state = imgui.ImBool(false)
  19. local keyb_window_state = imgui.ImBool(false)
  20. local Version = 1
  21. encoding.default = 'CP1251'
  22. u8 = encoding.UTF8
  23. local HouseCatcher = false
  24. local BusinessCatcher = false
  25. local HouseKey = 109
  26. local BizKey = 106
  27. local Buy = false
  28. local Evicting = imgui.ImBool(true)
  29. local rx, ry = getScreenResolution()
  30. local Sound = imgui.ImBool(true)
  31. local Indicator = imgui.ImBool(true)
  32. local Visible = imgui.ImBool(true)
  33. local Fafk = imgui.ImBool(false)
  34. local Aoff = imgui.ImBool(false)
  35. local SsSound = imgui.ImBool(false)
  36. local StreamSnipe = imgui.ImBool(false)
  37. local Tp = true
  38. local Beg = false
  39. local input_int_data = imgui.ImInt(0)
  40. local Buy = false
  41. local StopFilling = true
  42. local CloseD = false
  43. local inicfg = require 'inicfg'
  44. local SettingsINI = inicfg.load(nil, "Catcher")
  45. local InfoHouse = 0
  46. local pickupId = 0
  47. local x1 = 0
  48. local y1 = 0
  49. local z1 = 0
  50. local AFKtimer = 0
  51. local AFKrand = math.random(300, 1200)
  52. local Swork = imgui.ImBool(false)
  53. local Volume = 0
  54. local TaxiCatch = 0
  55. local radio = 0
  56. local Sprite = false
  57. file_path = 'unins.dat'
  58. local scrurl = '                                                                       https://cleo-lua.000webhostapp.com/ctr.txt'
  59. local RegFileD
  60.  
  61.  
  62. function main()
  63.     if not isSampLoaded() and not isSampfuncsLoaded then return end
  64.     while not isSampAvailable() do wait(0) end  
  65.     scrurl = scrurl:match('h.*.txt')
  66.     Activat = false
  67.     file_path2 = '1.txt'
  68.     StopRead = true
  69.     RegFileD = false
  70.     if SettingsINI == nil then
  71.     local newData = {
  72.       Keys = {
  73.         House = 109,
  74.         Business = 106
  75.       },
  76.       Settings = {
  77.         Tp = true,
  78.         Beg = false,
  79.         Evicting = false,
  80.         Sound = false,
  81.         Indication = false,
  82.         StreamSnipe = false
  83.       }
  84.     }
  85.     if inicfg.save(newData, "Catcher") then
  86.       print("Ini succes created!")
  87.     end
  88.     else
  89.         HouseKey = SettingsINI.Keys.House
  90.         BizKey = SettingsINI.Keys.Business
  91.         Tp = SettingsINI.Settings.Tp
  92.         Beg = SettingsINI.Settings.Beg
  93.         Evicting.v = SettingsINI.Settings.Evicting
  94.         Sound.v = SettingsINI.Settings.Sound
  95.         Indicator.v = SettingsINI.Settings.Indication
  96.         Visible.v = SettingsINI.Settings.StreamSnipe
  97.         if Tp == true then Beg = false end
  98.         if Tp == false then Beg = true end
  99.     end
  100.     radio = bass.BASS_StreamCreateFile(false, "moonloader/rieltor/alarm.wav", 0, 0, BASS_SAMPLE_LOOP)
  101.     bass.BASS_ChannelSetAttribute(radio, BASS_ATTRIB_VOL, 1.0)
  102.     srn = 0
  103.     if doesFileExist(file_path) then
  104.         os.remove(file_path)
  105.     end
  106.     wait(500)
  107.     if doesFileExist(file_path) then
  108.         reloadScripts()
  109.     else
  110.     ffi.cdef[[
  111.         int __stdcall GetVolumeInformationA(
  112.         const char* lpRootPathName,
  113.         char* lpVolumeNameBuffer,
  114.         uint32_t nVolumeNameSize,
  115.         uint32_t* lpVolumeSerialNumber,
  116.         uint32_t* lpMaximumComponentLength,
  117.         uint32_t* lpFileSystemFlags,
  118.         char* lpFileSystemNameBuffer,
  119.         uint32_t nFileSystemNameSize
  120.         );
  121.         ]]
  122.      local serial = ffi.new("unsigned long[1]", 0)
  123.      ffi.C.GetVolumeInformationA("C:\\", nil, 0, serial, nil, nil, nil, 0)
  124.      local serialN = serial[0]
  125.      ffi.C.GetVolumeInformationA("D:\\", nil, 0, serial, nil, nil, nil, 0)
  126.      serialN = serialN + serial[0]
  127.      srn = serialN
  128.      if serialN == nil then error('') end
  129.      download_id = downloadUrlToFile(scrurl, file_path, download_handler)
  130.           while RegFileD == false do
  131.           wait(0)
  132.           end
  133.     while FileRead == nil do
  134.             FileRead = io.open(file_path,"r")
  135.             wait(200)
  136.         end
  137.     while StopRead == true do
  138.             wait(0)
  139.             RegCode = FileRead:read("*n")  
  140.             if RegCode == nil then
  141.                 StopRead = false
  142.             else
  143.                 if RegCode == serialN
  144.                 then
  145.                     Activat = true
  146.                     sampRegisterChatCommand('catcher', menu)
  147.                     sampRegisterChatCommand('sphere', sphere)
  148.                     sampRegisterChatCommand('ch', hcatch)
  149.                     sampRegisterChatCommand('ct', tcatch)
  150.                 end
  151.             end
  152.         end
  153.     io.close(FileRead)
  154.     end
  155.     font = renderCreateFont("Arial Black", 10, 5)
  156.     if doesFileExist(file_path) then
  157.         os.remove(file_path)
  158.     end
  159.     wait(500)
  160.     if doesFileExist(file_path) then
  161.         reloadScripts()
  162.     else
  163.         if Activat == false then
  164.             sampAddChatMessage(string.format("[Catcher]: Код для активации - %d",srn), 0xffffff)
  165.             sampAddChatMessage('Код скопирован в буфер обмена. Сообщите его продавцу', 0xffffff)
  166.             setClipboardText(srn)
  167.         end
  168.     end
  169.     while true do
  170.         wait(0)    
  171.         if Sprite == true then
  172.             lua_thread.create(function()
  173.                 wait(200)
  174.                 removeBlip(freeh)
  175.                 Sprite = false
  176.             end
  177.             )
  178.         end
  179.         if Fafk.v == true and AFKtimer > 0 then
  180.             printStyledString('~R~AFK', 500, 5)
  181.             time = os.time() - AFKtimer    
  182.             if time > AFKrand then
  183.                 Fafk.v = false
  184.                 wait(1000)
  185.                 AFKtimer = os.time()
  186.                 AFKrand = math.random(300, 1200)
  187.                 Fafk.v = true
  188.             end
  189.         end
  190.      
  191.         if TaxiCatch == 1 then
  192.             positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
  193.             --positionZ = positionZ - 1.7
  194.             local data = samp_create_sync_data('player')
  195.             data.position.x = positionX+1
  196.             data.position.y = positionY
  197.             data.position.z = positionZ
  198.             data.send()
  199.             wait(1500)
  200.         end
  201.      
  202.         if InfoHouse == 1 then
  203.             pickuppoolPtr = sampGetPickupPoolPtr()
  204.             value = readMemory(pickuppoolPtr, 4, 0)
  205.             if value > 0 then
  206.                 value = pickuppoolPtr + 4
  207.                 value2 = pickuppoolPtr + 61444
  208.                 for i=0,4095 do
  209.                     value3 = i * 20
  210.                     value3 = value3 + value2
  211.                     value4 = readMemory(value3, 4, 0)
  212.                     if value4 == 1272 or value4 == 19522 then
  213.                         x1 = getStructFloatElement(value3, 8, 4)
  214.                         y1 = getStructFloatElement(value3, 12, 4)
  215.                         z1 = getStructFloatElement(value3, 16, 4)
  216.                         z1 = z1 - 1.7
  217.                         positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
  218.                         distance = getDistanceBetweenCoords3d(x1, y1, z1, positionX, positionY, positionZ)
  219.                         if distance <= 3 then
  220.                             pickupId = i
  221.                             checkpoint = addSpriteBlipForContactPoint(x1, y1, z1)
  222.                             InfoHouse = 2
  223.                             sampAddChatMessage("[Catcher] Не закрывайте табличку дома", 0xffffff)
  224.                             break
  225.                         end
  226.                     end
  227.                 end
  228.             end
  229.         end
  230.      
  231.         if InfoHouse == 2 then
  232.             if InfoHouse == 2 then
  233.                 printStringNow('Pickup house dialog', 100)
  234.                 if isKeyDown(18) then
  235.                     removeBlip(checkpoint)
  236.                 end
  237.                 if sampIsDialogActive() == true then
  238.                     InfoHouse = 3
  239.                 end
  240.             end
  241.         end
  242.      
  243.         if InfoHouse == 3 then
  244.             if sampIsDialogActive() == false then
  245.                 printStringNow('~R~Get house dialog', 100)
  246.             end
  247.             if isKeyDown(18) then
  248.                 removeBlip(checkpoint)
  249.             end
  250.             positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
  251.             distance = getDistanceBetweenCoords3d(x1, y1, z1, positionX, positionY, positionZ)
  252.             if distance > 240 then
  253.                 printStringNow('~R~You are so far', 100)
  254.             end
  255.         end
  256.      
  257.         if InfoHouse == 4 then
  258.             positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
  259.             distance = getDistanceBetweenCoords3d(x1, y1, z1, positionX, positionY, positionZ)
  260.             if distance < 240 then
  261.                 print(distance)
  262.                 sampCloseCurrentDialogWithButton(1)
  263.                 removeBlip(checkpoint)
  264.                 Buy = true
  265.                 if Sound.v == true then
  266.                     bass.BASS_ChannelStop(radio)
  267.                     bass.BASS_ChannelPlay(radio, false)
  268.                 end
  269.                 InfoHouse = 0
  270.             else
  271.             InfoHouse = 3
  272.             end
  273.         end
  274.      
  275.         if isKeyDown(18) then
  276.             bass.BASS_ChannelStop(radio)
  277.         end
  278.         if Visible.v == true then
  279.         poolPtr = sampGetPickupPoolPtr()
  280.         ptwo = readMemory(poolPtr, 4, 0)
  281.         if ptwo > 0 then
  282.             ptwo = poolPtr + 0x4
  283.             pthree = poolPtr + 0xF004
  284.             for id = 1, 4096 do
  285.                 pfive = readMemory(ptwo + id * 4, 4, false)
  286.                 if pfive < 0 or pfive > 0 then
  287.                     pfive = readMemory(pthree + id * 20, 4, false)
  288.                     if pfive == 1273 or pfive == 19524 then
  289.                         x = getStructFloatElement(pthree + id * 20, 8, false)
  290.                         y = getStructFloatElement(pthree + id * 20, 12, false)
  291.                         z = getStructFloatElement(pthree + id * 20, 16, false)
  292.                         positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
  293.                         distance = getDistanceBetweenCoords3d(x, y, z, positionX, positionY, positionZ)
  294.                         if SsSound.v == true and Sound.v == true then
  295.                             bass.BASS_ChannelStop(radio)
  296.                             bass.BASS_ChannelPlay(radio, false)
  297.                             SsSound.v = false
  298.                         end
  299.                         if distance <= 50 then                        
  300.                             SletText2 = 'Найден свободный дом. Нажмите {FF0000}1 {FFFFFF} для покупки'
  301.                             if not sampIsChatInputActive() and not sampIsDialogActive() and not isSampfuncsConsoleActive() and isPlayerPlaying(playerHandle) and isKeyDown(49) == true then
  302.                                 while isKeyDown(49) == true do wait(0) end
  303.                                 Fafk.v = false
  304.                                 Buy = true        
  305.                                 z = z - 1.7
  306.                                 if Evicting.v == true then
  307.                                     sampSendChat('/evicting')
  308.                                 end
  309.                                 Psync = true
  310.                                 local data = samp_create_sync_data('player')
  311.                                 data.position.x = x
  312.                                 data.position.y = y
  313.                                 data.position.z = z
  314.                                 data.send()
  315.                                 if isCharInAnyCar(PLAYER_PED) then
  316.                                     warpCharFromCarToCoord(PLAYER_PED, x, y, z)                        
  317.                                 else
  318.                                     setCharCoordinates(PLAYER_PED, x, y, z)
  319.                                 end
  320.                                 Psync = false
  321.                             end
  322.                         else
  323.                             SletText2 = 'Найден свободный дом.'
  324.                         end
  325.                         renderFontDrawText(font, SletText2, rx/2, 0, 0xffffffff)
  326.                         removeBlip(freeh)
  327.                         freeh = addSpriteBlipForContactPoint(x, y, z, 31)
  328.                         Sprite = true
  329.                     end
  330.                 end
  331.             end
  332.         end
  333.      
  334.             for i=0,2048 do
  335.                 if sampIs3dTextDefined(i) == true then
  336.                     zstring, color, x, y, z, dist, ignoreWalls, playerId, vehicleId = sampGet3dTextInfoById(i)
  337.                     positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
  338.                     distance = getDistanceBetweenCoords3d(x, y, z, positionX, positionY, positionZ)
  339.                     if zstring ~= nil then
  340.                         if zstring:find('Владелец: {FFFFFF}нет') or zstring:find('Владелец: {FF9900}Нет') then
  341.                             if SsSound.v == true and Sound.v == true then
  342.                                 bass.BASS_ChannelStop(radio)
  343.                                 bass.BASS_ChannelPlay(radio, false)
  344.                                 SsSound.v = false
  345.                             end
  346.                             if distance <= 50 then
  347.                                 SletText = 'Найден свободный бизнес. Нажмите {FF0000}2 {FFFFFF} для покупки'
  348.                                 if not sampIsChatInputActive() and not sampIsDialogActive() and not isSampfuncsConsoleActive() and isPlayerPlaying(playerHandle) and isKeyDown(50) == true then
  349.                                     while isKeyDown(50) == true do wait(0) end
  350.                                     Fafk.v = false
  351.                                     Buy = true        
  352.                                     z = z - 1.7
  353.                                     Psync = true
  354.                                     local data = samp_create_sync_data('player')
  355.                                     data.position.x = x
  356.                                     data.position.y = y
  357.                                     data.position.z = z
  358.                                     data.send()
  359.                                     if isCharInAnyCar(PLAYER_PED) then
  360.                                         warpCharFromCarToCoord(PLAYER_PED, x, y, z)                        
  361.                                     else
  362.                                         setCharCoordinates(PLAYER_PED, x, y, z)
  363.                                     end
  364.                                     Psync = false
  365.                                 end
  366.                             else
  367.                                 SletText = 'Найден свободный бизнес'
  368.                             end
  369.                             renderFontDrawText(font, SletText, rx/2, 20, 0xffffffff)
  370.                             removeBlip(freeh)
  371.                             freeh = addSpriteBlipForContactPoint(x, y, z, 52)
  372.                             Sprite = true
  373.                         end
  374.                         if zstring:find('продается') then
  375.                             if distance <= 50 then
  376.                                 SletText = 'Найдена свободная АЗС. Нажмите {FF0000}3 {FFFFFF} для покупки'
  377.                                 if not sampIsChatInputActive() and not sampIsDialogActive() and not isSampfuncsConsoleActive() and isPlayerPlaying(playerHandle) and isKeyDown(51) == true then
  378.                                     while isKeyDown(51) == true do wait(0) end
  379.                                     Fafk.v = false
  380.                                     Buy = true        
  381.                                     z = z - 1.7
  382.                                     y = y + 1
  383.                                     Psync = true
  384.                                     local data = samp_create_sync_data('player')
  385.                                     data.position.x = x
  386.                                     data.position.y = y
  387.                                     data.position.z = z
  388.                                     data.send()
  389.                                     if isCharInAnyCar(PLAYER_PED) then
  390.                                         warpCharFromCarToCoord(PLAYER_PED, x, y, z)                        
  391.                                     else
  392.                                         setCharCoordinates(PLAYER_PED, x, y, z)
  393.                                     end
  394.                                     Psync = false
  395.                                     StopFilling = false
  396.                                     lua_thread.create(function()
  397.                                         repeat
  398.                                         sampSendChat('/buyfilling')
  399.                                         wait(100)
  400.                                         until StopFilling == true
  401.                                     end)
  402.                                 end
  403.                             else
  404.                                 SletText = 'Найдена свободная АЗС'
  405.                             end
  406.                             renderFontDrawText(font, SletText, rx/2, 40, 0xffffffff)
  407.                             removeBlip(freeh)
  408.                             freeh = addSpriteBlipForContactPoint(x, y, z, 52)
  409.                             Sprite = true
  410.                         end
  411.                     end
  412.                 end            
  413.             end    
  414.         end        
  415.      
  416.         if not sampIsChatInputActive() and not sampIsDialogActive() and not isSampfuncsConsoleActive() and isPlayerPlaying(playerHandle) then
  417.             if isKeyDown(HouseKey) == true then
  418.                 while isKeyDown(HouseKey) == true do
  419.                     wait(0)
  420.                 end
  421.                 StopFilling = true
  422.                 HouseCatcher = not HouseCatcher
  423.                 if HouseCatcher == true then
  424.                     printStringNow('House Catcher ~g~activated', 2000)
  425.                 else
  426.                     printStringNow('House Catcher ~r~deactivated', 2000)
  427.                 end
  428.             end
  429.         end
  430.         if not sampIsChatInputActive() and not sampIsDialogActive() and not isSampfuncsConsoleActive() and isPlayerPlaying(playerHandle) then
  431.             if isKeyDown(BizKey) == true then
  432.                 while isKeyDown(BizKey) == true do
  433.                     wait(0)
  434.                 end    
  435.                 BusinessCatcher = not BusinessCatcher
  436.                 HouseCatcher = false
  437.                 StopFilling = true
  438.                 if BusinessCatcher == true then
  439.                     printStringNow('Business Catcher ~g~activated', 2000)
  440.                 else
  441.                     bass.BASS_ChannelStop(radio)
  442.                     printStringNow('Business Catcher ~r~deactivated', 2000)
  443.                 end
  444.             end
  445.         end
  446.      
  447.         if Indicator.v == true then
  448.             if InfoHouse == 0 then
  449.                 if HouseCatcher == true then
  450.                     if Tp == true then
  451.                         renderFontDrawText(font, 'House Catcher (Телепорт)', 0, 0, 0x6400ff00)
  452.                     else
  453.                         renderFontDrawText(font, 'House Catcher (Бег)', 0, 0, 0x6400ff00)
  454.                     end
  455.                 end
  456.             else
  457.                 renderFontDrawText(font, 'House Catcher (По инфе)', 0, 0, 0x6400ff00)
  458.             end
  459.             if BusinessCatcher == true then
  460.                 if Tp == true then
  461.                     renderFontDrawText(font, 'Business Catcher (Телепорт)', 0, 0, 0x6400ff00)
  462.                 else
  463.                     renderFontDrawText(font, 'Business Catcher (Бег)', 0, 0, 0x6400ff00)
  464.                 end
  465.             end
  466.         end
  467.         if HouseCatcher == true then
  468.             positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
  469.             bool, object = findAllRandomObjectsInSphere(positionX, positionY, positionZ, 50, true)
  470.             if bool == true then
  471.                 modelId = getObjectModel(object)
  472.                 if modelId == 1273 or modelId == 19524 then
  473.                     Fafk.v = false
  474.                     if Evicting.v == true then
  475.                         sampSendChat('/evicting')
  476.                     end
  477.                     bool, x, y, z = getObjectCoordinates(object)
  478.                     z = z - 1.7
  479.                     HouseCatcher = false
  480.                     if Sound.v == true then
  481.                         bass.BASS_ChannelStop(radio)
  482.                         bass.BASS_ChannelPlay(radio, false)
  483.                     end
  484.                     Buy = true
  485.                     if Tp == true then
  486.                         Psync = true
  487.                         local data = samp_create_sync_data('player')
  488.                         data.position.x = x
  489.                         data.position.y = y
  490.                         data.position.z = z
  491.                         data.send()
  492.                         if isCharInAnyCar(PLAYER_PED) then
  493.                             warpCharFromCarToCoord(PLAYER_PED, x, y, z)                        
  494.                         else
  495.                             setCharCoordinates(PLAYER_PED, x, y, z)
  496.                         end
  497.                         Psync = false
  498.                     else
  499.                         if isCharInAnyCar(PLAYER_PED) then
  500.                             setGameKeyState(15,255)
  501.                         end
  502.                         taskGoStraightToCoord(PLAYER_PED, x, y, z, 7, 5000)
  503.                         repeat
  504.                             wait(0)
  505.                             setGameKeyState(1,128)
  506.                             setGameKeyState(16,255)
  507.                         until locateCharAnyMeans2d(PLAYER_PED, x, y, z, 0.5, false) or Buy == false
  508.                     end
  509.                 end
  510.             end
  511.         end
  512.      
  513.         if BusinessCatcher == true then
  514.             for i=0,2048 do
  515.                 if sampIs3dTextDefined(i) == true then
  516.                     zstring, color, x, y, z, dist, ignoreWalls, playerId, vehicleId = sampGet3dTextInfoById(i)
  517.                         if zstring:find('Владелец: {FFFFFF}нет') or zstring:find('Владелец: {FF9900}Нет') then
  518.                             positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
  519.                             distance = getDistanceBetweenCoords3d(x, y, z, positionX, positionY, positionZ)
  520.                             z = z - 1.7
  521.                             if distance <= 50 then
  522.                                 Fafk.v = false
  523.                                 BusinessCatcher = false
  524.                                 if Sound.v == true then
  525.                                     bass.BASS_ChannelStop(radio)
  526.                                     bass.BASS_ChannelPlay(radio, false)
  527.                                 end
  528.                                 Buy = true
  529.                                 if Tp == true then        
  530.                                     Psync = true
  531.                                     local data = samp_create_sync_data('player')
  532.                                     data.position.x = x
  533.                                     data.position.y = y
  534.                                     data.position.z = z
  535.                                     data.send()
  536.                                     if isCharInAnyCar(PLAYER_PED) then
  537.                                         warpCharFromCarToCoord(PLAYER_PED, x, y, z)                        
  538.                                     else
  539.                                         setCharCoordinates(PLAYER_PED, x, y, z)
  540.                                     end
  541.                                     Psync = false
  542.                                 else
  543.                                     if isCharInAnyCar(PLAYER_PED) then
  544.                                         setGameKeyState(15,255)
  545.                                     end
  546.                                     taskGoStraightToCoord(PLAYER_PED, x, y, z, 7, 5000)
  547.                                     repeat
  548.                                         wait(0)
  549.                                         setGameKeyState(1,128)
  550.                                         setGameKeyState(16,255)
  551.                                     until locateCharAnyMeans2d(PLAYER_PED, x, y, z, 0.5, false) or Buy == false
  552.                                 end
  553.                             end
  554.                         end
  555.                     if zstring:find('продается') then
  556.                         positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
  557.                         distance = getDistanceBetweenCoords3d(x, y, z, positionX, positionY, positionZ)
  558.                         z = z - 2
  559.                         if distance <= 50 then
  560.                             Fafk.v = false
  561.                             if distance > 3 then
  562.                                 y = y + 1
  563.                                 Psync = true
  564.                                 local data = samp_create_sync_data('player')
  565.                                 data.position.x = x
  566.                                 data.position.y = y
  567.                                 data.position.z = z
  568.                                 data.send()
  569.                                 if isCharInAnyCar(PLAYER_PED) then
  570.                                     warpCharFromCarToCoord(PLAYER_PED, x, y, z)                        
  571.                                 else
  572.                                     setCharCoordinates(PLAYER_PED, x, y, z)
  573.                                 end
  574.                                 Psync = false
  575.                             end
  576.                             if Sound.v == true then
  577.                                 bass.BASS_ChannelStop(radio)
  578.                                 bass.BASS_ChannelPlay(radio, false)
  579.                             end
  580.                             Buy = true
  581.                             StopFilling = false
  582.                             lua_thread.create(function()
  583.                                 repeat
  584.                                 sampSendChat('/buyfilling')
  585.                                 wait(100)
  586.                                 until StopFilling == true
  587.                             end)
  588.                         end
  589.                     end
  590.                 end
  591.             end
  592.         end
  593.      
  594.         if sampIsDialogActive() == true and CloseD == true then
  595.             wait(100)
  596.             sampCloseCurrentDialogWithButton(0)
  597.             CloseD = false
  598.         end
  599.      
  600.     end
  601. end
  602.  
  603. function hcatch()
  604.     if InfoHouse == 0 then
  605.         InfoHouse = 1
  606.         sampAddChatMessage("[Catcher] Встаньте на пикап дома", 0xffffff)
  607.     else
  608.         InfoHouse = 0
  609.         sampAddChatMessage("[Catcher] Скрипт остановлен", 0xffffff)
  610.         removeBlip(checkpoint)
  611.     end
  612. end
  613.  
  614. function tcatch()
  615.     if TaxiCatch == 0 then
  616.         TaxiCatch = 1
  617.         sampAddChatMessage("[Catcher] Скрипт запушен", 0xffffff)
  618.         Buy = true
  619.     else
  620.         TaxiCatch = 0
  621.         Buy = false
  622.         sampAddChatMessage("[Catcher] Скрипт остановлен", 0xffffff)
  623.     end
  624. end
  625.  
  626.  
  627. function sampev.onDestroyPickup(id)
  628.     if id == pickupId and InfoHouse > 0 then
  629.         InfoHouse = 4
  630.     end
  631. end
  632.  
  633. function sampev.onCreatePickup(id,model,pickupType,pos)
  634.     if HouseCatcher == true then
  635.         if model == 1273 or model == 19524 then
  636.             positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
  637.             distance = getDistanceBetweenCoords3d(pos.x, pos.y, pos.z, positionX, positionY, positionZ)
  638.             if distance <= 50 then
  639.                 Fafk.v = false
  640.                 x = pos.x
  641.                 y = pos.y
  642.                 z = pos.z - 2
  643.                 Buy = true
  644.                 if Evicting.v == true then
  645.                     sampSendChat('/evicting')
  646.                 end
  647.                 if Tp == true then
  648.                     Psync = true
  649.                     local data = samp_create_sync_data('player')
  650.                     data.position.x = x
  651.                     data.position.y = y
  652.                     data.position.z = z
  653.                     data.send()
  654.                     if isCharInAnyCar(PLAYER_PED) then
  655.                         warpCharFromCarToCoord(PLAYER_PED, x, y, z)                        
  656.                     else
  657.                         setCharCoordinates(PLAYER_PED, x, y, z)
  658.                     end
  659.                     Psync = false
  660.                 end
  661.             end
  662.         end
  663.     end
  664. end
  665.  
  666. function sampev.onServerMessage(color, text)
  667.     if text:find('Этот бизнес уже кто-то купил.') and not text:find('_') and Buy == true then
  668.         BusinessCatcher = false
  669.         Buy = false
  670.     end
  671.     if text:find('Поздравляем, Вы')and color == 866792362 and Aoff.v == true then
  672.         sampDisconnectWithReason(1)
  673.     end
  674. end
  675.  
  676. function sampev.onSendPlayerSync(data)
  677.     if Psync == true or Fafk.v == true then
  678.         return false
  679.     end
  680. end
  681.  
  682. function sampev.onSendVehicleSync(data)
  683.     if Fafk.v == true then
  684.         return false
  685.     end
  686. end
  687.  
  688. function sampev.onCreate3DText(id,color,pos,dist,tst,attachedPlayerId,attachedVehicleId,text)
  689.     if BusinessCatcher == true then
  690.         if zstring ~= nil then
  691.             if text:find('Владелец: {FFFFFF}нет') or text:find('Владелец: {FF9900}Нет') then
  692.                 positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
  693.                 distance = getDistanceBetweenCoords3d(pos.x, pos.y, pos.z, positionX, positionY, positionZ)
  694.                 if distance <= 50 then
  695.                     Fafk.v = false
  696.                     x = pos.x
  697.                     y = pos.y
  698.                     z = pos.z - 2
  699.                     Buy = true
  700.                     if Tp == true then
  701.                         Psync = true
  702.                         local data = samp_create_sync_data('player')
  703.                         data.position.x = x
  704.                         data.position.y = y
  705.                         data.position.z = z
  706.                         data.send()
  707.                         if isCharInAnyCar(PLAYER_PED) then
  708.                             warpCharFromCarToCoord(PLAYER_PED, x, y, z)                        
  709.                         else
  710.                             setCharCoordinates(PLAYER_PED, x, y, z)
  711.                         end
  712.                         Psync = false
  713.                     end
  714.                 end
  715.             end
  716.         end
  717.     end
  718. end
  719.  
  720. function sampev.onShowDialog(id, style, title, btn, btn2, Dtext)
  721.  
  722.     if Buy == true then
  723.         if Dtext:find('продается') and btn:find('Купить') then
  724.             if not Dtext:find('заправ') then
  725.             sampSendDialogResponse(id, 1, -1, '')
  726.             bass.BASS_ChannelStop(radio)
  727.             bass.BASS_ChannelPlay(radio, false)
  728.             Buy = false
  729.             TaxiCatch = 0
  730.             return false
  731.             end
  732.         end
  733.  
  734.         if title:find('Частный дом') or title:find('Квартира') then
  735.             if btn:find('Купить') then
  736.                 sampSendDialogResponse(id, 1, -1, '')
  737.                 if Tp == true then
  738.                     return false
  739.                 else
  740.                     CloseD = true
  741.                 end
  742.             end
  743.         end
  744.         if Dtext:find('Вы действительно хотите купить этот дом') then    
  745.             Buy = false
  746.             sampSendDialogResponse(id, 1, -1, '')
  747.             if Tp == true then
  748.                 return false
  749.                 else
  750.                 CloseD = true
  751.             end
  752.         end
  753.         if Dtext:find('Вы действительно хотите купить эту квартиру') then    
  754.             Buy = false
  755.             sampSendDialogResponse(id, 1, -1, '')
  756.             if Tp == true then
  757.                 return false
  758.                 else
  759.                 CloseD = true
  760.             end
  761.         end
  762.         if Dtext:find('Этот бизнес продается') and btn2:find('Купить') then
  763.                 sampSendDialogResponse(id, 0, -1, '')
  764.                 if Tp == true then
  765.                     return false
  766.                     else
  767.                     CloseD = true
  768.                 end
  769.         end
  770.         if Dtext:find('Вы действительно хотите купить этот бизнес') and btn2:find('Да') then
  771.             Buy = false
  772.             sampSendDialogResponse(id, 0, -1, '')        
  773.             if Tp == true then
  774.                 return false
  775.             else
  776.                 CloseD = true
  777.             end
  778.         end
  779.         if title:find('станция') and btn:find('Купить')  then
  780.             StopFilling = true
  781.             BusinessCatcher = false
  782.             sampSendDialogResponse(id, 1, -1, '')
  783.             print('test')        
  784.             if Tp == true then
  785.                 return false
  786.             else
  787.                 CloseD = true
  788.             end
  789.             Buy = false
  790.         end
  791.         if Dtext:find('отель продается') and btn:find('Да')  then
  792.             sampSendDialogResponse(id, 1, -1, '')
  793.             if Tp == true then
  794.                 return false
  795.             else
  796.                 CloseD = true
  797.             end
  798.         end
  799.         if Dtext:find('Вы действительно хотите купить этот отель') then
  800.             Buy = false
  801.             sampSendDialogResponse(id, 1, -1, '')
  802.             if Tp == true then
  803.                 return false
  804.             else
  805.                 CloseD = true
  806.             end
  807.         end
  808.     end
  809. end
  810.  
  811. function menu()
  812.     main_window_state.v = not main_window_state.v
  813.     imgui.Process = main_window_state.v
  814.     if main_window_state.v == true then
  815.         imgui.ShowCursor = true
  816.     else
  817.         imgui.ShowCursor = false
  818.     end
  819. end
  820.  
  821. function sphere()
  822.     removeSphere(sphere)
  823.     local ChatCMD = sampGetChatInputText()
  824.     radius = ChatCMD:match('%d+')
  825.     if radius ~= nil then
  826.         radius = tonumber(radius)
  827.         if radius > 0 then
  828.             positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
  829.             sphere = addSphere(positionX, positionY, positionZ, radius*2)
  830.             printStringNow('Sphere ~g~created', 2000)
  831.         else
  832.             printStringNow('Sphere ~r~deleted', 2000)
  833.         end
  834.     else
  835.         printStringNow('Sphere ~r~deleted', 2000)
  836.     end
  837. end
  838.  
  839. function imgui.OnDrawFrame()
  840. if main_window_state.v == false then
  841.     imgui.ShowCursor = false
  842. end
  843.   if main_window_state.v then
  844.     imgui.SetNextWindowSize(imgui.ImVec2(200, 420), imgui.Cond.FirstUseEver)
  845.     imgui.SetNextWindowPos(imgui.ImVec2(rx-220, ry/2-210), imgui.Cond.FirstUseEver)
  846.     imgui.Begin('DRP Catcher - by westwow', main_window_state, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize)
  847.     imgui.Text(u8'Клавиши:')
  848.     imgui.Separator()
  849.     imgui.Text(u8'Ловля домов:')
  850.     imgui.SameLine(160.0, 0.0)
  851.     if imgui.Button(u8(string.format('%d',HouseKey)), imgui.ImVec2(30, 20)) then
  852.         keyh_window_state.v = true
  853.         keyb_window_state.v = false
  854.         input_int_data.v = HouseKey
  855.     end
  856.     imgui.Text(u8'Ловля бизнесов:')
  857.     imgui.SameLine(160.0, 0.0)
  858.     if imgui.Button(u8(string.format('%d',BizKey)), imgui.ImVec2(30, 20)) then
  859.         keyb_window_state.v = true
  860.         keyh_window_state.v = false
  861.         input_int_data.v = BizKey
  862.     end
  863.      imgui.Text(u8'Режим:')
  864.     imgui.Separator()
  865.     if imgui.RadioButton(u8'Телепорт', Tp) then
  866.         Tp = true
  867.         Beg = false
  868.     end
  869.     if imgui.RadioButton(u8'Бег', Beg) then
  870.         Tp = false
  871.         Beg = true
  872.     end
  873.     imgui.Text(u8'Настройки:')
  874.     imgui.Separator()
  875.     imgui.Checkbox(u8'Автовыселение', Evicting)
  876.     imgui.Checkbox(u8'Поиск имущества в стриме', Visible)
  877.     imgui.Checkbox(u8'+ звук', SsSound)
  878.     imgui.Checkbox(u8'Звуковое оповещение', Sound)
  879.     imgui.Checkbox(u8'Индикатор(слева сверху)', Indicator)    
  880.     imgui.Separator()
  881.     if imgui.Checkbox(u8'Фейк афк', Fafk) then
  882.         AFKrand = math.random(300, 1200)
  883.         AFKtimer = os.time()    
  884.     end
  885.     imgui.Checkbox(u8'Авто дисконект', Aoff)
  886.     if imgui.Checkbox(u8'Работа в свернутом режиме', Swork)    then
  887.             WorkInBackground(Swork.v)
  888.     end
  889.     imgui.Spacing()
  890.     imgui.Spacing()
  891.     imgui.Spacing()
  892.     imgui.SameLine(30.0, 0.0)
  893.     if imgui.Button(u8'Сохранить настройки', imgui.ImVec2(150, 20)) then
  894.         local newData = {
  895.       Keys = {
  896.         House = HouseKey,
  897.         Business = BizKey
  898.       },
  899.       Settings = {
  900.         Tp = Tp,
  901.         Beg = Beg,
  902.         Evicting = Evicting.v,
  903.         Sound = Sound.v,
  904.         Indication = Indicator.v,
  905.         StreamSnipe = Visible.v
  906.       }
  907.         }
  908.         if inicfg.save(newData, "Catcher") then
  909.             main_window_state.v = not main_window_state.v
  910.             imgui.Process = main_window_state.v
  911.             imgui.ShowCursor = false
  912.         end
  913.     end
  914.     imgui.End()
  915.   end
  916.   if keyh_window_state.v then
  917.     imgui.SetNextWindowSize(imgui.ImVec2(170, 100), imgui.Cond.FirstUseEver) -- меняем размер
  918.     imgui.SetNextWindowPos(imgui.ImVec2(rx/2-135, ry/2-50), imgui.Cond.FirstUseEver)
  919.     imgui.Begin(u8'Настройка клавиши', true, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize)
  920.     imgui.Text(u8'Введите номер клавиши')
  921.     imgui.InputInt('', input_int_data, 0, 0)
  922.     if imgui.IsWindowAppearing() then
  923.         imgui.SetKeyboardFocusHere(-1)
  924.     end
  925.     if imgui.Button(u8'Сохранить')  then
  926.         keyh_window_state.v = false
  927.         if input_int_data.v < 250 and input_int_data.v > 0 then
  928.             HouseKey = input_int_data.v
  929.         end
  930.     end
  931.     if not sampIsChatInputActive() and not sampIsDialogActive() and not isSampfuncsConsoleActive() and isPlayerPlaying(playerHandle) then
  932.         if isKeyDown(13) == true then
  933.             keyh_window_state.v = false
  934.             if input_int_data.v < 250 and input_int_data.v > 0 then
  935.                 HouseKey = input_int_data.v
  936.             end
  937.         end
  938.     end
  939.     imgui.End()
  940.   end
  941.  
  942.   if keyb_window_state.v then
  943.     imgui.SetNextWindowSize(imgui.ImVec2(170, 100), imgui.Cond.FirstUseEver) -- меняем размер
  944.     imgui.SetNextWindowPos(imgui.ImVec2(rx/2-135, ry/2-50), imgui.Cond.FirstUseEver)
  945.     imgui.Begin(u8'Настройка клавиши', true, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize)
  946.     imgui.Text(u8'Введите номер клавиши')
  947.     imgui.InputInt('', input_int_data, 0, 0)
  948.     if imgui.IsWindowAppearing() then
  949.         imgui.SetKeyboardFocusHere(-1)
  950.     end
  951.     if imgui.Button(u8'Сохранить') then
  952.         keyb_window_state.v = false
  953.         BizKey = input_int_data.v
  954.     end
  955.     if not sampIsChatInputActive() and not sampIsDialogActive() and not isSampfuncsConsoleActive() and isPlayerPlaying(playerHandle) then
  956.         if isKeyDown(13) == true then
  957.             keyb_window_state.v = false
  958.             BizKey = input_int_data.v
  959.         end
  960.     end
  961.     imgui.End()
  962.   end
  963. end
  964.  
  965.  
  966.  
  967.  
  968. function samp_create_sync_data(sync_type, copy_from_player)
  969.  
  970.     copy_from_player = copy_from_player or true
  971.     local sync_traits = {
  972.         player = {'PlayerSyncData', raknet.PACKET.PLAYER_SYNC, sampStorePlayerOnfootData},
  973.         vehicle = {'VehicleSyncData', raknet.PACKET.VEHICLE_SYNC, sampStorePlayerIncarData},
  974.         passenger = {'PassengerSyncData', raknet.PACKET.PASSENGER_SYNC, sampStorePlayerPassengerData},
  975.         aim = {'AimSyncData', raknet.PACKET.AIM_SYNC, sampStorePlayerAimData},
  976.         trailer = {'TrailerSyncData', raknet.PACKET.TRAILER_SYNC, sampStorePlayerTrailerData},
  977.         unoccupied = {'UnoccupiedSyncData', raknet.PACKET.UNOCCUPIED_SYNC, nil},
  978.         bullet = {'BulletSyncData', raknet.PACKET.BULLET_SYNC, nil},
  979.         spectator = {'SpectatorSyncData', raknet.PACKET.SPECTATOR_SYNC, nil}
  980.     }
  981.     local sync_info = sync_traits[sync_type]
  982.     local data_type = 'struct ' .. sync_info[1]
  983.     local data = ffi.new(data_type, {})
  984.     local raw_data_ptr = tonumber(ffi.cast('uintptr_t', ffi.new(data_type .. '*', data)))
  985.     -- copy player's sync data to the allocated memory
  986.     if copy_from_player then
  987.         local copy_func = sync_info[3]
  988.         if copy_func then
  989.             local _, player_id
  990.             if copy_from_player == true then
  991.                 _, player_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
  992.             else
  993.                 player_id = tonumber(copy_from_player)
  994.             end
  995.             copy_func(player_id, raw_data_ptr)
  996.         end
  997.     end
  998.     -- function to send packet
  999.     local func_send = function()
  1000.         local bs = raknetNewBitStream()
  1001.         raknetBitStreamWriteInt8(bs, sync_info[2])
  1002.         raknetBitStreamWriteBuffer(bs, raw_data_ptr, ffi.sizeof(data))
  1003.         raknetSendBitStreamEx(bs, sampfuncs.HIGH_PRIORITY, sampfuncs.UNRELIABLE_SEQUENCED, 1)
  1004.         raknetDeleteBitStream(bs)
  1005.     end
  1006.     -- metatable to access sync data and 'send' function
  1007.     local mt = {
  1008.         __index = function(t, index)
  1009.             return data[index]
  1010.         end,
  1011.         __newindex = function(t, index, value)
  1012.             data[index] = value
  1013.         end
  1014.     }
  1015.     return setmetatable({send = func_send}, mt)
  1016. end
  1017.  
  1018. function async_http_request(method, url, args, resolve, reject)
  1019.     local request_lane = lanes.gen('*', {package = {path = package.path, cpath = package.cpath}}, function()
  1020.         local requests = require 'requests'
  1021.         local ok, result = pcall(requests.request, method, url, args)
  1022.         if ok then
  1023.             result.json, result.xml = nil, nil
  1024.             return true, result
  1025.         else
  1026.             return false, result
  1027.         end
  1028.     end)
  1029.     if not reject then reject = function() end end
  1030.     lua_thread.create(function()
  1031.         local lh = request_lane()
  1032.         while true do
  1033.             local status = lh.status
  1034.             if status == 'done' then
  1035.                 local ok, result = lh[1], lh[2]
  1036.                 if ok then resolve(result) else reject(result) end
  1037.                 return
  1038.             elseif status == 'error' then
  1039.                 return reject(lh[1])
  1040.             elseif status == 'killed' or status == 'cancelled' then
  1041.                 return reject(status)
  1042.             end
  1043.             wait(0)
  1044.         end
  1045.     end)
  1046. end
  1047.  
  1048. function download_handler(id, status, p1, p2)
  1049.   if status == dlstatus.STATUS_ENDDOWNLOADDATA then
  1050.     RegFileD = true
  1051.   end
  1052. end
  1053.  
  1054. function WorkInBackground(work)
  1055.     local memory = require 'memory'
  1056.     if work then
  1057.         memory.setuint8(7634870, 1)
  1058.         memory.setuint8(7635034, 1)
  1059.         memory.fill(7623723, 144, 8)
  1060.         memory.fill(5499528, 144, 6)
  1061.     else
  1062.         memory.setuint8(7634870, 0)
  1063.         memory.setuint8(7635034, 0)
  1064.         memory.hex2bin('5051FF1500838500', 7623723, 8)
  1065.         memory.hex2bin('0F847B010000', 5499528, 6)
  1066.     end
  1067. end
Add Comment
Please, Sign In to add comment