Помощь по Боту

MoJlogou_XaKep

Участник
Автор темы
86
5
Версия MoonLoader
.026-beta
Сделал бота, добавить функцию что в случае поломки кирки он шел покупать ее. Но как сделать что он как купил ее так же продолжал работать?
 

MoJlogou_XaKep

Участник
Автор темы
86
5
код скрипта скинь
Щас 5 сек

код скрипта скинь
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)
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
wait(100)
sampCloseCurrentDialogWithButton(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)
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
wait(100)

sampSendDialogResponse(944, 1, 2, Это тоже забыл что там написано)

if isPlayerPlaying(playerHandle) and enabled then
runToPoint(-1879.069946, -1642.060059, 21.770000, 1.000000, -255, false)
enabled = false
end
wait(100)
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
wait(100)
sampCloseCurrentDialogWithButton(1)
--Вот сама функция покупки кирки
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:good:, 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
 
Последнее редактирование:

woodware

Потрачен
Проверенный
4,570
1,267
Щас 5 сек


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)
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
wait(100)
sampCloseCurrentDialogWithButton(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)
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
wait(100)

sampSendDialogResponse(944, 1, 2, Это тоже забыл что там написано)

if isPlayerPlaying(playerHandle) and enabled then
runToPoint(-1879.069946, -1642.060059, 21.770000, 1.000000, -255, false)
enabled = false
end
wait(100)
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
wait(100)
sampCloseCurrentDialogWithButton(1)
--Вот сама функция покупки кирки
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:good:, 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
заключи код в блок [CODE]*твой код*[/CODE]
 

MoJlogou_XaKep

Участник
Автор темы
86
5
Lua:
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)
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
wait(100)
sampCloseCurrentDialogWithButton(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)
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
wait(100)

sampSendDialogResponse(944, 1, 2, Это тоже забыл что там написано)

if isPlayerPlaying(playerHandle) and enabled then
runToPoint(-1879.069946, -1642.060059, 21.770000, 1.000000, -255, false)
enabled = false
end
wait(100)
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
wait(100)
sampCloseCurrentDialogWithButton(1)
--Вот сама функция покупки кирки
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:good:, 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
 

MoJlogou_XaKep

Участник
Автор темы
86
5
Последнее редактирование:

HappyWindinkg

Новичок
19
0
у меня был похожий, я просто создал второй скрипт который покупает кирку

первый бот отправляет сообщение в чат, второй скрипт детектит его и включается, первый отключается, покупает кирку, идёт в шахту, пишет сообщение, второй отключается, а первый включается.
почему же я не добавил это в один скрипт? ну во первых я не помню почему :| а во вторых уровень моего кода пока-что на govno-коде
 

MoJlogou_XaKep

Участник
Автор темы
86
5
у меня был похожий, я просто создал второй скрипт который покупает кирку

первый бот отправляет сообщение в чат, второй скрипт детектит его и включается, первый отключается, покупает кирку, идёт в шахту, пишет сообщение, второй отключается, а первый включается.
почему же я не добавил это в один скрипт? ну во первых я не помню почему :| а во вторых уровень моего кода пока-что на govno-коде
я понял что ты хочешь сказать, Но как сделать что бы бот детектил первого?
 

HappyWindinkg

Новичок
19
0
я понял что ты хочешь сказать, Но как сделать что бы бот детектил первого?
Ну первый искал строку
поиск строки со сломанной киркой:
function sampev.onServerMessage(color, text)
     if string.find(text, 'Ваша кирка сломалась', 1, true) then
   enabled = not enabled  -- это если на bot maker'e сделанно
 end
 end

второй искал точно такое же сообщение и включался
после выполнение своего маршрута он писал сообщение
Lua:
  sampAddChatMessage("Сообщение для бота", 0xFFFFFF)
и выключался

а первый сново влючался и шёл копать.
(можно было сделать и через переменную какую небудь, но тогда я об этом не знал, да и сейчас ничего почти не знаю, всё делал по туториалам TheChampGuess)