local enabled = false
require "lib.moonloader"
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
sampRegisterChatCommand("gruzlo", function()
enabled = not enabled
local status = enabled and "Включен" or "Выключен"
local color = enabled and 0x40FF40 or 0xFF4040
sampAddChatMessage(string.format("[%s]: Бот %s", thisScript().name, status), -1)
end)
while not isSampAvailable() do wait(100) end
sampAddChatMessage("[r1lawerScripts] GruzchikBot", -1)
while true do
wait(0)
if enabled then
moveToPoints()
end
end
end
function MovePlayer(move_code, isSprint)
setGameKeyState(1, move_code)
if isSprint then setGameKeyState(16, 255) end
end
function BeginToPoint(x, y, z, radius, move_code, isSprint)
repeat
local posX, posY, posZ = getCharCoordinates(PLAYER_PED)
SetAngle(x, y, z)
MovePlayer(move_code, isSprint)
local dist = getDistanceBetweenCoords3d(x, y, z, posX, posY, z)
wait(0)
until not enabled or dist < radius
end
function moveToPoints()
local points = {
{2033.359985, -1965.869995, 14.460000, 1000, -255, false},
{2033.489990, -1958.329956, 14.420000, 680, -255, false},
{2033.569946, -1964.030029, 14.460000, 11, -255, false},
{2041.020020, -1964.880005, 14.460000, 11, -255, false},
{2040.699951, -1975.660034, 13.580000, 11, -255, false},
{2013.569946, -1978.910034, 13.570000, 11, -255, false},
{2011.979980, -1989.640015, 13.570000, 11, -255, false},
{2015.880005, -1973.800049, 13.580000, 11, -255, false}
}
for i, point in ipairs(points) do
BeginToPoint(point[1], point[2], point[3], 1.0, point[5], point[6])
wait(point[4])
if point[1] == 2033.489990 and point[2] == -1958.329956 and point[3] == 14.420000 then
wait(600)
sampSendClickTextdraw(528)
end
end
setGameKeyState(14, 1)
wait(20)
setGameKeyState(14, 0)
end
function SetAngle(x, y, z)
local posX, posY, posZ = getCharCoordinates(PLAYER_PED)
local pX = x - posX
local pY = y - posY
local zAngle = getHeadingFromVector2d(pX, pY)
setCharHeading(PLAYER_PED, zAngle)
restoreCameraJumpcut()
end