Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function thread()
- repeat
- wait(0)
- until sampTextdrawGetString(3):find('04:00:00') and botActivated
- nop = false
- lua_thread.create(coordmaster)
- botActivated = false
- end
- local q = require 'lib.samp.events'
- local mem = require "memory"
- maxPay = 150000
- function main()
- repeat wait(0) until isSampAvailable()
- lua_thread.create(thread)
- pay = 0
- sampRegisterChatCommand('stop',
- function()
- sampAddChatMessage('[Fishing-BOT]: {ffffff}Unfreeze', 0x00ffff)
- freezeCharPosition(PLAYER_PED, false)
- end)
- sampRegisterChatCommand('zape',
- function()
- sampAddChatMessage('[Fishing-BOT]: {ffffff}Ты отправился за запэхой', 0x00ffff)
- nop = false
- lua_thread.create(coordmaster)
- end)
- sampRegisterChatCommand('fbot',
- function()
- botActivated = not botActivated; pay = 0
- sampAddChatMessage('[Fishing-BOT]: {ffffff}'..( botActivated and 'Активирован, переодевайся.' or 'Дективирован.' ), 0x00ffff)
- end)
- wait(-1)
- end
- function q.onServerMessage(_, str)
- if botActivated then
- if string.find(str, 'Вы поймали маленькую рыбу.') or string.find(str, 'Вы поймали среднюю рыбу.') or string.find(str, 'Вы поймали большую рыбу.') then
- for w in string.gmatch(str, "%d+") do
- if w ~= 0 then pay = w end
- end
- sampAddChatMessage('Продажа на: '..pay, -1)
- sampSendChat('/fishing')
- if tonumber(pay) > maxPay or string.match(sampTextdrawGetString(3), '(%d+)', 14) == 04 then
- nop = false
- lua_thread.create(coordmaster)
- end
- end
- if string.find(str, 'Вы переоделись в форму рыбака.') then
- pay = 0
- for boatId = 429, 430 do
- isBoatExist, boatHandle = sampGetCarHandleBySampVehicleId(boatId)
- if isBoatExist then
- lua_thread.create(carTeleport, boatId, boatHandle)
- break
- end
- end
- end
- if string.find(str, 'Зона рыбалки помечена на карте.') then lua_thread.create(waitForCheckPoint) end
- if string.find(str, 'Вы ничего не поймали.') then sampSendChat('/fishing') end
- if string.find(str, 'Рабочий день закончен') then lua_thread.create(getPickUp) end
- end
- end
- -- Вы поймали среднюю рыбу. Вес: 27 кг. Всего: 27 кг. {F0F0F0}Выручка составит: $81
- -- Вы поймали маленькую рыбу. Вес: 11 кг. Всего: 77 кг. {F0F0F0}Выручка составит: $231
- -- Вы поймали большую рыбу. Вес: 56 кг. Всего: 190 кг. {F0F0F0}Выручка составит: $570
- -- Вы ничего не поймали. Попробуйте еще раз
- -- Вы переоделись в форму рыбака. Арендуйте катер, чтобы начать работу
- -- Зона рыбалки помечена на карте. Чтобы сменить ее, пересядьте за штурвал катера.
- -- Рабочий день закончен. Выручка за 240 кг рыбы - $720
- function getPickUp()
- setCharCoordinates(PLAYER_PED, 375, -2087.5, 3.0)
- sampForceOnfootSync()
- wait(5000)
- setCharCoordinates(PLAYER_PED, 370, -2087.5, 3.0)
- sampForceOnfootSync()
- repeat wait(0) until sampIsDialogActive()
- sampCloseCurrentDialogWithButton(1)
- end
- function waitForCheckPoint()
- repeat wait(0) until isCheckPointActive()
- local x, y, z = getCheckPointCoords()
- _, carId = sampGetVehicleIdByCarHandle(storeCarCharIsInNoSave(PLAYER_PED))
- sampSendExitVehicle(carId)
- warpCharFromCarToCoord(PLAYER_PED, x, y - 5, z)
- wait(1000)
- setCharCoordinates(PLAYER_PED, x, y - 5, z + 1)
- freezeCharPosition(PLAYER_PED, true)
- --startFishing = true
- wait(1000)
- sampSendChat('/fishing')
- nop = true
- end
- function coordmaster(x, y, z)
- x = 370.0
- y = -2087.5
- z = 3.5
- repeat
- local posx, posy, posz = getCharCoordinates(PLAYER_PED)
- local dis = getDistanceBetweenCoords2d(x, y, posx, posy)
- local x = x - posx; local y = y - posy
- local Angle = getHeadingFromVector2d(x, y)
- setCharHeading(PLAYER_PED, Angle)
- local posx, posy, posz = getOffsetFromCharInWorldCoords(PLAYER_PED, 0.0, 1.0, 0.0)
- setCharCoordinatesNoOffset(PLAYER_PED, posx, posy, z)
- wait(75)
- until dis < 1
- repeat wait(0) until sampIsDialogActive()
- sampCloseCurrentDialogWithButton(0)
- end
- function carTeleport(carId, carHandle)
- local x, y, z = getCarCoordinates(carHandle)
- local px, py, pz = getCharCoordinates(PLAYER_PED)
- setCharCoordinates(PLAYER_PED, x, y, z)
- wait(1000)
- sampSendEnterVehicle(carId, false)
- p = true
- for i = 0, 10 do wait(15); sendOnfootSync(true, carId, x, y, z) end
- warpCharIntoCar(PLAYER_PED, carHandle)
- wait(300)
- warpCharIntoCar(PLAYER_PED, carHandle)
- p = false
- end
- function sendOnfootSync(bool, id, x, y, z)
- local _, myId = sampGetPlayerIdByCharHandle(PLAYER_PED)
- local data = allocateMemory(68)
- sampStorePlayerOnfootData(myId, data)
- if bool then
- setStructElement(data, 37, 1, 3, false)
- else
- setStructFloatElement(data, 6, x, false)
- setStructFloatElement(data, 10, y, false)
- setStructFloatElement(data, 14, z, false)
- end
- setStructElement(data, 34, 1, getCharHealth(PLAYER_PED), false)
- sampSendOnfootData(data)
- freeMemory(data)
- end
- function isCheckPointActive()
- local ptr = sampGetMiscInfoPtr() + 0x24
- local value = readMemory(ptr, 4, false)
- return value == 1
- end
- function getCheckPointCoords()
- sampMiscInfo = sampGetMiscInfoPtr()
- local pPos = sampMiscInfo + 0xC
- local posX = mem.getfloat(pPos)
- local posY = mem.getfloat(pPos + 0x4)
- local posZ = mem.getfloat(pPos + 0x8)
- return posX, posY, posZ
- end
- function q.onSendPlayerSync(data)
- if p then return false end
- end
- function q.onShowDialog(dialogId)
- if dialogId == 9126 then sampSendDialogResponse(dialogId, 1, -1, -1) return false end
- end
- function q.onSendPlayerSync()
- if nop then return false end
- end
- -- 9126 - аренда - 1
- -- 9393 - взять зп - 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement