lua [Radmir RP CRMP] Бот на поезд или метро

  • Прежде чем установить и использовать чит, проверьте его на вшитость стиллеров/ратников и других троянов. Если вы заметили, что пользователь крадет чужие данные, немедленно отправьте на него жалобу.

lua  [Radmir RP CRMP] Бот на поезд или метро

Тема в разделе Читы, баги создана пользователем Support
Support Автор темы

/mashinist

local ev = require('lib.samp.events')

local state = false
local canMove = false
local dissync = false

local bot = {
state = false;

station = "";
distance = 99999;

speed = {
min = 0,
max = 0
}
}
local speed = {
min = 0,
max = 0
}

local checkpoint = {
position = {
x = 0,
y = 0,
z = 0
},
isFinish = false
}

local key = 0

local function press_gas()
writeMemory(0xB73458 + 0x20, 1, 255, false)
end

local function press_brake()
writeMemory(0xB73458 + 0x1C, 1, 255, false)
end

function onReceivePacket(id, bs)
if id == 215 then
raknetBitStreamIgnoreBits(bs, 8)
if raknetBitStreamReadInt16(bs) == 2 then
local a = raknetBitStreamReadInt32(bs)
local e = {}
for i = 1, raknetBitStreamReadInt8(bs) do
local l = raknetBitStreamReadInt32(bs)
table.insert(e, raknetBitStreamReadString(bs, l))
end
if table.getn(e) > 0 then
local text = e[1]
print(text);
if (string.find(text, "Machinist") and string.find(text, "setStation")) then
local data = decodeJson(string.match(text, 'setStation%(\'(.*)\'%)'));
if (data ~= nil) then
print("Station:", data[1], "Distance:", data[2]);
bot.station, bot.distance = data[1], data[2]
end
end
local minSpeed, maxSpeed = text:match('interface%(\'Machinist\'%)%.setSpeed%(\'%["(%d+)%-(%d+)", %d+%]\'%)')
if minSpeed ~= nil and maxSpeed ~= nil then
bot.speed.min = tonumber(minSpeed)
bot.speed.max = tonumber(maxSpeed)
end
end
end
end
end

function main()
repeat wait(0) until isSampAvailable()

sampRegisterChatCommand('mashinist', function()
bot.state = not bot.state
sampAddChatMessage(bot.state and 'Бот на машиниста был включен' or 'Выключен бот на машиниста', -1)
end)

sampRegisterChatCommand('slp', function()
local x, y, z = getCharCoordinates(PLAYER_PED)
setCharCoordinates(PLAYER_PED,x,y,z+1.5)
end)

local timer = os.clock();
local position = {x = 0, y = 0, z = 0};
local last_distance = 0;

while true do
wait(0)
if bot.state and isCharInAnyTrain(PLAYER_PED) then

local car = storeCarCharIsInNoSave(PLAYER_PED);
local speed = getCarSpeed(storeCarCharIsInNoSave(PLAYER_PED)) * 3.67
local x, y, z = getCharCoordinates(PLAYER_PED);
local distance = math.max(0, getDistanceBetweenCoords3d(x, y, z, checkpoint.position.x, checkpoint.position.y, checkpoint.position.z) - 1);

if checkpoint.isFinish or (bot.distance - distance >= 0 and bot.distance - distance <= 35) then
if (timer < os.clock()) then
last_distance = distance;
timer = os.clock() + 1;
position["x"], position["y"], position["z"] = x, y, z;
end

local stop_distance = distance - ((speed / 35) * last_distance) / 1.2

printStringNow(math.floor(speed) .. "/" .. bot.speed.max .. " ; " .. math.floor(bot.distance) .. "/" .. math.floor(distance) .. "/" .. math.floor(last_distance) .. " ; " .. math.floor(stop_distance), 200);
print(math.floor(speed) .. "/" .. bot.speed.max .. " ; " .. math.floor(bot.distance) .. "/" .. math.floor(distance) .. "/" .. math.floor(last_distance) .. " ; " .. math.floor(stop_distance), 200)

if (stop_distance <= 1 and distance < 300) then
if (distance < 2 and speed < 8) then
setTrainSpeed(car, math.max(0, getCarSpeed(getCarCharIsUsing(PLAYER_PED)) / 1.1 - 1));
print("Полная остановка", math.max(0, getCarSpeed(getCarCharIsUsing(PLAYER_PED)) / 1.1 - 1))
else
print("Останавливаемся!", bot.distance, stop_distance, speed)
setGameKeyState(14, 255);
press_brake();
end
else
if (speed < bot.speed.min + ((bot.speed.max - bot.speed.min) / 2)) then
printStringNow(speed .. "/" .. bot.speed.min + ((bot.speed.max - bot.speed.min) / 2), 100)
setGameKeyState(16, 255);
end
end
elseif (speed < bot.speed.min + ((bot.speed.max - bot.speed.min) / 2)) then
printStringNow(speed .. "/" .. bot.speed.min + ((bot.speed.max - bot.speed.min) / 2))
setGameKeyState(16, 255);
end

