local slot0_a1002 = require("lib.samp.events")
local slot1_a1003 = false
local slot2_a1004 = false
local slot3_a1005 = false
local slot4_a1006 = {
station = "",
distance = 99999,
state = false,
speed = {
max = 0,
min = 0
}
}
local slot5_a1008 = {
max = 0,
min = 0
}
local slot6_a1009 = {
isFinish = false,
position = {
z = 0,
x = 0,
y = 0
}
}
local slot7_a1011 = 0
local slot8_a1012 = false
function onReceivePacket(arg0, arg1)
if arg0 == 215 and slot4_a1006.state then
raknetBitStreamIgnoreBits(arg1, 8)
if raknetBitStreamReadInt16(arg1) == 2 then
local slot2_a1028 = raknetBitStreamReadInt32(arg1)
local slot3_a1053 = {}
for slot7_a1035 = 1, raknetBitStreamReadInt8(arg1) do
local slot8_a1039 = raknetBitStreamReadInt32(arg1)
table.insert(slot3_a1053, raknetBitStreamReadString(arg1, slot8_a1039))
end
if table.getn(slot3_a1053) > 0 then
local slot4_a1078 = slot3_a1053[1]
if string.find(slot4_a1078, "Machinist") and string.find(slot4_a1078, "setStation") then
local slot5_a1075 = decodeJson(string.match(slot4_a1078, "setStation%('(.*)'%)"))
if slot5_a1075 ~= nil then
local slot6_a1073 = slot4_a1006
local slot7_a1074 = slot4_a1006
local slot8_a1076 = slot5_a1075[1]
slot7_a1074.distance = slot5_a1075[2]
slot6_a1073.station = slot8_a1076
end
end
local slot5_a1088, slot6_a1094 = slot4_a1078:match("interface%('Machinist'%)%.setSpeed%('%[\"(%d+)%-(%d+)\", %d+%]'%)")
if slot5_a1088 ~= nil and slot6_a1094 ~= nil then
slot4_a1006.speed.min = tonumber(slot5_a1088)
slot4_a1006.speed.max = tonumber(slot6_a1094)
end
end
end
end
end
function main()
repeat
wait(0)
until isSampAvailable()
sampRegisterChatCommand("mshnst", (function ()
slot4_a1006.state = not slot4_a1006.state
sampAddChatMessage(slot4_a1006.state and "Бот на машиниста был включен" or "Выключен бот на машиниста", -1)
end))
sampRegisterChatCommand("lovler", (function ()
slot8_a1012 = not slot8_a1012
sampAddChatMessage(slot8_a1012 and "Ловлер поезда включен" or "Ловлер поезда выключен", -1)
end))
sampRegisterChatCommand("slp", (function ()
local slot0_a1137, slot1_a1138, slot2_a1139 = getCharCoordinates(PLAYER_PED)
setCharCoordinates(PLAYER_PED, slot0_a1137, slot1_a1138, slot2_a1139 + 1.5)
end))
local slot0_a1206 = os.clock()
local slot1_a1218 = {
z = 0,
x = 0,
y = 0
}
local slot2_a1221 = 0
while true do
wait(0)
if slot4_a1006.state and isCharInAnyTrain(PLAYER_PED) then
local slot3_a1234 = storeCarCharIsInNoSave(PLAYER_PED)
local slot4_a1232 = getCarSpeed(storeCarCharIsInNoSave(PLAYER_PED)) * 3.67
local slot5_a1213, slot6_a1215, slot7_a1217 = getCharCoordinates(PLAYER_PED)
local slot8_a1230 = math.max(0, getDistanceBetweenCoords3d(slot5_a1213, slot6_a1215, slot7_a1217, slot6_a1009.position.x, slot6_a1009.position.y, slot6_a1009.position.z) - 1)
if slot6_a1009.isFinish or slot4_a1006.distance - slot8_a1230 >= 0 and slot4_a1006.distance - slot8_a1230 <= 35 then
if slot0_a1206 < os.clock() then
slot2_a1221 = slot8_a1230
slot0_a1206 = os.clock() + 1
slot1_a1218.z = slot7_a1217
slot1_a1218.y = slot6_a1215
slot1_a1218.x = slot5_a1213
end
if slot8_a1230 - slot4_a1232 / 35 * slot2_a1221 / 1.2 <= 1 and slot8_a1230 < 300 then
if slot8_a1230 < 4 and slot4_a1232 <= 6 then
setTrainSpeed(slot3_a1234, math.max(0, getCarSpeed(getCarCharIsUsing(PLAYER_PED)) / 1.1 - 1))
printStringNow("full break by edgekich", 3)
else
setGameKeyState(14, 255)
printStringNow("stop by edgekich", 3)
end
elseif slot4_a1232 < slot4_a1006.speed.min + (slot4_a1006.speed.max - slot4_a1006.speed.min) / 2 then
setGameKeyState(16, 255)
printStringNow("gas2 by edgekich", 3)
end
elseif slot4_a1232 < slot4_a1006.speed.min + (slot4_a1006.speed.max - slot4_a1006.speed.min) / 2 then
setGameKeyState(16, 255)
printStringNow("gas by edgekich", 3)
elseif slot4_a1232 > slot4_a1006.speed.min + (slot4_a1006.speed.max - slot4_a1006.speed.min) / 2 then
setGameKeyState(14, 255)
printStringNow("break by edgekich", 3)
end
local slot9_a1326 = getCarSpeed(getCarCharIsUsing(PLAYER_PED)) > 0 and 1 or getCarSpeed(getCarCharIsUsing(PLAYER_PED)) < 0 and -1 or 0
slot7_a1011 = slot9_a1326 == 1 and 8 or slot9_a1326 == -1 and 32 or 0
end
end
end
function coordPos(arg0, arg1, arg2)
lua_thread.create((function ()
local slot0_a1366, slot1_a1372, slot2_a1378 = getCharCoordinates(PLAYER_PED)
slot3_a1005 = true
local slot3_a1387 = 0
while getDistanceBetweenCoords3d(arg0, arg1, arg2, slot0_a1366, slot1_a1372, slot2_a1378) > 1 and isCharOnFoot(PLAYER_PED) do
slot0_a1366 = arg0 < slot0_a1366 and slot0_a1366 - 1 or slot0_a1366 + 1
slot1_a1372 = arg1 < slot1_a1372 and slot1_a1372 - 1 or slot1_a1372 + 1
slot2_a1378 = arg2 < slot2_a1378 and slot2_a1378 - 1 or slot2_a1378 + 1
sendPacket(slot0_a1366, slot1_a1372, slot2_a1378)
slot3_a1387 = slot3_a1387 + 1
if slot3_a1387 > 3 then
slot3_a1387 = 0
end
local slot4_a1402 = "teleporting by AkeGGa"
for slot8_a1396 = 1, slot3_a1387 do
slot4_a1402 = slot4_a1402 .. "."
end
printStringNow(slot4_a1402, 110)
slot8_a1012 = false
wait(100)
end
setCharCoordinates(PLAYER_PED, arg0, arg1, arg2)
slot3_a1005 = false
end))
end
function sendPacket(arg0, arg1, arg2)
local slot3_a1421 = raknetNewBitStream()
raknetBitStreamWriteInt8(slot3_a1421, 207)
raknetBitStreamWriteInt16(slot3_a1421, 0)
raknetBitStreamWriteInt16(slot3_a1421, 0)
raknetBitStreamWriteInt16(slot3_a1421, 0)
raknetBitStreamWriteFloat(slot3_a1421, arg0)
raknetBitStreamWriteFloat(slot3_a1421, arg1)
raknetBitStreamWriteFloat(slot3_a1421, arg2)
raknetBitStreamWriteFloat(slot3_a1421, 0)
raknetBitStreamWriteFloat(slot3_a1421, 0)
raknetBitStreamWriteFloat(slot3_a1421, 0)
raknetBitStreamWriteFloat(slot3_a1421, 0)
raknetBitStreamWriteInt8(slot3_a1421, getCharHealth(PLAYER_PED))
raknetBitStreamWriteInt8(slot3_a1421, getCharArmour(PLAYER_PED))
raknetBitStreamWriteInt8(slot3_a1421, getCurrentCharWeapon(PLAYER_PED))
raknetBitStreamWriteInt8(slot3_a1421, 0)
raknetBitStreamWriteFloat(slot3_a1421, 0)
raknetBitStreamWriteFloat(slot3_a1421, 0)
raknetBitStreamWriteFloat(slot3_a1421, 0)
raknetBitStreamWriteFloat(slot3_a1421, 0)
raknetBitStreamWriteFloat(slot3_a1421, 0)
raknetBitStreamWriteFloat(slot3_a1421, 0)
raknetBitStreamWriteInt16(slot3_a1421, 0)
raknetBitStreamWriteInt16(slot3_a1421, 0)
raknetBitStreamWriteInt16(slot3_a1421, 0)
raknetSendBitStreamEx(slot3_a1421, 2, 8, 0)
raknetDeleteBitStream(slot3_a1421)
end
function getCarSpeedKmh(arg0)
if not arg0 or type(arg0) ~= "number" then
return false
end
if not doesVehicleExist(arg0) then
return false
end
local slot1_a1533, slot2_a1535, slot3_a1538 = getCarSpeedVector(arg0)
if not slot1_a1533 or not slot2_a1535 or not slot3_a1538 then
slot3_a1538 = 0
slot2_a1535 = 0
slot1_a1533 = 0
end
local slot4_a1544 = math.floor(math.sqrt(slot1_a1533 * slot1_a1533 + slot2_a1535 * slot2_a1535 + slot3_a1538 * slot3_a1538) * 180 / 100)
local slot5_a1558 = math.floor(math.sqrt(slot1_a1533 * slot1_a1533 + slot2_a1535 * slot2_a1535 + slot3_a1538 * slot3_a1538) * 180 / 1.609344 / 100)
return slot4_a1544 * 2
end
function slot0_a1002.onSetRaceCheckpoint(arg0, arg1, arg2, arg3)
if slot4_a1006.state then
slot2_a1004 = true
slot6_a1009.position = arg1
slot6_a1009.isFinish = arg0 == 1
end
end
function slot0_a1002.onSetCheckpoint(arg0, arg1)
if slot4_a1006.state and isCharOnFoot(PLAYER_PED) and slot8_a1012 then
coordPos(arg0.x, arg0.y, arg0.z)
end
end
function slot0_a1002.onDisableRaceCheckpoint()
if slot4_a1006.state then
slot2_a1004 = false
end
end
function slot0_a1002.onSendVehicleSync(arg0)
if slot4_a1006.state then
arg0.keysData = slot7_a1011
end
end
function slot0_a1002.onSendPlayerSync(arg0)
if slot3_a1005 and slot4_a1006.state then
return false
end
end
function Sync(arg0)
if slot4_a1006.state then
arg0.keysData = slot7_a1011
end
end
function slot0_a1002.onSendPlayerSync(arg0)
if slot3_a1005 and slot4_a1006.state then
return false
end
end