SlonPvpru

[ARZ] OnFootTeleport Sainix v1.1

Apr 24th, 2020
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 54.01 KB | None | 0 0
  1. require "lib.sampfuncs"
  2. require "lib.moonloader"
  3.  
  4. script_authors('Sainix',"vk.com/roma_chepiga")
  5. script_version("1.1")
  6. local mem = require "memory"
  7.  
  8. rTp = false
  9. sync = false
  10. local keys = require "vkeys"
  11. local sampev = require 'lib.samp.events'
  12.  
  13. require "lib.sampfuncs"
  14. require "lib.moonloader"
  15.  
  16. local requests = require('requests')
  17. local verison = " 1.0, release"
  18. local imgui = require 'imgui'
  19. local events = require 'lib.samp.events'
  20. local encoding = require('lib.encoding')
  21. local aaa = "СК ТИМ НЕ КРЯКАЙТЕ ПЖ"
  22. local aaa1 = "СК ТИМ НЕ КРЯКАЙТЕ ПЖ"
  23. local aaa2 = "СК ТИМ НЕ КРЯКАЙТЕ ПЖ"
  24. local aaa3 = "СК ТИМ НЕ КРЯКАЙТЕ ПЖ"
  25. local aaa4 = "СК ТИМ НЕ КРЯКАЙТЕ ПЖ"
  26. local aaa5 = "СК ТИМ НЕ КРЯКАЙТЕ ПЖ"
  27. local car1 = imgui.ImBool(false)
  28. local car2 = imgui.ImBool(false)
  29. local car3 = imgui.ImBool(false)
  30. local car4 = imgui.ImBool(false)
  31. local car5 = imgui.ImBool(false)
  32. local car6 = imgui.ImBool(false)
  33. local car7 = imgui.ImBool(false)
  34. local car8 = imgui.ImBool(false)
  35. local car9 = imgui.ImBool(false)
  36. local car10 = imgui.ImBool(false)
  37. local car11 = imgui.ImBool(false)
  38. local car12 = imgui.ImBool(false)
  39. local car13 = imgui.ImBool(false)
  40. local car14 = imgui.ImBool(false)
  41. local car15 = imgui.ImBool(false)
  42. local car16 = imgui.ImBool(false)
  43. local car17 = imgui.ImBool(false)
  44. local car18 = imgui.ImBool(false)
  45. local car19 = imgui.ImBool(false)
  46. local car20 = imgui.ImBool(false)
  47. local car21 = imgui.ImBool(false)
  48. local car22 = imgui.ImBool(false)
  49. local car23 = imgui.ImBool(false)
  50. local car24 = imgui.ImBool(false)
  51. local car25 = imgui.ImBool(false)
  52. local car26 = imgui.ImBool(false)
  53. local car27 = imgui.ImBool(false)
  54. local car28 = imgui.ImBool(false)
  55. local car29 = imgui.ImBool(false)
  56. local car30 = imgui.ImBool(false)
  57. local car31 = imgui.ImBool(false)
  58. local car32 = imgui.ImBool(false)
  59. local car33 = imgui.ImBool(false)
  60. local car34 = imgui.ImBool(false)
  61. local car35 = imgui.ImBool(false)
  62. local car36 = imgui.ImBool(false)
  63. local car37 = imgui.ImBool(false)
  64. local car38 = imgui.ImBool(false)
  65. local car39 = imgui.ImBool(false)
  66. local car40 = imgui.ImBool(false)
  67. local car41 = imgui.ImBool(false)
  68. local car42 = imgui.ImBool(false)
  69. local car43 = imgui.ImBool(false)
  70. local car44 = imgui.ImBool(false)
  71. local car45 = imgui.ImBool(false)
  72. local car46 = imgui.ImBool(false)
  73. local car47 = imgui.ImBool(false)
  74. local car48 = imgui.ImBool(false)
  75. local car49 = imgui.ImBool(false)
  76. local car50 = imgui.ImBool(false)
  77. local car51 = imgui.ImBool(false)
  78. local car52 = imgui.ImBool(false)
  79. local car53 = imgui.ImBool(false)
  80.  
  81. local radioState = imgui.ImInt(1)
  82. inputID = imgui.ImBuffer(4096)
  83. local maintest_window_state = imgui.ImBool(false)
  84. local chkAutoBuy = imgui.ImBool(false)
  85. local chkCatcherState = imgui.ImBool(false)
  86. local pX, pY, pZ = 0
  87. imgui.SwitchContext()
  88. local style = imgui.GetStyle()
  89. local colors = style.Colors
  90. local clr = imgui.Col
  91. local ImVec4 = imgui.ImVec4
  92. local ImVec2 = imgui.ImVec2
  93. local ev = require 'lib.samp.events'
  94. local isAdm = false
  95. local admin = -1
  96. local active = true
  97. local sms = true
  98. local captchaS0 = 0
  99. local captchaS1 = 0
  100. local captchaS2 = 0
  101. local captchaS3 = 0
  102. local captchaS4 = 0
  103. resCap = 0
  104.  
  105. local verison = "1.6"
  106. local imgui = require 'imgui'
  107. local samp = require('samp.events')
  108.  
  109. local q = require 'lib.samp.events'
  110. local q = require 'lib.samp.events'
  111. local vector = require 'vector3d'
  112. local event = require('lib.samp.events')
  113. local corsync = false
  114. local up = false
  115. local step = 1.9
  116. local samp = require('samp.events')
  117.  
  118. gmped = false
  119. gmcar = false
  120.  
  121. local q = require 'lib.samp.events'
  122. local delchars = imgui.ImBool(false)
  123. local delcars = imgui.ImBool(false)
  124. local kd = 34
  125. local incar, sync = false, false
  126. local events = require 'lib.samp.events'
  127.  
  128. local s1xreq = {
  129.   _DESCRIPTION = 'Http s1xreq made simpler',
  130.   http_socket = http_socket,
  131.   https_socket = https_socket
  132. }
  133.  
  134. local _s1xreq = {}
  135.  
  136. local ffi = require("ffi")
  137.  
  138. local encoding = require('lib.encoding')
  139.  
  140. local tp = false
  141.  
  142. waitaenter = imgui.ImInt(0)
  143. local radioState = imgui.ImInt(1)
  144. inputID = imgui.ImBuffer(4096)
  145. local main_window_state = imgui.ImBool(false)
  146. local chkAutoBuy = imgui.ImBool(false)
  147. local chkAutoBuyy = imgui.ImBool(false)
  148. local onumbers = imgui.ImBool(false)
  149. local aenter = imgui.ImBool(false)
  150. local hook = require 'samp.events'
  151. local onlyfive = imgui.ImBool(false)
  152. local chkAutoBuyyy = imgui.ImBool(false)
  153. local col = imgui.ImBool(false)
  154. local chkAutoBuyyyy = imgui.ImBool(false)
  155. local chkAutoBuyyyyy = imgui.ImBool(false)
  156. local chkCatcherState = imgui.ImBool(false)
  157. local pX, pY, pZ = 0
  158. imgui.SwitchContext()
  159. local style = imgui.GetStyle()
  160. local colors = style.Colors
  161. local clr = imgui.Col
  162. local ImVec4 = imgui.ImVec4
  163. local ImVec2 = imgui.ImVec2
  164. encoding.default = 'CP1251'
  165.     cp1251 = encoding.CP1251
  166.     u8 = encoding.UTF8
  167. local avtonazatietwo = imgui.ImBool(false)
  168. waitavtonazatietwo = imgui.ImInt(250)
  169. style.WindowPadding = ImVec2(15, 15)
  170. style.WindowRounding = 6.0
  171. style.FramePadding = ImVec2(5, 5)
  172. style.FrameRounding = 4.0
  173. style.ItemSpacing = ImVec2(12, 8)
  174. style.ItemInnerSpacing = ImVec2(8, 6)
  175. style.IndentSpacing = 25.0
  176. style.ScrollbarSize = 15.0
  177. style.ScrollbarRounding = 9.0
  178. style.GrabMinSize = 5.0
  179. style.GrabRounding = 3.0
  180.  
  181.         colors[clr.FrameBg]                = ImVec4(0.16, 0.48, 0.42, 0.54)
  182.         colors[clr.FrameBgHovered]         = ImVec4(0.26, 0.98, 0.85, 0.40)
  183.         colors[clr.FrameBgActive]          = ImVec4(0.26, 0.98, 0.85, 0.67)
  184.         colors[clr.TitleBg]                = ImVec4(0.04, 0.04, 0.04, 1.00)
  185.         colors[clr.TitleBgActive]          = ImVec4(0.16, 0.48, 0.42, 1.00)
  186.         colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 0.51)
  187.         colors[clr.CheckMark]              = ImVec4(0.26, 0.98, 0.85, 1.00)
  188.         colors[clr.SliderGrab]             = ImVec4(0.24, 0.88, 0.77, 1.00)
  189.         colors[clr.SliderGrabActive]       = ImVec4(0.26, 0.98, 0.85, 1.00)
  190.         colors[clr.Button]                 = ImVec4(0.26, 0.98, 0.85, 0.40)
  191.         colors[clr.ButtonHovered]          = ImVec4(0.26, 0.98, 0.85, 1.00)
  192.         colors[clr.ButtonActive]           = ImVec4(0.06, 0.98, 0.82, 1.00)
  193.         colors[clr.Header]                 = ImVec4(0.26, 0.98, 0.85, 0.31)
  194.         colors[clr.HeaderHovered]          = ImVec4(0.26, 0.98, 0.85, 0.80)
  195.         colors[clr.HeaderActive]           = ImVec4(0.26, 0.98, 0.85, 1.00)
  196.         colors[clr.Separator]              = colors[clr.Border]
  197.         colors[clr.SeparatorHovered]       = ImVec4(0.10, 0.75, 0.63, 0.78)
  198.         colors[clr.SeparatorActive]        = ImVec4(0.10, 0.75, 0.63, 1.00)
  199.         colors[clr.ResizeGrip]             = ImVec4(0.26, 0.98, 0.85, 0.25)
  200.         colors[clr.ResizeGripHovered]      = ImVec4(0.26, 0.98, 0.85, 0.67)
  201.         colors[clr.ResizeGripActive]       = ImVec4(0.26, 0.98, 0.85, 0.95)
  202.         colors[clr.PlotLines]              = ImVec4(0.61, 0.61, 0.61, 1.00)
  203.         colors[clr.PlotLinesHovered]       = ImVec4(1.00, 0.81, 0.35, 1.00)
  204.         colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.98, 0.85, 0.35)
  205.         colors[clr.Text]                   = ImVec4(1.00, 1.00, 1.00, 1.00)
  206.         colors[clr.TextDisabled]           = ImVec4(0.50, 0.50, 0.50, 1.00)
  207.         colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 0.94)
  208.         colors[clr.ChildWindowBg]          = ImVec4(1.00, 1.00, 1.00, 0.00)
  209.         colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 0.94)
  210.         colors[clr.ComboBg]                = colors[clr.PopupBg]
  211.         colors[clr.Border]                 = ImVec4(0.43, 0.43, 0.50, 0.50)
  212.         colors[clr.BorderShadow]           = ImVec4(0.00, 0.00, 0.00, 0.00)
  213.         colors[clr.MenuBarBg]              = ImVec4(0.14, 0.14, 0.14, 1.00)
  214.         colors[clr.ScrollbarBg]            = ImVec4(0.02, 0.02, 0.02, 0.53)
  215.         colors[clr.ScrollbarGrab]          = ImVec4(0.31, 0.31, 0.31, 1.00)
  216.         colors[clr.ScrollbarGrabHovered]   = ImVec4(0.41, 0.41, 0.41, 1.00)
  217.         colors[clr.ScrollbarGrabActive]    = ImVec4(0.51, 0.51, 0.51, 1.00)
  218.         colors[clr.CloseButton]            = ImVec4(0.41, 0.41, 0.41, 0.50)
  219.         colors[clr.CloseButtonHovered]     = ImVec4(0.98, 0.39, 0.36, 1.00)
  220.         colors[clr.CloseButtonActive]      = ImVec4(0.98, 0.39, 0.36, 1.00)
  221.         colors[clr.PlotHistogram]          = ImVec4(0.90, 0.70, 0.00, 1.00)
  222.         colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 0.60, 0.00, 1.00)
  223.         colors[clr.ModalWindowDarkening]   = ImVec4(0.80, 0.80, 0.80, 0.35)
  224.  
  225. local q = require 'lib.samp.events'
  226. local vector = require 'vector3d'
  227. local tp1 = false
  228. local delay = 600
  229. local coord = false
  230. local surfing2 = false
  231. local Surfing = false
  232. local font = renderCreateFont("Arial", 10, 5)
  233. local dlstatus = require('moonloader').download_status
  234.  
  235. local q = require 'lib.samp.events'
  236. local samp = require 'lib.samp.events'
  237. local vector = require 'vector3d'
  238. local tp, sync = false, false
  239. local tpCount, timer = 0, 0
  240. local tpTime = nil
  241.  
  242.  
  243. requests = require('requests')
  244.  
  245. function getserial()
  246.     local ffi = require("ffi")
  247.     ffi.cdef[[
  248.     int __stdcall GetVolumeInformationA(
  249.     const char* lpRootPathName,
  250.     char* lpVolumeNameBuffer,
  251.     uint32_t nVolumeNameSize,
  252.     uint32_t* lpVolumeSerialNumber,
  253.     uint32_t* lpMaximumComponentLength,
  254.     uint32_t* lpFileSystemFlags,
  255.     char* lpFileSystemNameBuffer,
  256.     uint32_t nFileSystemNameSize
  257.     );
  258.     ]]
  259.     local serial = ffi.new("unsigned long[1]", 0)
  260.     ffi.C.GetVolumeInformationA(nil, nil, 0, serial, nil, nil, nil, 0)
  261.     return serial[0]
  262. end
  263.  
  264. function autoupdate(json_url, prefix, url)
  265.   local dlstatus = require('moonloader').download_status
  266.   local json = getWorkingDirectory() .. '\\'..thisScript().name..'-version.json'
  267.   if doesFileExist(json) then os.remove(json) end
  268.   downloadUrlToFile(json_url, json,
  269.     function(id, status, p1, p2)
  270.       if status == dlstatus.STATUSEX_ENDDOWNLOAD then
  271.         if doesFileExist(json) then
  272.           local f = io.open(json, 'r')
  273.           if f then
  274.             local info = decodeJson(f:read('*a'))
  275.             updatelink = info.updateurl
  276.             updateversion = info.latest
  277.             f:close()
  278.             os.remove(json)
  279.             if updateversion ~= thisScript().version then
  280.               lua_thread.create(function(prefix)
  281.                 local dlstatus = require('moonloader').download_status
  282.                 local color = -1
  283.                 msg(('Обнаружено обновление. Пытаюсь обновиться c '..thisScript().version..' на '..updateversion), color)
  284.                 wait(250)
  285.                 downloadUrlToFile(updatelink, thisScript().path,
  286.                   function(id3, status1, p13, p23)
  287.                     if status1 == dlstatus.STATUS_DOWNLOADINGDATA then
  288.                       print(string.format('Загружено %d из %d.', p13, p23))
  289.                     elseif status1 == dlstatus.STATUS_ENDDOWNLOADDATA then
  290.                       print('Загрузка обновления завершена.')
  291.                       msg(('Обновление завершено!'), color)
  292.                       goupdatestatus = true
  293.                       lua_thread.create(function() wait(500) thisScript():reload() end)
  294.                     end
  295.                     if status1 == dlstatus.STATUSEX_ENDDOWNLOAD then
  296.                       if goupdatestatus == nil then
  297.                         msg(('Обновление прошло неудачно. Запускаю устаревшую версию..'), color)
  298.                         update = false
  299.                       end
  300.                     end
  301.                   end
  302.                 )
  303.                 end, prefix
  304.               )
  305.             else
  306.               update = false
  307.               print('v'..thisScript().version..': Обновление не требуется.')
  308.             end
  309.           end
  310.         else
  311.           print('v'..thisScript().version..': Не могу проверить обновление. Смиритесь или проверьте самостоятельно на '..url)
  312.           update = false
  313.         end
  314.       end
  315.     end
  316.   )
  317.   while update ~= false do wait(100) end
  318. end
  319.  
  320. function checkKey()
  321.         response = requests.get('http://f0426516.xsph.ru/auth.php?code='..getserial())
  322.         if not response.text:match("<body>(.*)</body>"):find("-1") then -- Если ключ есть в бд
  323.             else
  324.                 msg('Отсутствует ключ для авторизации. Данные скопированы в буфер обмена. Передайте их автору: vk.com/roma_chepiga')
  325.                 os.execute("explorer \"https://vk.com/roma_chepiga\"")
  326.                 setClipboardText(getserial())
  327.                 thisScript():unload()
  328.                 sasakrack = false
  329.         end
  330. end
  331.  
  332. function q.onSetPlayerPos(p)
  333.     if sync then
  334.         timer = os.clock()
  335.         return false
  336.     end
  337. end
  338.  
  339. function msg(text)
  340.     return sampAddChatMessage('{FBFF00}| SainixTeleport | {FFFFFF}'..text, 0xFBFF00)
  341. end
  342.  
  343. function pokazatel()
  344.     lua_thread.create(function()
  345.         while true do wait(0)
  346.     if left ~= nil and tp1 then
  347.                                 local px, py = getScreenResolution()
  348.             renderFontDrawText(font, "Distance: " .. left .. "." .. math.random(00,99), px/5+1280, 112, -1)
  349.         end
  350.     end
  351. end)
  352. end
  353.  
  354. function q.onSendPlayerSync(data)
  355.     if tp then return false end
  356. end
  357.  
  358. function sendOnfootSync(x, y, z)
  359.     local data = samp_create_sync_data('player')
  360.     data.position = {x, y, z}
  361.     data.moveSpeed = {0.299999, 0.299999, -0.299999}
  362.     data.send()
  363. end
  364.  
  365. function samp_create_sync_data(sync_type, copy_from_player)
  366.     local ffi = require 'ffi'
  367.     local sampfuncs = require 'sampfuncs'
  368.     local raknet = require 'samp.raknet'
  369.    
  370.     copy_from_player = copy_from_player or true
  371.     local sync_traits = {
  372.         player = {'PlayerSyncData', raknet.PACKET.PLAYER_SYNC, sampStorePlayerOnfootData},
  373.         vehicle = {'VehicleSyncData', raknet.PACKET.VEHICLE_SYNC, sampStorePlayerIncarData},
  374.         passenger = {'PassengerSyncData', raknet.PACKET.PASSENGER_SYNC, sampStorePlayerPassengerData},
  375.         aim = {'AimSyncData', raknet.PACKET.AIM_SYNC, sampStorePlayerAimData},
  376.         trailer = {'TrailerSyncData', raknet.PACKET.TRAILER_SYNC, sampStorePlayerTrailerData},
  377.         unoccupied = {'UnoccupiedSyncData', raknet.PACKET.UNOCCUPIED_SYNC, nil},
  378.         bullet = {'BulletSyncData', raknet.PACKET.BULLET_SYNC, nil},
  379.         spectator = {'SpectatorSyncData', raknet.PACKET.SPECTATOR_SYNC, nil}
  380.     }
  381.     local sync_info = sync_traits[sync_type]
  382.     local data_type = 'struct ' .. sync_info[1]
  383.     local data = ffi.new(data_type, {})
  384.     local raw_data_ptr = tonumber(ffi.cast('uintptr_t', ffi.new(data_type .. '*', data)))
  385.     if copy_from_player then
  386.         local copy_func = sync_info[3]
  387.         if copy_func then
  388.             local _, player_id
  389.             if copy_from_player == true then
  390.                 _, player_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
  391.             else
  392.                 player_id = tonumber(copy_from_player)
  393.             end
  394.             copy_func(player_id, raw_data_ptr)
  395.         end
  396.     end
  397.     local func_send = function()
  398.         local bs = raknetNewBitStream()
  399.         raknetBitStreamWriteInt8(bs, sync_info[2])
  400.         raknetBitStreamWriteBuffer(bs, raw_data_ptr, ffi.sizeof(data))
  401.         raknetSendBitStreamEx(bs, sampfuncs.HIGH_PRIORITY, sampfuncs.UNRELIABLE_SEQUENCED, 1)
  402.         raknetDeleteBitStream(bs)
  403.     end
  404.     local mt = {
  405.         __index = function(t, index)
  406.             return data[index]
  407.         end,
  408.         __newindex = function(t, index, value)
  409.             data[index] = value
  410.         end
  411.     }
  412.     return setmetatable({send = func_send}, mt)
  413. end
  414.  
  415. function getTargetBlipCoordinatesFixed()
  416.     local bool, x, y, z = getTargetBlipCoordinates(); if not bool then return false end
  417.     requestCollision(x, y); loadScene(x, y, z)
  418.     local bool, x, y, z = getTargetBlipCoordinates()
  419.     return bool, x, y, z
  420. end
  421.  
  422. function SearchMarker(posX, posY, posZ)
  423.     local ret_posX = 0.0
  424.     local ret_posY = 0.0
  425.     local ret_posZ = 0.0
  426.     local isFind = false
  427.     for id = 0, 31 do
  428.         local MarkerStruct = 0
  429.         MarkerStruct = 0xC7F168 + id * 56
  430.         local MarkerPosX = representIntAsFloat(readMemory(MarkerStruct + 0, 4, false))
  431.         local MarkerPosY = representIntAsFloat(readMemory(MarkerStruct + 4, 4, false))
  432.         local MarkerPosZ = representIntAsFloat(readMemory(MarkerStruct + 8, 4, false))
  433.         if MarkerPosX ~= 0.0 or MarkerPosY ~= 0.0 or MarkerPosZ ~= 0.0 then
  434.                 ret_posX = MarkerPosX
  435.                 ret_posY = MarkerPosY
  436.                 ret_posZ = MarkerPosZ
  437.                 isFind = true
  438.         end
  439.     end
  440.     return isFind, ret_posX, ret_posY, ret_posZ
  441.   end
  442.  
  443. function ShowHelpMarker(desc)
  444.     imgui.TextDisabled('(?)')
  445.     if imgui.IsItemHovered() then
  446.         imgui.BeginTooltip()
  447.         imgui.PushTextWrapPos(450.0)
  448.         imgui.TextUnformatted(desc)
  449.         imgui.PopTextWrapPos()
  450.         imgui.EndTooltip()
  451.     end
  452. end
  453.  
  454. function ShowMessageMarker(desc)
  455.     imgui.TextDisabled('(!)')
  456.     if imgui.IsItemHovered() then
  457.         imgui.BeginTooltip()
  458.         imgui.PushTextWrapPos(1000.0)
  459.         imgui.TextUnformatted(desc)
  460.         imgui.PopTextWrapPos()
  461.         imgui.EndTooltip()
  462.     end
  463. end
  464.  
  465. function imgui.OnDrawFrame()
  466.   if main_window_state.v then
  467.     imgui.SetNextWindowSize(imgui.ImVec2(500, 500), imgui.Cond.FirstUseEver)
  468.     local sW, sH = getScreenResolution()
  469.     imgui.SetNextWindowPos(imgui.ImVec2(sW / 2, sH / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
  470.  
  471.  
  472.            
  473.    
  474. imgui.Begin(u8'Sainix Teleport | Приватный телепорт ^3', main_window_state, imgui.WindowFlags.NoResize or imgui.WindowFlags.NoCollapse or imgui.WindowFlags.NoSavedSettings)
  475.     imgui.Columns(2, NULL, false)
  476.     imgui.SetColumnOffset(1, 500)
  477.  
  478. if imgui.CollapsingHeader(u8"Помощь в ловле") then
  479. imgui.Checkbox(u8'Коллизия', col)
  480.              ShowHelpMarker(u8'Функция позволяет проходить без проблем через людей (не работает на машины, объекты и прочее).', imgui.SameLine())
  481. imgui.Checkbox(u8'Только цифры', onumbers)
  482.              ShowHelpMarker(u8'В диалог капчи с включённой функией возможно будет ввести только цифры.', imgui.SameLine())
  483. imgui.Checkbox(u8'Только 5 цифр', aenter)
  484.              ShowHelpMarker(u8'Ограничение символов в диалоге капчи.', imgui.SameLine())
  485. imgui.Checkbox(u8'АвтоНажатие "N"', avtonazatietwo)
  486.              ShowHelpMarker(u8'Автоматически нажимает клавишу: "N", когда дом/бизнес слетает (поиск осуществляется по экрану).', imgui.SameLine())
  487.      imgui.Text(u8"Введите задержку Auto N")
  488. imgui.SliderInt(u8"##2", waitavtonazatietwo, 0, 1000)
  489. imgui.Checkbox(u8'АвтоНажатие "ENTER"', onlyfive)
  490.         ShowHelpMarker(u8'Автоматически нажимает клавишу: "ENTER", когда в окне капчи есть 5 символов.', imgui.SameLine())
  491.      imgui.Text(u8"Введите задержку Auto Enter")
  492. imgui.SliderInt(u8"##3", waitaenter, 0, 1000)  
  493. end
  494.  
  495. if imgui.CollapsingHeader(u8"Дополнительные функции") then
  496.                                imgui.Checkbox(u8'Удаление людей', delchars)
  497.                         ShowHelpMarker(u8'Если активен чекбокс, то при нажатии клавиши "E" все люди в зоне стрима удалятся.', imgui.SameLine())
  498.                   imgui.Checkbox(u8'Удаление машин', delcars)
  499.                         ShowHelpMarker(u8'Если активен чекбокс, то при нажатии клавиши "R" все машины в зоне стрима удалятся.', imgui.SameLine())
  500.                         ShowMessageMarker(u8'Убирает все автомобили в зоне прорисовки визуально, но хочу предупредить, что после этого пока Вы не покинете данную зону прорисовки.', imgui.SameLine())
  501. end
  502.  
  503.  
  504. if imgui.CollapsingHeader(u8"ГМ для персонажа и машины") then
  505.      imgui.Text(u8"Активация на клавишу `Insert`.")
  506.          imgui.Text(u8"Защищает Вас от падений, пуль, и прочего.")
  507.      imgui.Text(u8"Активация на клавишу `Home`.")
  508.          imgui.Text(u8"Защищает Ваш транспорт от любых повреждений.")
  509. end
  510.  
  511. if imgui.CollapsingHeader(u8"Действия после покупки") then
  512.         ShowHelpMarker(u8'Определение последующих действий после ловли дома.', imgui.SameLine())
  513. imgui.RadioButton(u8' Ничего не делать', radioState, 1)
  514. imgui.RadioButton(u8' Отключиться от сервера', radioState, 2)
  515. end
  516.  
  517.  
  518. if imgui.CollapsingHeader(u8"Информация") then
  519. imgui.Text(u8"Автор скрипта: Sainix")
  520.        ShowMessageMarker(u8'Вк - https://vk.com/roma_chepiga', imgui.SameLine())
  521.        ShowMessageMarker(u8'Ютуб - https://www.youtube.com/channel/UC3ATgMtTuJ2LS6iM8RU67fw/', imgui.SameLine())
  522. end
  523.  
  524.  
  525. if imgui.CollapsingHeader(u8"Доп. информация") then
  526. imgui.RadioButton(u8' Описание команд:', radioState, 1)
  527. imgui.Text(u8"/stph - меню скрипта ")
  528. imgui.Text(u8"/stp - телепорт на метку ")
  529. ShowHelpMarker(u8'1 способ тп', imgui.SameLine())
  530. imgui.Text(u8"/stp c - телепорт на чекпоинт ")
  531. ShowHelpMarker(u8'1 способ тп', imgui.SameLine())
  532. imgui.Text(u8"/stp2 - телепорт на метку ")
  533. ShowHelpMarker(u8'2 способ тп', imgui.SameLine())
  534. ShowMessageMarker(u8'Может иногда крашить игру', imgui.SameLine())
  535. imgui.Text(u8"/stpc2 - телепорт на чекпоинт ")
  536. ShowHelpMarker(u8'2 способ тп', imgui.SameLine())
  537. ShowMessageMarker(u8'Может иногда крашить игру', imgui.SameLine())
  538. imgui.Text(u8"/stpd (номер дома) - телепорт на дом ")
  539. imgui.Text(u8"/stpb (номер бизнесса) - телепорт на бизнесс ")
  540.  
  541.     end
  542.  
  543.  
  544.  
  545.  
  546. imgui.End()
  547. end
  548. end
  549.  
  550. function ShowMessage(text, title, style)
  551.     ffi.cdef [[
  552.         int MessageBoxA(
  553.             void* hWnd,
  554.             const char* lpText,
  555.             const char* lpCaption,
  556.             unsigned int uType
  557.         );
  558.     ]]
  559.     local hwnd = ffi.cast('void*', readMemory(0x00C8CF88, 4, false))
  560.     ffi.C.MessageBoxA(hwnd, text,  title, style and (style + 0x50000) or 0x50000)
  561. end
  562.  
  563.  
  564. function nopHook(name, bool)
  565.     local samp = require 'samp.events'
  566.         samp[name] = function()
  567.             if bool then
  568.                 return false
  569.             end
  570.         end
  571. end
  572.  
  573. function sendUnoccupiedSyncBySeatId(x, y, z, seatId)
  574.     local data = allocateMemory(67)
  575.     local car = storeCarCharIsInNoSave(PLAYER_PED)
  576.     local _, vehicleId = sampGetVehicleIdByCarHandle(car)
  577.     local rx, ry, rz = getCarRoll(car)
  578.     setStructElement(data, 0, 2, vehicleId, false)
  579.     setStructElement(data, 2, 1, seatId, false)
  580.     -- roll
  581.     setStructFloatElement(data, 3, rx, false)
  582.     setStructFloatElement(data, 7, ry, false)
  583.     setStructFloatElement(data, 11, rz, false)
  584.     -- direction
  585.     setStructFloatElement(data, 15, 0.09, false)
  586.     setStructFloatElement(data, 19, -0.8, false)
  587.     setStructFloatElement(data, 23, 0.02, false)
  588.     -- position
  589.     setStructFloatElement(data, 27, x, false)
  590.     setStructFloatElement(data, 31, y, false)
  591.     setStructFloatElement(data, 35, z, false)
  592.     -- speed
  593.     setStructFloatElement(data, 39, 0.05, false)
  594.     setStructFloatElement(data, 43, 0.05, false)
  595.     setStructFloatElement(data, 47, 0.05, false)
  596.     -- turning speed
  597.     setStructFloatElement(data, 51, 0.005, false)
  598.     setStructFloatElement(data, 55, -0.002, false)
  599.     setStructFloatElement(data, 59, 0.3, false)
  600.     -- car health
  601.     setStructElement(data, 63, 4, 0, false)
  602.     sampSendUnoccupiedData(data)
  603.     freeMemory(data)
  604. end
  605.  
  606. function sendInCarFakePosition(x, y, z)
  607.     for i = 0, 2 do
  608.         local data = allocateMemory(24)
  609.         local _, pId = sampGetPlayerIdByCharHandle(PLAYER_PED)
  610.         sampStorePlayerPassengerData(pId, data)
  611.         local seatId = getStructElement(data, 2, 1, false)
  612.         freeMemory(data)
  613.         sendUnoccupiedSyncBySeatId(x, y, z, seatId)
  614.         sendPassengerSync(x, y, z)
  615.     end
  616. end
  617.  
  618. function getAngle(x1, y1, x2, y2)
  619.     return math.atan2(x2 - x1, y2 - y1);
  620. end
  621.  
  622.  
  623. function hook.onCreate3DText(i, clr, pos, distance, ignoreWalls, playerId, vehicleId, textd)
  624.  
  625.                     if avtonazatietwo.v and (textd:find("*** Дом продается ***") or textd:find("Бизнес продается")) then
  626.                         lua_thread.create(function()
  627.                         wait (waitavtonazatietwo.v)
  628.                         local _, myId = sampGetPlayerIdByCharHandle(PLAYER_PED)
  629.                             local data = allocateMemory(68)
  630.                             sampStorePlayerOnfootData(myId, data)
  631.                             setStructElement(data, 36, 1, 128, false)
  632.                             sampSendOnfootData(data)
  633.                             freeMemory(data)
  634.               end)
  635.               end
  636.               end
  637.  
  638. function hook.onServerMessage(color, text)
  639.   if text:find("{FF6347} Местом спавна автоматически назначен ваш дом. Изменить место спавна {FFFFFF}") then
  640.     if radioState.v == 2 then
  641.       raknetEmulPacketReceiveBitStream(PACKET_DISCONNECTION_NOTIFICATION, raknetNewBitStream())
  642. raknetDeleteBitStream(raknetNewBitStream())
  643. sampDisconnectWithReason(1)
  644.       sampAddChatMessage("{FFFFFF} Дисконнект проведён успешно!", -1)
  645.       radioState.v = 1
  646.     end
  647.     end
  648.     end
  649.  
  650.  
  651.  
  652.               function hook.onShowDialog(dialogID, style, title, button1, button2, txt)
  653.                 if onumbers.v and title:find('Проверка на робота') then
  654.                     lua_thread.create(function()
  655.                                         wait(0)
  656.                  while true do wait(0)
  657.                     inputtext = sampGetCurrentDialogEditboxText()
  658.                     if inputtext ~= '' then
  659.                             sampSetCurrentDialogEditboxText(string.gsub(inputtext, '[^1234567890]',''))
  660.                     end
  661.  
  662.               end
  663.                         end)
  664.                             end
  665. if onlyfive.v and title:find('Проверка на робота') then
  666.                 lua_thread.create(function()
  667.                     wait(0)
  668.                     while true do wait(0)
  669.                 textsumfive = sampGetCurrentDialogEditboxText()
  670.                 if col.v then kol() end
  671.                 if #textsumfive == 5 then
  672.                     wait (waitaenter.v)
  673.                     sampCloseCurrentDialogWithButton(1)
  674.                     onlyfive.v = false
  675.                     break
  676.                     end
  677.               end
  678.                end)
  679.                end
  680.     if aenter.v then
  681.                     lua_thread.create(function()
  682. while true do  
  683. wait(0)            
  684.                 if sampIsDialogActive() and sampGetDialogCaption():find('Проверка на робота') then
  685.        if onumbers.v then sampSetCurrentDialogEditboxText(string.gsub(sampGetCurrentDialogEditboxText(), '[^1234567890]','')) end
  686.        if aenter.v then
  687.         local text = sampGetCurrentDialogEditboxText()
  688.         if #text > 5 then sampSetCurrentDialogEditboxText(text:sub(1, 5)) end
  689.       end
  690.     end
  691.     end
  692.     end)
  693.     end
  694.     end
  695.    
  696. function kol()
  697.     for _, pedv in ipairs(getAllChars()) do
  698.     if doesCharExist(pedv) then
  699.         if pedv ~= playerPed then
  700.        setCharCollision(pedv, false)
  701.     end
  702. end
  703. end
  704. end
  705.  
  706. function main()
  707.     while not isSampAvailable() do wait(0) end
  708.     checkKey()
  709.     wait(0)
  710.     msg('Статус привязки: Активен. Автор: vk.com/roma_chepiga')
  711.     sasakrack = true
  712.     autoupdate("http://f0426516.xsph.ru/update.php", '['..string.upper(thisScript().name)..']: ', "http://f0426516.xsph.ru/update.php")
  713.     encoding.default = 'CP1251'
  714.     cp1251 = encoding.CP1251
  715.     u8 = encoding.UTF8
  716.     imgui.Process = true
  717.     lua_thread.create(function ()
  718.         while true do
  719.           wait(0)
  720.         doKeyCheck()
  721.         end
  722.     end)
  723.     sampRegisterChatCommand("stp2", function(param) state = not state
  724.     vid = tonumber(param)
  725.         if not param:match('%d+') then
  726.             state = false
  727.             return sampAddChatMessage('Используй: /stp2 [vehId]', -1)
  728.         end
  729.         if state then
  730.             lua_thread.create(sit_marker)
  731.             state = false
  732.         end
  733.     end)
  734.     sampRegisterChatCommand("stpc2", function(param) state = not state
  735.     vid = tonumber(param)
  736.         if not param:match('%d+') then
  737.             state = false
  738.             return sampAddChatMessage('Используй: /stpc2 [vehId]', -1)
  739.         end
  740.         if state then
  741.             lua_thread.create(sit_checkpoint)
  742.             state = false
  743.         end
  744.     end)
  745.         sampRegisterChatCommand("stpd", cmd_fhp)
  746.         sampRegisterChatCommand("stpb", cmd_fbp)
  747.     sampRegisterChatCommand("stph", function()
  748.       main_window_state.v = not main_window_state.v
  749.     end)
  750.     lua_thread.create(function ()
  751.         while true do
  752.           wait(0)
  753.             if delchars.v and isKeyDown(0x45) then dekchars() end
  754.   if delcars.v and isKeyDown(0x52) then dekcars() end
  755.           if col.v then kol() end
  756.           imgui.Process = main_window_state.v
  757.         end
  758.     end)
  759.     sampRegisterChatCommand('stp', function()
  760.         if sasakrack == nil or sasakrack == false then
  761.             return end
  762.     lua_thread.create(function()
  763.         if tp then return end
  764.             blip, blipX, blipY, blipZ = getTargetBlipCoordinatesFixed()
  765.             if blip then
  766.              sync = true
  767.              tpTime = os.clock()
  768.               charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
  769.               local distan = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
  770.               if distan < 7 then return setCharCoordinates(playerPed, blipX, blipY, blipZ) end
  771.             tp = true
  772.             freezeCharPosition(playerPed, true)
  773.            setCharCoordinates(playerPed, blipX, blipY, blipZ -0.6)
  774.             end
  775.         end)
  776.     end)
  777.    sampRegisterChatCommand('stpc', function()
  778.         if sasakrack == nil or sasakrack == false then
  779.             return end
  780.        lua_thread.create(function()
  781.            if tp then return end
  782.                blip, blipX, blipY, blipZ = SearchMarker(getCharCoordinates(PLAYER_PED))
  783.                 if blip then
  784.                 tpTime = os.clock()
  785.                  charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
  786.                   local distan = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
  787.                   if distan < 7 then return setCharCoordinates(playerPed, blipX, blipY, blipZ) end
  788.                   tp = true
  789.                   freezeCharPosition(playerPed, true)
  790.                   setCharCoordinates(playerPed, blipX, blipY, blipZ -0.6)
  791.               end
  792.           end)
  793.      end)
  794.         while true do wait(0)
  795.            if os.clock() - timer > 2400 and sync then
  796.            timer, tpCount = 0, 0
  797.           sync = true
  798.           sampForceOnfootSync()
  799.         sync = false
  800.         end
  801.         if sasakrack == nil or sasakrack == false then
  802.             return end
  803.           if tp then
  804.         if getDistanceBetweenCoords3d(blipX, blipY, blipZ, charPosX, charPosY, charPosZ) > 7 then
  805.         local distanc = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
  806.         wait(2)
  807.          vectorX = blipX - charPosX
  808.          vectorY = blipY - charPosY
  809.          vectorZ = blipZ - charPosZ
  810.         local vec = vector(vectorX, vectorY, vectorZ)
  811.         vec:normalize()
  812.        charPosX = charPosX + vec.x * 7
  813.        charPosY = charPosY + vec.y * 7
  814.        charPosZ = charPosZ + vec.z * 2
  815.  
  816.        wait(6)
  817.     sendOnfootSync(charPosX, charPosY, charPosZ)
  818.     --printStringNow('~Y~dist~W~:'..math.floor(distanc), 200)
  819.     tpCount = tpCount + 1
  820.             if tpCount == 5 then
  821.                 sendOnfootSync(charPosX, charPosY + 55, charPosZ)
  822.              tpCount = 0
  823.         end
  824.     else
  825.                      sync = 0
  826.                      sync = false
  827.                          printStringNow('~y~onfoot ~w~teleported', 4000)
  828.                          --printStringNow(string.format("teleport to [%.1f sec].", os.clock() - tpTime), 4000)
  829.                          msg('{FBFF00} Тпхнуло за: {FFFFFF} '..os.clock() - tpTime, -1)               
  830. sendOnfootSync(charPosX, charPosY, charPosZ)
  831.                   setCharCoordinates(playerPed, blipX, blipY, blipZ)
  832.                   sendOnfootSync(charPosX, charPosY, charPosZ)
  833.                   sampForceAimSync()
  834.                   sampForceOnfootSync()
  835.  
  836.                      wait(900)
  837.                      setCharCoordinates(playerPed, blipX, blipY, blipZ)
  838.                      freezeCharPosition(playerPed, false)
  839.                                       tp = false
  840.                                     thisScript():reload()
  841.   end
  842.  end
  843. end
  844.     wait(-1)
  845. end
  846.  
  847. function car_teleport()
  848.     sync = true
  849.     local veh = storeCarCharIsInNoSave(PLAYER_PED)
  850.     local res, carid = sampGetVehicleIdByCarHandle(veh)
  851.     if not res then
  852.         rTp = false
  853.         sync = false
  854.         return
  855.     end
  856.     local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
  857.     local data = allocateMemory(63)
  858.     sampStorePlayerPassengerData(id, data)
  859.     local seat = getStructElement(data, 2, 1)
  860.     if seat == 0 then
  861.         rTp = false
  862.         sync = false
  863.         sampAddChatMessage('{FF0000}Ошибка. {FFFFFF}Займите пассажирское место', -1)
  864.         return
  865.     end
  866.     local myX, myY, myZ = getCharCoordinates(PLAYER_PED)
  867.     local hand = sampGetCarHandleBySampVehicleId(veh)
  868.     while(myZ > -1) do
  869.         myZ = myZ -1
  870.         if myZ <= -1 then
  871.             freezeCharPosition(playerPed, true)
  872.             sendUnoccupiedSync(carid, seat, myX, myY, -1)
  873.             sendPassengerSync(myX, myY, -1)
  874.             requestCollision(tpx, tpy)
  875.             loadScene(tpx, tpy, tpz)
  876.             zfix = getGroundZFor3dCoord(tpx, tpy, 100)
  877.             tp_sync_pos = split(myX, myY, 2, tpx, tpy, 2, 2)
  878.             myZ = -1
  879.            
  880.             clearCharTasksImmediately(PLAYER_PED)
  881.             setCharCoordinates(playerPed, tpx, tpy, zfix)
  882.            
  883.             for i = 5, #tp_sync_pos do
  884.                 sendUnoccupiedSync(carid, seat, tp_sync_pos[i][1], tp_sync_pos[i][2], z)
  885.                 sendPassengerSync(tp_sync_pos[i][1], tp_sync_pos[i][2], z)
  886.                 wait(10)
  887.                 sendUnoccupiedSync(carid, seat, tp_sync_pos[i][1], tp_sync_pos[i][2], z)
  888.             end
  889.            
  890.               sendUnoccupiedSync(carid, seat, tpx, tpy, zfix +15)
  891.               sendPassengerSync(tpx, tpy, zfix +15)
  892.                         sampForceVehicleSync()
  893.                 sampForceOnfootSync()
  894.               setCharCoordinates(playerPed, tpx, tpy, zfix)
  895.               wait(1000)
  896.              
  897.              sendUnoccupiedSync(carid, seat, tpx, tpy, zfix +15)
  898.              sendPassengerSync(tpx, tpy, zfix +15)
  899.              sendUnoccupiedSync(carid, seat, myX, myY, myZ +15)
  900.              sendPassengerSync(myX, myY, myZ +15)
  901.              sendOnfootSync(tpx, tpy, zfix +15, carid)
  902.              
  903.             sync = false
  904.             freezeCharPosition(playerPed, false)
  905.          break
  906.       else
  907.           sendUnoccupiedSync(carid, seat, myX, myY, myZ)
  908.           sendPassengerSync(myX, myY, myZ)
  909.         end
  910.     end
  911.     wait(1000)
  912.     rTp = false
  913. end
  914.  
  915. function split(x0, y0, z0, x1, y1, z1, step)
  916.     local direction = vector(x1 - x0, y1 - y0, z1 - z0)
  917.     local distance = direction:normalize()
  918.     local path = { }
  919.     local begin = vector(x0, y0 ,z0)
  920.     local cursor = vector(x0, y0, z0)
  921.     path[1] = { cursor:get() }
  922.     repeat
  923.         cursor = cursor + direction * step
  924.         path[#path + 1] = { cursor:get() }
  925.     until(cursor - begin):length() > distance
  926.     return path
  927. end
  928.  
  929. function sit_marker()
  930.     if not isCharInAnyCar(PLAYER_PED) then
  931.         local _, veh = sampGetCarHandleBySampVehicleId(vid)
  932.         if _ then
  933.             local px, py, pz = getCharCoordinates(PLAYER_PED)
  934.             local vx, vy, vz = getCarCoordinates(veh)
  935.             local dist = getDistanceBetweenCoords3d(px, py, pz, vx, vy, vz)
  936.             if dist < 30 then
  937.                 sampSendEnterVehicle(vid, true)
  938.                 wait(1000)
  939.                 taskEnterCarAsPassenger(PLAYER_PED, veh, 100)
  940.                 wait(2000)
  941.                 lua_thread.create(un)
  942.             else
  943.                 sampAddChatMessage('{FF0000}Ошибка. {FFFFFF}Встаньте ближе к машине!', -1)
  944.             end
  945.         else
  946.             sampAddChatMessage('{FF0000}Ошибка. {FFFFFF}Машины нет в зоне стрима!', -1)
  947.         end
  948.     else
  949.         sampAddChatMessage('{FF0000}Ошибка. {FFFFFF}Вы должны быть на ногах!', -1)
  950.     end
  951. end
  952.  
  953. function sit_checkpoint()
  954.     if not isCharInAnyCar(PLAYER_PED) then
  955.         local _, veh = sampGetCarHandleBySampVehicleId(vid)
  956.         if _ then
  957.             local px, py, pz = getCharCoordinates(PLAYER_PED)
  958.             local vx, vy, vz = getCarCoordinates(veh)
  959.             local dist = getDistanceBetweenCoords3d(px, py, pz, vx, vy, vz)
  960.             if dist < 30 then
  961.                 sampSendEnterVehicle(vid, true)
  962.                 wait(1000)
  963.                 taskEnterCarAsPassenger(PLAYER_PED, veh, 100)
  964.                 wait(2500)
  965.                 lua_thread.create(un1)
  966.             else
  967.                 sampAddChatMessage('{FF0000}Ошибка. {FFFFFF}Встаньте ближе к машине!', -1)
  968.             end
  969.         else
  970.             sampAddChatMessage('{FF0000}Ошибка. {FFFFFF}Машины нет в зоне стрима!', -1)
  971.         end
  972.     else
  973.        sampAddChatMessage('{FF0000}Ошибка. {FFFFFF}Вы должны быть на ногах!', -1)
  974.     end
  975. end
  976.  
  977. function un()
  978.     if rTp then
  979.         return
  980.     end
  981.     res, tpx, tpy, tpz = getTargetBlipCoordinates()
  982.     if res then
  983.         if isCharInAnyCar(PLAYER_PED) then
  984.             rTp = true
  985.             lua_thread.create(car_teleport)
  986.         else
  987.             sampAddChatMessage('Для телепорта нужно сесть в машину.', -1)
  988.         end
  989.     else
  990.         sampAddChatMessage('Отсутствует метка на карте.', -1)
  991.     end
  992. end
  993.  
  994. function un1()
  995.     local posX, posY, posZ = getCharCoordinates(PLAYER_PED)
  996.     res, tpx, tpy, tpz = SearchMarker(posX, posY, posZ)
  997.     if res then
  998.         if isCharInAnyCar(PLAYER_PED) then
  999.             rTp = true
  1000.             lua_thread.create(car_teleport)
  1001.         else
  1002.             sampAddChatMessage('Для телепорта нужно сесть в машину.', -1)
  1003.         end
  1004.     else
  1005.         sampAddChatMessage('Отсутствует метка на карте.', -1)
  1006.     end
  1007. end
  1008.  
  1009. function nopHook(name, bool)
  1010.     local samp = require 'samp.events'
  1011.         samp[name] = function()
  1012.             if bool then
  1013.                 return false
  1014.             end
  1015.         end
  1016. end
  1017.  
  1018. function dekchars()
  1019.     for _, handle in ipairs(getAllChars()) do
  1020.             if doesCharExist(handle) then
  1021.                 local _, id = sampGetPlayerIdByCharHandle(handle)
  1022.                     if id ~= myid then
  1023.                                 emul_rpc('onPlayerStreamOut', { id })
  1024. end
  1025. end
  1026. end
  1027. end
  1028.  
  1029. function emul_rpc(hook, parameters)
  1030.     local bs_io = require 'samp.events.bitstream_io'
  1031.     local handler = require 'samp.events.handlers'
  1032.     local extra_types = require 'samp.events.extra_types'
  1033.     local hooks = {
  1034.  
  1035.         --[[ Outgoing rpcs
  1036.         ['onSendEnterVehicle'] = { 'int16', 'bool8', 26 },
  1037.         ['onSendClickPlayer'] = { 'int16', 'int8', 23 },
  1038.         ['onSendClientJoin'] = { 'int32', 'int8', 'string8', 'int32', 'string8', 'string8', 'int32', 25 },
  1039.         ['onSendEnterEditObject'] = { 'int32', 'int16', 'int32', 'vector3d', 27 },
  1040.         ['onSendCommand'] = { 'string32', 50 },
  1041.         ['onSendSpawn'] = { 52 },
  1042.         ['onSendDeathNotification'] = { 'int8', 'int16', 53 },
  1043.         ['onSendDialogResponse'] = { 'int16', 'int8', 'int16', 'string8', 62 },
  1044.         ['onSendClickTextDraw'] = { 'int16', 83 },
  1045.         ['onSendVehicleTuningNotification'] = { 'int32', 'int32', 'int32', 'int32', 96 },
  1046.         ['onSendChat'] = { 'string8', 101 },
  1047.         ['onSendClientCheckResponse'] = { 'int8', 'int32', 'int8', 103 },
  1048.         ['onSendVehicleDamaged'] = { 'int16', 'int32', 'int32', 'int8', 'int8', 106 },
  1049.         ['onSendEditAttachedObject'] = { 'int32', 'int32', 'int32', 'int32', 'vector3d', 'vector3d', 'vector3d', 'int32', 'int32', 116 },
  1050.         ['onSendEditObject'] = { 'bool', 'int16', 'int32', 'vector3d', 'vector3d', 117 },
  1051.         ['onSendInteriorChangeNotification'] = { 'int8', 118 },
  1052.         ['onSendMapMarker'] = { 'vector3d', 119 },
  1053.         ['onSendRequestClass'] = { 'int32', 128 },
  1054.         ['onSendRequestSpawn'] = { 129 },
  1055.         ['onSendPickedUpPickup'] = { 'int32', 131 },
  1056.         ['onSendMenuSelect'] = { 'int8', 132 },
  1057.         ['onSendVehicleDestroyed'] = { 'int16', 136 },
  1058.         ['onSendQuitMenu'] = { 140 },
  1059.         ['onSendExitVehicle'] = { 'int16', 154 },
  1060.         ['onSendUpdateScoresAndPings'] = { 155 },
  1061.         ['onSendGiveDamage'] = { 'int16', 'float', 'int32', 'int32', 115 },
  1062.         ['onSendTakeDamage'] = { 'int16', 'float', 'int32', 'int32', 115 },]]
  1063.  
  1064.         -- Incoming rpcs
  1065.         ['onInitGame'] = { 139 },
  1066.         ['onPlayerJoin'] = { 'int16', 'int32', 'bool8', 'string8', 137 },
  1067.         ['onPlayerQuit'] = { 'int16', 'int8', 138 },
  1068.         ['onRequestClassResponse'] = { 'bool8', 'int8', 'int32', 'int8', 'vector3d', 'float', 'Int32Array3', 'Int32Array3', 128 },
  1069.         ['onRequestSpawnResponse'] = { 'bool8', 129 },
  1070.         ['onSetPlayerName'] = { 'int16', 'string8', 'bool8', 11 },
  1071.         ['onSetPlayerPos'] = { 'vector3d', 12 },
  1072.         ['onSetPlayerPosFindZ'] = { 'vector3d', 13 },
  1073.         ['onSetPlayerHealth'] = { 'float', 14 },
  1074.         ['onTogglePlayerControllable'] = { 'bool8', 15 },
  1075.         ['onPlaySound'] = { 'int32', 'vector3d', 16 },
  1076.         ['onSetWorldBounds'] = { 'float', 'float', 'float', 'float', 17 },
  1077.         ['onGivePlayerMoney'] = { 'int32', 18 },
  1078.         ['onSetPlayerFacingAngle'] = { 'float', 19 },
  1079.         --['onResetPlayerMoney'] = { 20 },
  1080.         --['onResetPlayerWeapons'] = { 21 },
  1081.         ['onGivePlayerWeapon'] = { 'int32', 'int32', 22 },
  1082.         --['onCancelEdit'] = { 28 },
  1083.         ['onSetPlayerTime'] = { 'int8', 'int8', 29 },
  1084.         ['onSetToggleClock'] = { 'bool8', 30 },
  1085.         ['onPlayerStreamIn'] = { 'int16', 'int8', 'int32', 'vector3d', 'float', 'int32', 'int8', 32 },
  1086.         ['onSetShopName'] = { 'string256', 33 },
  1087.         ['onSetPlayerSkillLevel'] = { 'int16', 'int32', 'int16', 34 },
  1088.         ['onSetPlayerDrunk'] = { 'int32', 35 },
  1089.         ['onCreate3DText'] = { 'int16', 'int32', 'vector3d', 'float', 'bool8', 'int16', 'int16', 'encodedString4096', 36 },
  1090.         --['onDisableCheckpoint'] = { 37 },
  1091.         ['onSetRaceCheckpoint'] = { 'int8', 'vector3d', 'vector3d', 'float', 38 },
  1092.         --['onDisableRaceCheckpoint'] = { 39 },
  1093.         --['onGamemodeRestart'] = { 40 },
  1094.         ['onPlayAudioStream'] = { 'string8', 'vector3d', 'float', 'bool8', 41 },
  1095.         --['onStopAudioStream'] = { 42 },
  1096.         ['onRemoveBuilding'] = { 'int32', 'vector3d', 'float', 43 },
  1097.         ['onCreateObject'] = { 44 },
  1098.         ['onSetObjectPosition'] = { 'int16', 'vector3d', 45 },
  1099.         ['onSetObjectRotation'] = { 'int16', 'vector3d', 46 },
  1100.         ['onDestroyObject'] = { 'int16', 47 },
  1101.         ['onPlayerDeathNotification'] = { 'int16', 'int16', 'int8', 55 },
  1102.         ['onSetMapIcon'] = { 'int8', 'vector3d', 'int8', 'int32', 'int8', 56 },
  1103.         ['onRemoveVehicleComponent'] = { 'int16', 'int16', 57 },
  1104.         ['onRemove3DTextLabel'] = { 'int16', 58 },
  1105.         ['onPlayerChatBubble'] = { 'int16', 'int32', 'float', 'int32', 'string8', 59 },
  1106.         ['onUpdateGlobalTimer'] = { 'int32', 60 },
  1107.         ['onShowDialog'] = { 'int16', 'int8', 'string8', 'string8', 'string8', 'encodedString4096', 61 },
  1108.         ['onDestroyPickup'] = { 'int32', 63 },
  1109.         ['onLinkVehicleToInterior'] = { 'int16', 'int8', 65 },
  1110.         ['onSetPlayerArmour'] = { 'float', 66 },
  1111.         ['onSetPlayerArmedWeapon'] = { 'int32', 67 },
  1112.         ['onSetSpawnInfo'] = { 'int8', 'int32', 'int8', 'vector3d', 'float', 'Int32Array3', 'Int32Array3', 68 },
  1113.         ['onSetPlayerTeam'] = { 'int16', 'int8', 69 },
  1114.         ['onPutPlayerInVehicle'] = { 'int16', 'int8', 70 },
  1115.         --['onRemovePlayerFromVehicle'] = { 71 },
  1116.         ['onSetPlayerColor'] = { 'int16', 'int32', 72 },
  1117.         ['onDisplayGameText'] = { 'int32', 'int32', 'string32', 73 },
  1118.         --['onForceClassSelection'] = { 74 },
  1119.         ['onAttachObjectToPlayer'] = { 'int16', 'int16', 'vector3d', 'vector3d', 75 },
  1120.         ['onInitMenu'] = { 76 },
  1121.         ['onShowMenu'] = { 'int8', 77 },
  1122.         ['onHideMenu'] = { 'int8', 78 },
  1123.         ['onCreateExplosion'] = { 'vector3d', 'int32', 'float', 79 },
  1124.         ['onShowPlayerNameTag'] = { 'int16', 'bool8', 80 },
  1125.         ['onAttachCameraToObject'] = { 'int16', 81 },
  1126.         ['onInterpolateCamera'] = { 'bool', 'vector3d', 'vector3d', 'int32', 'int8', 82 },
  1127.         ['onGangZoneStopFlash'] = { 'int16', 85 },
  1128.         ['onApplyPlayerAnimation'] = { 'int16', 'string8', 'string8', 'bool', 'bool', 'bool', 'bool', 'int32', 86 },
  1129.         ['onClearPlayerAnimation'] = { 'int16', 87 },
  1130.         ['onSetPlayerSpecialAction'] = { 'int8', 88 },
  1131.         ['onSetPlayerFightingStyle'] = { 'int16', 'int8', 89 },
  1132.         ['onSetPlayerVelocity'] = { 'vector3d', 90 },
  1133.         ['onSetVehicleVelocity'] = { 'bool8', 'vector3d', 91 },
  1134.         ['onServerMessage'] = { 'int32', 'string32', 93 },
  1135.         ['onSetWorldTime'] = { 'int8', 94 },
  1136.         ['onCreatePickup'] = { 'int32', 'int32', 'int32', 'vector3d', 95 },
  1137.         ['onMoveObject'] = { 'int16', 'vector3d', 'vector3d', 'float', 'vector3d', 99 },
  1138.         ['onEnableStuntBonus'] = { 'bool', 104 },
  1139.         ['onTextDrawSetString'] = { 'int16', 'string16', 105 },
  1140.         ['onSetCheckpoint'] = { 'vector3d', 'float', 107 },
  1141.         ['onCreateGangZone'] = { 'int16', 'vector2d', 'vector2d', 'int32', 108 },
  1142.         ['onPlayCrimeReport'] = { 'int16', 'int32', 'int32', 'int32', 'int32', 'vector3d', 112 },
  1143.         ['onGangZoneDestroy'] = { 'int16', 120 },
  1144.         ['onGangZoneFlash'] = { 'int16', 'int32', 121 },
  1145.         ['onStopObject'] = { 'int16', 122 },
  1146.         ['onSetVehicleNumberPlate'] = { 'int16', 'string8', 123 },
  1147.         ['onTogglePlayerSpectating'] = { 'bool32', 124 },
  1148.         ['onSpectatePlayer'] = { 'int16', 'int8', 126 },
  1149.         ['onSpectateVehicle'] = { 'int16', 'int8', 127 },
  1150.         ['onShowTextDraw'] = { 134 },
  1151.         ['onSetPlayerWantedLevel'] = { 'int8', 133 },
  1152.         ['onTextDrawHide'] = { 'int16', 135 },
  1153.         ['onRemoveMapIcon'] = { 'int8', 144 },
  1154.         ['onSetWeaponAmmo'] = { 'int8', 'int16', 145 },
  1155.         ['onSetGravity'] = { 'float', 146 },
  1156.         ['onSetVehicleHealth'] = { 'int16', 'float', 147 },
  1157.         ['onAttachTrailerToVehicle'] = { 'int16', 'int16', 148 },
  1158.         ['onDetachTrailerFromVehicle'] = { 'int16', 149 },
  1159.         ['onSetWeather'] = { 'int8', 152 },
  1160.         ['onSetPlayerSkin'] = { 'int32', 'int32', 153 },
  1161.         ['onSetInterior'] = { 'int8', 156 },
  1162.         ['onSetCameraPosition'] = { 'vector3d', 157 },
  1163.         ['onSetCameraLookAt'] = { 'vector3d', 'int8', 158 },
  1164.         ['onSetVehiclePosition'] = { 'int16', 'vector3d', 159 },
  1165.         ['onSetVehicleAngle'] = { 'int16', 'float', 160 },
  1166.         ['onSetVehicleParams'] = { 'int16', 'int16', 'bool8', 161 },
  1167.         --['onSetCameraBehind'] = { 162 },
  1168.         ['onChatMessage'] = { 'int16', 'string8', 101 },
  1169.         ['onConnectionRejected'] = { 'int8', 130 },
  1170.         ['onPlayerStreamOut'] = { 'int16', 163 },
  1171.         ['onVehicleStreamIn'] = { 164 },
  1172.         ['onVehicleStreamOut'] = { 'int16', 165 },
  1173.         ['onPlayerDeath'] = { 'int16', 166 },
  1174.         ['onPlayerEnterVehicle'] = { 'int16', 'int16', 'bool8', 26 },
  1175.         ['onUpdateScoresAndPings'] = { 'PlayerScorePingMap', 155 },
  1176.         ['onSetObjectMaterial'] = { 84 },
  1177.         ['onSetObjectMaterialText'] = { 84 },
  1178.         ['onSetVehicleParamsEx'] = { 'int16', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 24 },
  1179.         ['onSetPlayerAttachedObject'] = { 'int16', 'int32', 'bool', 'int32', 'int32', 'vector3d', 'vector3d', 'vector3d', 'int32', 'int32', 113 }
  1180.  
  1181.     }
  1182.     local handler_hook = {
  1183.         ['onInitGame'] = true,
  1184.         ['onCreateObject'] = true,
  1185.         ['onInitMenu'] = true,
  1186.         ['onShowTextDraw'] = true,
  1187.         ['onVehicleStreamIn'] = true,
  1188.         ['onSetObjectMaterial'] = true,
  1189.         ['onSetObjectMaterialText'] = true
  1190.     }
  1191.     local extra = {
  1192.         ['PlayerScorePingMap'] = true,
  1193.         ['Int32Array3'] = true
  1194.     }
  1195.         local hook_table = hooks[hook]
  1196.     if hook_table then
  1197.         local bs = raknetNewBitStream()
  1198.         if not handler_hook[hook] then
  1199.             local max = #hook_table-1
  1200.             if max > 0 then
  1201.                 for i = 1, max do
  1202.                     local p = hook_table[i]
  1203.                     if extra[p] then extra_types[p]['write'](bs, parameters[i])
  1204.                     else bs_io[p]['write'](bs, parameters[i]) end
  1205.                 end
  1206.             end
  1207.         else
  1208.             if hook == 'onInitGame' then handler.on_init_game_writer(bs, parameters)
  1209.             elseif hook == 'onCreateObject' then handler.on_create_object_writer(bs, parameters)
  1210.             elseif hook == 'onInitMenu' then handler.on_init_menu_writer(bs, parameters)
  1211.             elseif hook == 'onShowTextDraw' then handler.on_show_textdraw_writer(bs, parameters)
  1212.             elseif hook == 'onVehicleStreamIn' then handler.on_vehicle_stream_in_writer(bs, parameters)
  1213.             elseif hook == 'onSetObjectMaterial' then handler.on_set_object_material_writer(bs, parameters, 1)
  1214.             elseif hook == 'onSetObjectMaterialText' then handler.on_set_object_material_writer(bs, parameters, 2) end
  1215.         end
  1216.         raknetEmulRpcReceiveBitStream(hook_table[#hook_table], bs)
  1217.         raknetDeleteBitStream(bs)
  1218.     end
  1219. end
  1220.  
  1221. function dekcars()
  1222.     for k, v in pairs(getAllVehicles()) do
  1223.          if doesVehicleExist(v) then
  1224.                 deleteCar(v)
  1225.             end
  1226.         end
  1227. end
  1228.  
  1229. --- Телепортация к дому (пассажирка).
  1230. function cmd_fhp(arg)
  1231.  lua_thread.create(function()
  1232.    sampSendChat("/findihouse ".. arg)
  1233.    wait(250)
  1234.    sampProcessChatInput("/stp")
  1235.  end)
  1236. end
  1237.  
  1238. --- Телепортация к бизнесу (пассажирка).
  1239. function cmd_fbp(arg)
  1240.  lua_thread.create(function()
  1241.     sampSendChat("/findibiz ".. arg)
  1242.     wait(250)
  1243.     sampProcessChatInput("/stpc")
  1244.  end)
  1245. end
  1246.  
  1247. function nopHook(name, bool)
  1248.     local samp = require 'samp.events'
  1249.         samp[name] = function()
  1250.             if bool then
  1251.                 return false
  1252.             end
  1253.         end
  1254. end
  1255.  
  1256. function sendPassengerSync(x, y, z)
  1257.     local _, myId = sampGetPlayerIdByCharHandle(PLAYER_PED)
  1258.     local data = allocateMemory(63)
  1259.     sampStorePlayerPassengerData(myId, data)
  1260.     setStructFloatElement(data, 12, x, false)
  1261.     setStructFloatElement(data, 16, y, false)
  1262.     setStructFloatElement(data, 20, z, false)
  1263.     sampSendPassengerData(data)
  1264.     freeMemory(data)
  1265. end
  1266.  
  1267. function sendUnoccupiedSync(v, s, x, y, z)
  1268.     local data = allocateMemory(67)
  1269.     setStructElement(data, 0, 2, v, false)
  1270.     setStructElement(data, 2, 1, s, false)
  1271.     setStructFloatElement(data, 3, -0.1, false)
  1272.     setStructFloatElement(data, 7, -0.2, false)
  1273.     setStructFloatElement(data, 11, -0.3, false)
  1274.     setStructFloatElement(data, 15, -0.3, false)
  1275.     setStructFloatElement(data, 19, -0.2, false)
  1276.     setStructFloatElement(data, 23, -0.1, false)
  1277.     setStructFloatElement(data, 27, x, false)
  1278.     setStructFloatElement(data, 31, y, false)
  1279.     setStructFloatElement(data, 35, z, false)
  1280.     setStructFloatElement(data, 39, -0.2, false)
  1281.     setStructFloatElement(data, 43, -0.2, false)
  1282.     setStructFloatElement(data, 47, -0.2, false)
  1283.     setStructFloatElement(data, 51, -0.1, false)
  1284.     setStructFloatElement(data, 55, -0.2, false)
  1285.     setStructFloatElement(data, 59, -0.3, false)
  1286.     setStructFloatElement(data, 63, getCarHealth(select(2, sampGetCarHandleBySampVehicleId(v))), false)
  1287.     sampSendUnoccupiedData(data)
  1288.     freeMemory(data)
  1289. end
  1290.  
  1291. function sampev.onSendUnoccupiedSync(d)
  1292.     if sync then
  1293.         return false
  1294.     end
  1295. end
  1296.  
  1297. function sampev.onSetPlayerPos()
  1298.     if sync then
  1299.         return false
  1300.     end
  1301. end
  1302.  
  1303. function sampev.onRemovePlayerFromVehicle()
  1304.     if sync then
  1305.         return false
  1306.     end
  1307. end
  1308.  
  1309. function sampev.onSetVehiclePosition()
  1310.     if sync then
  1311.         return false
  1312.     end
  1313. end
  1314.  
  1315. function doKeyCheck()
  1316.     if not isKeyCheckAvailable() then return end
  1317.     local isInVeh = isCharInAnyCar(playerPed)
  1318.     local veh = nil
  1319.     if isInVeh then veh = storeCarCharIsInNoSave(playerPed) end
  1320.    
  1321.     if isKeyJustPressed(VK_INSERT) then
  1322.         if gmped == false then
  1323.             setCharProofs(playerPed, true, true, true, true, true)
  1324.             writeMemory(0x96916E, 1, 1, false)
  1325.             gmped = true
  1326.             printStringNow("~g~GM enabled for player!", 2000)
  1327.         elseif gmped ~= false then
  1328.             setCharProofs(playerPed, false, false, false, false, false)
  1329.             writeMemory(0x96916E, 1, 0, false)
  1330.             gmped = false
  1331.             printStringNow("~r~GM disabled for player!", 2000)
  1332.         end
  1333.     end
  1334.    
  1335.     if isKeyJustPressed(VK_HOME) and isInVeh then
  1336.         if gmcar == false then
  1337.             setCarProofs(veh, true, true, true, true, true)
  1338.             gmcar = true
  1339.             printStringNow("~g~GM enabled for cars!", 2000)
  1340.         elseif gmcar ~= false then
  1341.             setCarProofs(veh, false, false, false, false, false)
  1342.             gmcar = false
  1343.             printStringNow("~r~GM disabled for cars!", 2000)
  1344.         end
  1345.     end
  1346.    
  1347.     doCheatWork()
  1348. end
  1349.  
  1350.  
  1351. function doCheatWork()
  1352.     local isInVeh = isCharInAnyCar(playerPed)
  1353.     local veh = nil
  1354.     if isInVeh then veh = storeCarCharIsInNoSave(playerPed) end
  1355.        
  1356.     if gmped == true and isCharDead(playerPed) then
  1357.         setCharProofs(playerPed, false, false, false, false, false)
  1358.         writeMemory(0x96916E, 1, 0, false) 
  1359.         gmped = false
  1360.             printStringNow("~r~GM disabled for player!", 2000)
  1361.     end
  1362.    
  1363.     if gmcar == true and isInVeh then
  1364.         setCarProofs(veh, true, true, true, true, true)
  1365.     end
  1366. end
  1367.  
  1368. function isKeyCheckAvailable()
  1369.     if not isSampfuncsLoaded() then
  1370.         return true
  1371.     end
  1372.     return not isSampfuncsConsoleActive() and not sampIsChatInputActive() and not sampIsDialogActive()
  1373. end
  1374.  
  1375. function atax(par)
  1376.       id, id1, id2, id3, id4  = par:match("(.+) (%d+) (%d+) (%d+) (%d+)")
  1377.      if id ~= nil or id1 ~= nil or id2 ~= nil or id3 ~= nil or id4 ~= nil then  
  1378.      
  1379. function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
  1380. lua_thread.create(function()
  1381. if title:find('робота') then
  1382.  
  1383. wait(id)
  1384. sampSetCurrentDialogEditboxText(captchaS0)
  1385. wait(id1)
  1386. sampSetCurrentDialogEditboxText(captchaS1..captchaS2)
  1387. wait(id2)
  1388. sampSetCurrentDialogEditboxText(captchaS0..captchaS1..captchaS2..captchaS3)
  1389. wait(id3)
  1390. sampSetCurrentDialogEditboxText(captchaS0..captchaS1..captchaS2..captchaS3..captchaS4)
  1391. wait(id4)
  1392. sampSendDialogResponse(23045, 1, '', ''..captchaS0..captchaS1..captchaS2..captchaS3..captchaS4..'')
  1393. wait(1)
  1394. sampCloseCurrentDialogWithButton(1)
  1395. end
  1396. end)
  1397. end
  1398. end
  1399. end
Add Comment
Please, Sign In to add comment