local moveDirection = getCarSpeed(getCarCharIsUsing(PLAYER_PED)) > 0 and 1 or (getCarSpeed(getCarCharIsUsing(PLAYER_PED)) < 0 and -1 or 0)
key = moveDirection == 1 and 8 or (moveDirection == -1 and 32 or 0)

end
end
end

function coordPos(x, y, z)
lua_thread.create(function()
local mx, my, mz = getCharCoordinates(PLAYER_PED)
dissync = true
local k = 0
while getDistanceBetweenCoords3d(x, y, z, mx, my, mz) > 1 and isCharOnFoot(PLAYER_PED) do
if mx > x then mx = mx - 1 else mx = mx + 1 end
if my > y then my = my - 1 else my = my + 1 end
if mz > z then mz = mz - 1 else mz = mz + 1 end
sendPacket(mx, my, mz)
k = k + 1
if k > 3 then
k = 0
end
local s = 'teleporting by AkeGGa'
for i = 1, k do
s = s .. '.'
end
printStringNow(s, 110)
wait(100)
end
setCharCoordinates(PLAYER_PED, x, y, z)
dissync = false
end)
end

function sendPacket(x, y, z)
local bs = raknetNewBitStream()
raknetBitStreamWriteInt8(bs, 207)
raknetBitStreamWriteInt16(bs, 0)
raknetBitStreamWriteInt16(bs, 0)
raknetBitStreamWriteInt16(bs, 0)
raknetBitStreamWriteFloat(bs, x)
raknetBitStreamWriteFloat(bs, y)
raknetBitStreamWriteFloat(bs, z)
raknetBitStreamWriteFloat(bs, 0)
raknetBitStreamWriteFloat(bs, 0)
raknetBitStreamWriteFloat(bs, 0)
raknetBitStreamWriteFloat(bs, 0)
raknetBitStreamWriteInt8(bs, getCharHealth(PLAYER_PED))
raknetBitStreamWriteInt8(bs, getCharArmour(PLAYER_PED))
raknetBitStreamWriteInt8(bs, getCurrentCharWeapon(PLAYER_PED))
raknetBitStreamWriteInt8(bs, 0)
raknetBitStreamWriteFloat(bs, 0)
raknetBitStreamWriteFloat(bs, 0)
raknetBitStreamWriteFloat(bs, 0)
raknetBitStreamWriteFloat(bs, 0)
raknetBitStreamWriteFloat(bs, 0)
raknetBitStreamWriteFloat(bs, 0)
raknetBitStreamWriteInt16(bs, 0)
raknetBitStreamWriteInt16(bs, 0)
raknetBitStreamWriteInt16(bs, 0)
raknetSendBitStreamEx(bs, 2, 8, 0)
raknetDeleteBitStream(bs)
end

function getCarSpeedKmh( vehicleTarget )
if not vehicleTarget or type( vehicleTarget ) ~= 'number' then return false end
if not doesVehicleExist( vehicleTarget ) then return false end
local x, y, z = getCarSpeedVector( vehicleTarget )
if not x or not y or not z then x, y, z = 0, 0, 0 end
local kmh = math.floor( (math.sqrt( (x*x) + (y*y) + (z*z) ) * 180) / 100 ) -- KM/H
local mph = math.floor( (math.sqrt( (x*x) + (y*y) + (z*z) ) * 180) / 1.609344 / 100 ) -- MPH
return kmh * 2
end

function ev.onSetRaceCheckpoint(type, pos, nextPos, size)
canMove = true
checkpoint.position = pos
checkpoint.isFinish = type == 1
end

function ev.onSetCheckpoint(pos, radius)
if bot.state and isCharOnFoot(PLAYER_PED) then
coordPos(pos.x, pos.y, pos.z)
end
end

function ev.onDisableRaceCheckpoint()
canMove = false
end

function ev.onSendVehicleSync(data)
data.keysData = key
end

function ev.onSendPlayerSync(data)
if dissync then return false end
end

function Sync(data)
data.keysData = key
end

function ev.onSendPlayerSync(data)
if dissync then return false end
end


Автор; AkeGGa

Сверху