- 86
- 5
- Версия MoonLoader
- .026-beta
Вообщем без лишних слов. Скрипт помирает...
Код:
script_name("Bot by Kalgan")
script_authors("Kalgan_Haverts")
script_description("Ўахта бот, использовать на свой риск")
script_version("0.1")
script_dependencies("CLEO")
---------------------------------------------------------------------------
require "lib.moonloader"
---------------------------------------------------------------------------
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
sampRegisterChatCommand("botstart", cmd_bot)
local saveX = {}
local saveY = {}
local saveZ = {}
while true do
wait(0)
if isPlayerPlaying(playerHandle) and enabled then
---------------------------------------------------------------------------
local posX, posY, posZ = GetCoordinates()
local mfind, mposX, mposY, mposZ = SearchMarker(posX, posY, posZ, 146.260864, false)
if mfind then BeginToPoint(mposX, mposY, mposZ, 1.000000, -255, false) end
wait(10000)
BeginToPoint(-1901.540039, 1247.989990, 1216.239990, 1.000000, -255, false)
wait(390)
BeginToPoint(-1931.349976, 1249.260010, 1216.089966, 1.000000, -255, false)
wait(390)
BeginToPoint(-1975.000000, 1249.430054, 1216.619995, 1.000000, -255, false)
wait(390)
local posX, posY, posZ = GetCoordinates()
local mfind, mposX, mposY, mposZ = SearchMarker(posX, posY, posZ, 146.260864, false)
if mfind then BeginToPoint(mposX, mposY, mposZ, 1.000000, -255, false) end
wait(4730)
wait(450)
BeginToPoint(-1973.560059, 1249.170044, 1216.369995, 1.000000, -255, false)
BeginToPoint(-1973.560059, 1249.170044, 1216.369995, 1.000000, -255, false)
wait(450)
BeginToPoint(-1904.640015, 1249.530029, 1216.989990, 1.000000, -255, false)
wait(450)
---------------------------------------------------------------------------
end
end
end
--------------------------- STANDART FUNCTIONS ---------------------------
function runToPoint(tox, toy, sprint)
local x, y, z = getCharCoordinates(PLAYER_PED)
local angle = getHeadingFromVector2d(tox - x, toy - y)
setCameraPositionUnfixed(0, math.rad(angle - 90))
stopRun = false
while getDistanceBetweenCoords2d(x, y, tox, toy) > 0.5 do
setGameKeyState(1, -255)
if sprint then
setGameKeyState(16, 255)
end
wait(0)
x, y, z = getCharCoordinates(PLAYER_PED)
angle = getHeadingFromVector2d(tox - x, toy - y)
setCameraPositionUnfixed(0, math.rad(angle - 90))
if stopRun then
break
end
end
end
function sampev.onServerMessage(color, text)
if text:find('У вас сломалась кирка! Для продолжени¤ работы необходимо купить новую!') then
if isPlayerPlaying(playerHandle) and enabled then
runToPoint(-1913.109985, 1249.430054, 1216.719971, 1.000000, -255, false)
local posX, posY, posZ = GetCoordinates()
local mfind, mposX, mposY, mposZ = SearchMarker(posX, posY, posZ, 16.391304, false)
if mfind then runToPoint(mposX, mposY, mposZ, 1.000000, -255, false) end
enabled = false
end
wait(100)
if MarkerPosX ~= 0.0 or MarkerPosY ~= 0.0 or MarkerPosZ ~= 0.0 then
if getDistanceBetweenCoords3d(MarkerPosX, MarkerPosY, MarkerPosZ, posX, posY, posZ) < radius then
ret_posX = MarkerPosX
ret_posY = MarkerPosY
ret_posZ = MarkerPosZ
isFind = true
radius = getDistanceBetweenCoords3d(MarkerPosX, MarkerPosY, MarkerPosZ, posX, posY, posZ)
end
end
wait(100)
sampSendDialogResponse(9440, 1, 1, Улица )
wait(1000)
if isPlayerPlaying(playerHandle) and enabled then
runToPoint(-1879.069946, -1642.060059, 21.770000, 1.000000, -255, false)
enabled = false
end
wait(100)
if MarkerPosX ~= 0.0 or MarkerPosY ~= 0.0 or MarkerPosZ ~= 0.0 then
if getDistanceBetweenCoords3d(MarkerPosX, MarkerPosY, MarkerPosZ, posX, posY, posZ) < radius then
ret_posX = MarkerPosX
ret_posY = MarkerPosY
ret_posZ = MarkerPosZ
isFind = true
radius = getDistanceBetweenCoords3d(MarkerPosX, MarkerPosY, MarkerPosZ, posX, posY, posZ)
end
end
wait(100)
sampSendDialogResponse(9441, 1, 2, Кирка 2 уровень)
wait(100)
sampCloseCurrentDialogWithButton(1)
end
if isPlayerPlaying(playerHandle) and enabled then
runToPoint(-1879.069946, -1642.060059, 21.770000, 1.000000, -255, false)
enabled = false
end
wait(100)
if MarkerPosX ~= 0.0 or MarkerPosY ~= 0.0 or MarkerPosZ ~= 0.0 then
if getDistanceBetweenCoords3d(MarkerPosX, MarkerPosY, MarkerPosZ, posX, posY, posZ) < radius then
ret_posX = MarkerPosX
ret_posY = MarkerPosY
ret_posZ = MarkerPosZ
isFind = true
radius = getDistanceBetweenCoords3d(MarkerPosX, MarkerPosY, MarkerPosZ, posX, posY, posZ)
end
end
wait(100)
sampSendDialogResponse{9440, 1, 4, 3 этаж (Серебро)}
end
end
end
function MovePlayer(move_code, isSprint)
setGameKeyState(1, move_code)
--[[255 - обычный бег назад
-255 - обычный бег вперед
65535 - идти шагом вперед
-65535 - идти шагом назад]]
if isSprint then setGameKeyState(16, 255) end
end
function SetAngle(x, y, z)
local posX, posY, posZ = GetCoordinates()
local pX = x - posX
local pY = y - posY
local zAngle = getHeadingFromVector2d(pX, pY)
if isCharInAnyCar(playerPed) then
local car = storeCarCharIsInNoSave(playerPed)
setCarHeading(car, zAngle)
else
setCharHeading(playerPed, zAngle)
end
restoreCameraJumpcut()
end
function GetCoordinates()
if isCharInAnyCar(playerPed) then
local car = storeCarCharIsInNoSave(playerPed)
return getCarCoordinates(car)
else
return getCharCoordinates(playerPed)
end
end
function cmd_bot(param)
enabled = not enabled
if enabled then
sampAddChatMessage(string.format("[%s]: јктивирован", thisScript().name), 0x40FF40)
else
sampAddChatMessage(string.format("[%s]: ƒеактивирован", thisScript().name), 0xFF4040)
end
end
-- Teleport from ClickWarp (by FYP)
function teleportPlayer(x, y, z)
if isCharInAnyCar(playerPed) then
setCharCoordinates(playerPed, x, y, z)
end
setCharCoordinatesDontResetAnim(playerPed, x, y, z)
end
function setCharCoordinatesDontResetAnim(char, x, y, z)
if doesCharExist(char) then
local ptr = getCharPointer(char)
setEntityCoordinates(ptr, x, y, z)
end
end
function setEntityCoordinates(entityPtr, x, y, z)
if entityPtr ~= 0 then
local matrixPtr = readMemory(entityPtr + 0x14, 4, false)
if matrixPtr ~= 0 then
local posPtr = matrixPtr + 0x30
writeMemory(posPtr + 0, 4, representFloatAsInt(x), false) --X
writeMemory(posPtr + 4, 4, representFloatAsInt(y), false) --Y
writeMemory(posPtr + 8, 4, representFloatAsInt(z), false) --Z
end
end
end
-- End Teleport code
--------------------------- ADDITIONAL FUNCTIONS ---------------------------
function SearchMarker(posX, posY, posZ, radius, isRace)
local ret_posX = 0.0
local ret_posY = 0.0
local ret_posZ = 0.0
local isFind = false
for id = 0, 31 do
local MarkerStruct = 0
if isRace then MarkerStruct = 0xC7F168 + id * 56
else MarkerStruct = 0xC7DD88 + id * 160 end
local MarkerPosX = representIntAsFloat(readMemory(MarkerStruct + 0, 4, false))
local MarkerPosY = representIntAsFloat(readMemory(MarkerStruct + 4, 4, false))
local MarkerPosZ = representIntAsFloat(readMemory(MarkerStruct + 8, 4, false))
if MarkerPosX ~= 0.0 or MarkerPosY ~= 0.0 or MarkerPosZ ~= 0.0 then
if getDistanceBetweenCoords3d(MarkerPosX, MarkerPosY, MarkerPosZ, posX, posY, posZ) < radius then
ret_posX = MarkerPosX
ret_posY = MarkerPosY
ret_posZ = MarkerPosZ
isFind = true
radius = getDistanceBetweenCoords3d(MarkerPosX, MarkerPosY, MarkerPosZ, posX, posY, posZ)
end
end
end
return isFind, ret_posX, ret_posY, ret_posZ
end