Advertisement
Guest User

Untitled

a guest
Dec 10th, 2017
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.50 KB | None | 0 0
  1.  
  2. function thread()
  3. repeat
  4. wait(0)
  5. until sampTextdrawGetString(3):find('04:00:00') and botActivated
  6. nop = false
  7. lua_thread.create(coordmaster)
  8. botActivated = false
  9. end
  10.  
  11. local q = require 'lib.samp.events'
  12. local mem = require "memory"
  13. maxPay = 150000
  14. function main()
  15. repeat wait(0) until isSampAvailable()
  16. lua_thread.create(thread)
  17. pay = 0
  18. sampRegisterChatCommand('stop',
  19. function()
  20. sampAddChatMessage('[Fishing-BOT]: {ffffff}Unfreeze', 0x00ffff)
  21. freezeCharPosition(PLAYER_PED, false)
  22. end)
  23. sampRegisterChatCommand('zape',
  24. function()
  25. sampAddChatMessage('[Fishing-BOT]: {ffffff}Ты отправился за запэхой', 0x00ffff)
  26. nop = false
  27. lua_thread.create(coordmaster)
  28. end)
  29. sampRegisterChatCommand('fbot',
  30. function()
  31. botActivated = not botActivated; pay = 0
  32. sampAddChatMessage('[Fishing-BOT]: {ffffff}'..( botActivated and 'Активирован, переодевайся.' or 'Дективирован.' ), 0x00ffff)
  33. end)
  34. wait(-1)
  35. end
  36.  
  37. function q.onServerMessage(_, str)
  38. if botActivated then
  39. if string.find(str, 'Вы поймали маленькую рыбу.') or string.find(str, 'Вы поймали среднюю рыбу.') or string.find(str, 'Вы поймали большую рыбу.') then
  40. for w in string.gmatch(str, "%d+") do
  41. if w ~= 0 then pay = w end
  42. end
  43. sampAddChatMessage('Продажа на: '..pay, -1)
  44. sampSendChat('/fishing')
  45. if tonumber(pay) > maxPay or string.match(sampTextdrawGetString(3), '(%d+)', 14) == 04 then
  46. nop = false
  47. lua_thread.create(coordmaster)
  48. end
  49. end
  50. if string.find(str, 'Вы переоделись в форму рыбака.') then
  51. pay = 0
  52. for boatId = 429, 430 do
  53. isBoatExist, boatHandle = sampGetCarHandleBySampVehicleId(boatId)
  54. if isBoatExist then
  55. lua_thread.create(carTeleport, boatId, boatHandle)
  56. break
  57. end
  58. end
  59. end
  60. if string.find(str, 'Зона рыбалки помечена на карте.') then lua_thread.create(waitForCheckPoint) end
  61. if string.find(str, 'Вы ничего не поймали.') then sampSendChat('/fishing') end
  62. if string.find(str, 'Рабочий день закончен') then lua_thread.create(getPickUp) end
  63. end
  64. end
  65.  
  66.  
  67. -- Вы поймали среднюю рыбу. Вес: 27 кг. Всего: 27 кг. {F0F0F0}Выручка составит: $81
  68. -- Вы поймали маленькую рыбу. Вес: 11 кг. Всего: 77 кг. {F0F0F0}Выручка составит: $231
  69. -- Вы поймали большую рыбу. Вес: 56 кг. Всего: 190 кг. {F0F0F0}Выручка составит: $570
  70. -- Вы ничего не поймали. Попробуйте еще раз
  71.  
  72. -- Вы переоделись в форму рыбака. Арендуйте катер, чтобы начать работу
  73. -- Зона рыбалки помечена на карте. Чтобы сменить ее, пересядьте за штурвал катера.
  74. -- Рабочий день закончен. Выручка за 240 кг рыбы - $720
  75.  
  76. function getPickUp()
  77. setCharCoordinates(PLAYER_PED, 375, -2087.5, 3.0)
  78. sampForceOnfootSync()
  79. wait(5000)
  80. setCharCoordinates(PLAYER_PED, 370, -2087.5, 3.0)
  81. sampForceOnfootSync()
  82. repeat wait(0) until sampIsDialogActive()
  83. sampCloseCurrentDialogWithButton(1)
  84. end
  85.  
  86. function waitForCheckPoint()
  87. repeat wait(0) until isCheckPointActive()
  88. local x, y, z = getCheckPointCoords()
  89. _, carId = sampGetVehicleIdByCarHandle(storeCarCharIsInNoSave(PLAYER_PED))
  90. sampSendExitVehicle(carId)
  91. warpCharFromCarToCoord(PLAYER_PED, x, y - 5, z)
  92. wait(1000)
  93. setCharCoordinates(PLAYER_PED, x, y - 5, z + 1)
  94. freezeCharPosition(PLAYER_PED, true)
  95. --startFishing = true
  96. wait(1000)
  97. sampSendChat('/fishing')
  98. nop = true
  99. end
  100.  
  101. function coordmaster(x, y, z)
  102. x = 370.0
  103. y = -2087.5
  104. z = 3.5
  105. repeat
  106. local posx, posy, posz = getCharCoordinates(PLAYER_PED)
  107. local dis = getDistanceBetweenCoords2d(x, y, posx, posy)
  108. local x = x - posx; local y = y - posy
  109. local Angle = getHeadingFromVector2d(x, y)
  110. setCharHeading(PLAYER_PED, Angle)
  111. local posx, posy, posz = getOffsetFromCharInWorldCoords(PLAYER_PED, 0.0, 1.0, 0.0)
  112. setCharCoordinatesNoOffset(PLAYER_PED, posx, posy, z)
  113. wait(75)
  114. until dis < 1
  115. repeat wait(0) until sampIsDialogActive()
  116. sampCloseCurrentDialogWithButton(0)
  117. end
  118.  
  119.  
  120. function carTeleport(carId, carHandle)
  121. local x, y, z = getCarCoordinates(carHandle)
  122. local px, py, pz = getCharCoordinates(PLAYER_PED)
  123. setCharCoordinates(PLAYER_PED, x, y, z)
  124. wait(1000)
  125. sampSendEnterVehicle(carId, false)
  126. p = true
  127. for i = 0, 10 do wait(15); sendOnfootSync(true, carId, x, y, z) end
  128. warpCharIntoCar(PLAYER_PED, carHandle)
  129. wait(300)
  130. warpCharIntoCar(PLAYER_PED, carHandle)
  131. p = false
  132. end
  133.  
  134.  
  135. function sendOnfootSync(bool, id, x, y, z)
  136. local _, myId = sampGetPlayerIdByCharHandle(PLAYER_PED)
  137. local data = allocateMemory(68)
  138. sampStorePlayerOnfootData(myId, data)
  139. if bool then
  140. setStructElement(data, 37, 1, 3, false)
  141. else
  142. setStructFloatElement(data, 6, x, false)
  143. setStructFloatElement(data, 10, y, false)
  144. setStructFloatElement(data, 14, z, false)
  145. end
  146. setStructElement(data, 34, 1, getCharHealth(PLAYER_PED), false)
  147. sampSendOnfootData(data)
  148. freeMemory(data)
  149. end
  150.  
  151.  
  152. function isCheckPointActive()
  153. local ptr = sampGetMiscInfoPtr() + 0x24
  154. local value = readMemory(ptr, 4, false)
  155. return value == 1
  156. end
  157.  
  158. function getCheckPointCoords()
  159. sampMiscInfo = sampGetMiscInfoPtr()
  160. local pPos = sampMiscInfo + 0xC
  161. local posX = mem.getfloat(pPos)
  162. local posY = mem.getfloat(pPos + 0x4)
  163. local posZ = mem.getfloat(pPos + 0x8)
  164. return posX, posY, posZ
  165. end
  166.  
  167. function q.onSendPlayerSync(data)
  168. if p then return false end
  169. end
  170.  
  171. function q.onShowDialog(dialogId)
  172. if dialogId == 9126 then sampSendDialogResponse(dialogId, 1, -1, -1) return false end
  173. end
  174.  
  175. function q.onSendPlayerSync()
  176. if nop then return false end
  177. end
  178. -- 9126 - аренда - 1
  179. -- 9393 - взять зп - 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement