Notepad++
Известный
- 280
- 161
Я не знаю что тебе это даст, (скорее всего ничего)Вообще не вижу смысла от автоинвайта, на некоторых серверах тебя даже заставляют приседать, для проверки, бот ты или нет. Нет, можно конечно запариться, и сделать бота, который будет бегать за замом или лидером и просить инвайт. Но пока до такого никто не до думался)
но держи
Lua:
local handler = require("samp.events.handlers")
local extra = require("samp.events.extra_types")
require("sampfuncs")
require("addon")
local task
local sampev = require("samp.events")
local randoms = math.random
local referal = "Sam_Mason"
local inv = false
local notfind = true
function sampev.onShowDialog(id, style, title, button1, button2, text)
if title:find('Введите ник пригласившего') then
sendDialogResponse(id, 1, 0, referal)
return false
end
if title:find('Авторизация') or title:find('Пароль') then
sendDialogResponse(id, 1, 0, "123333")
return false
end
if title:find('Дополнительная информация') then
sendDialogResponse(id, 0, 0, "")
return false
end
if title:find('Внимание!') then
sendDialogResponse(id, 1, 0, "")
inv = true
return false
end
if title:find('Информация') then
sendDialogResponse(id, 1, 0, "")
inv = true
return false
end
if title:find('Выберите ваш пол') then
sendDialogResponse(id, 1, 1, "")
return false
end
if title:find('Выберите цвет кожи') then
sendDialogResponse(id, 1, 0, "")
return false
end
if text:find("Дата блокировки:") then
setRandomNick()
end
if title:find("Центр гетто") then
sendDialogResponse(id, 1, 0, "")
return false
end
if id == 25686 then
sendDialogResponse(id, 1, 1, "")
end
if title:find("%[4%/4%] Откуда вы о нас узнали") then
sendDialogResponse(id, 1, 1, "")
return false
end
if title:find('Лидеры онлайн') or title:find('Заместители онлайн') then
if text:find('(.+).%{ffffff%} (%w+_%w+)(.+) - %{A87878%}Night Wolves') then
name, idP = text:match('.+%{ffffff%} (%w+_%w+)(.+) %- %{A87878%}Night Wolves')
print(name .. idP)
coordStart(2214.5776367188, -1154.6212158203, 26.2265625, 350, 7.5, true)
elseif text:find('(.+).%{ffffff%} (%w+_%w+)(.+) - %{00FFE2%}Varrios Los Aztecas') then
name, idP = text:match('.+%{ffffff%} (%w+_%w+)(.+) %- %{00FFE2%}Varrios Los Aztecas')
print(name .. idP)
coordStart(2520.9287109375, -2008.3706054688, 13.546875, 350, 7.5, true)
elseif text:find('(.+).%{ffffff%} (%w+_%w+)(.+) %- %{009327%}Grove Street') then
name, idP = text:match('.+%{ffffff%} (%w+_%w+)(.+) %- %{009327%}Grove Street')
print(name .. idP)
coordStart(2492.3432617188, -1677.7044677734, 13.337018013, 350, 7.5, true)
elseif text:find('(.+).%{ffffff%} (%w+_%w+)(.+) - %{6666FF%}The Rifa') then
name, idP = text:match('.+%{ffffff%} (%w+_%w+)(.+) %- %{6666FF%}The Rifa')
--idP = text:match('.+%{ffffff%} %w+_%w+(.+) %- %{6666FF%}The Rifa')
print(name .. idP)
coordStart(2182.8171386719, -1808.8543701172, 13.374352455139, 350, 7.5, true)
elseif text:find('(.+).%{ffffff%} (%w+_%w+)(.+) - %{CC00CC%}East Side Ballas') then
name, idP = text:match('.+%{ffffff%} (%w+_%w+)(.+) %- %{CC00CC%}East Side Ballas')
print(name .. idP)
coordStart(2000.9162597656, -1123.7181396484, 26.555042266846, 350, 7.5, true)
elseif text:find('(.+).%{ffffff%} (%w+_%w+)(.+) - %{D1DB1C%}Los-Santos Vagos') then
name, idP = text:match('.+%{ffffff%} (%w+_%w+)(.+) %- %{D1DB1C%}Los-Santos Vagos')
print(name .. idP)
coordStart(2520.9287109375, -2008.3706054688, 13.546875, 350, 7.5, true)
else
sendInput("/zams")
end
end
end
function sendKey(id)
key = id
updateSync()
end
function onRunCommand(cmd)
if cmd:find("^!key %d+$") then
sendKey(tonumber(cmd:match("%d+")))
return false
end
end
function sampev.onSendPlayerSync(data)
if key then
data.keysData = key
key = nil
end
end
function sampev.onServerMessage(color, text)
if text:find("Вам поступило предложение от игрока") then
sendInput("/offer")
end
end
function sampev.onShowTextDraw(id, data)
newTask(function ()
if data.selectable and data.text == 'selecticon2' and data.position.x == 396.0 and data.position.y == 315.0 then
for i = 1, math.random(1, 10) do newTask(sendClickTextdraw, i * 500, id) end
elseif data.selectable and data.text == 'selecticon3' and data.position.x == 233.0 and data.position.y == 337.0 then
newTask(sendClickTextdraw, 6000, id)
end
end)
end
registerHandler("onDisconnect", function()
clearTasks()
end)
function sampev.onSendSpawn()
newTask(function()
wait(7000)
inv = true
coordStart(2234.1760253906, -1665.6011962891, 15.345299720764, 50, 2, true)
end)
end
function onCoordStop()
newTask(function()
if inv then
wait(2500)
print("кодекс")
sendKey(1024)
sendInput("/leaders")
wait(2500)
print(name .. idP)
inv = false
wait(60000)
while notfind do
print("чекаю игроков")
checkplaer()
wait(25000)
end
end
end)
end
function checkplaer()
for k, v in pairs(getAllPlayers()) do
if v.nick == name then
notfind = false
print("Лидер или зам найден, преследую")
onRunCommand(string.format("!follow %s", idP))
wait(1000)
sendInput(answers[randoms(1, #answers)])
wait(5000)
sendInput(answers[randoms(1, #answers)])
end
end
end
math.randomseed(os.time()*os.clock()*math.random())
math.random(); math.random(); math.random()
local answers = {
"брат прими";
"инвайт";
"йоу братуха кинь инвайт";
"брат";
}
local main = {
min_dist = 16.0, -- минимальное расстояние между ботом и игроком, чтобы бот повторял действия
offset = -1, -- смещение бота по XY
target_Id = -1,
veh_health_pool = {},
temp_task = nil,
packet_hold = false,
player_state = 0,
bubble = false
}
local state = {
ONFOOT = 0,
PASSENGER = 1,
DRIVER = 2
}
local print = function(arg) return print("[Follow by Ulong]: "..arg) end
local function getDistanceFromTwoPoints2D(a, b, a1, b1) return math.sqrt((a1-a)^2+(b1-b)^2) end
local function quat2deg(w, x, y, z)
local pitch = math.deg(math.atan2(2 * (w * x + y * z), 1 - 2 * (x^2 + y^2)))
local yaw = math.deg(math.asin(2 * (w * y - z * x)))
local roll = math.deg(math.atan2(2 * (w * z + x * y), 1 - 2 * (y^2 + z^2)))
return pitch, yaw, roll
end
local function GetTaskStatus(task)
return task ~= nil and task:isAlive() or false
end
local function clonePacketData(packetId, data)
if not GetTaskStatus(main.temp_task) then
if packetId == PACKET_PLAYER_SYNC then
setBotPosition(data.position.x, data.position.y, data.position.z)
setBotQuaternion(data.quaternion[1], data.quaternion[2], data.quaternion[3], data.quaternion[4])
main.packet_hold = true
if main.offset ~= 0 then
local roll, pitch, yaw = quat2deg(data.quaternion[1], data.quaternion[2], data.quaternion[3], data.quaternion[4])
data.position.x = data.position.x + (main.offset * math.sin(math.rad(yaw)))
data.position.y = data.position.y + (main.offset * math.cos(math.rad(yaw)))
end
local bs = bitStream.new()
bs:writeUInt8(packetId)
bs:writeUInt16(data.leftRightKeys ~= nil and data.leftRightKeys or 0)
bs:writeUInt16(data.upDownKeys ~= nil and data.upDownKeys or 0)
bs:writeUInt16(data.keysData)
bs:writeFloat(data.position.x)
bs:writeFloat(data.position.y)
bs:writeFloat(data.position.z)
bs:writeFloat(data.quaternion[1])
bs:writeFloat(data.quaternion[2])
bs:writeFloat(data.quaternion[3])
bs:writeFloat(data.quaternion[4])
bs:writeUInt8(getBotHealth())
bs:writeUInt8(getBotArmor())
bs:writeUInt8(0)
bs:writeUInt8(data.specialAction)
bs:writeFloat(data.moveSpeed.x)
bs:writeFloat(data.moveSpeed.y)
bs:writeFloat(data.moveSpeed.z)
bs:writeFloat((data.surfingOffsets and data.surfingOffsets.x) ~= nil and data.surfingOffsets.x or 0)
bs:writeFloat((data.surfingOffsets and data.surfingOffsets.y) ~= nil and data.surfingOffsets.y or 0)
bs:writeFloat((data.surfingOffsets and data.surfingOffsets.z) ~= nil and data.surfingOffsets.z or 0)
bs:writeUInt16(data.surfingVehicleId ~= nil and data.surfingVehicleId or 0)
bs:writeUInt16(0) --data.animationId
bs:writeUInt16(0) --data.animationFlags
bs:sendPacket()
bs:reset()
end
if packetId == PACKET_AIM_SYNC then
local bs = bitStream.new()
bs:writeUInt8(packetId)
extra.AimSyncData.write(bs, data)
bs:sendPacket()
bs:reset()
end
if packetId == PACKET_VEHICLE_SYNC then
if getBotVehicle() ~= 0 then
setBotPosition(data.position.x, data.position.y, data.position.z)
main.packet_hold = true
if main.offset ~= 0 then
local roll, pitch, yaw = quat2deg(data.quaternion[1], data.quaternion[2], data.quaternion[3], data.quaternion[4])
data.position.x = data.position.x + (main.offset * math.sin(math.rad(yaw)))
data.position.y = data.position.y + (main.offset * math.cos(math.rad(yaw)))
end
local bs = bitStream.new()
bs:writeUInt8(packetId)
bs:writeUInt16(getBotVehicle())
bs:writeUInt16(data.leftRightKeys)
bs:writeUInt16(data.upDownKeys)
bs:writeUInt16(data.keysData)
bs:writeFloat(data.quaternion[1])
bs:writeFloat(data.quaternion[2])
bs:writeFloat(data.quaternion[3])
bs:writeFloat(data.quaternion[4])
bs:writeFloat(data.position.x)
bs:writeFloat(data.position.y)
bs:writeFloat(data.position.z)
bs:writeFloat(data.moveSpeed.x)
bs:writeFloat(data.moveSpeed.y)
bs:writeFloat(data.moveSpeed.z)
bs:writeFloat(main.veh_health_pool[getBotVehicle()] ~= nil and main.veh_health_pool[getBotVehicle()] or 1000.0)
bs:writeUInt8(getBotHealth())
bs:writeUInt8(getBotArmor())
bs:writeUInt8(0)
bs:writeUInt8(0)
bs:writeUInt8(data.siren ~= nil and data.siren or 0)
bs:writeUInt8(data.landingGear ~= nil and data.landingGear or 0)
bs:writeUInt16(0) --data.trailerId
bs:writeFloat(0)
bs:writeFloat(data.trainSpeed ~= nil and data.trainSpeed or 0)
bs:writeUInt16(0)
bs:sendPacket()
bs:reset()
end
end
end
end
function onLoad()
setAutoPick(true)
newTask(function()
while true do
main.packet_hold = false
wait(4500)
end
end)
end
function onRunCommand(cmd)
if cmd:match("^!follow .+") then
local param = cmd:match( "^!follow (.+)")
if param:match( "^%d+") then
main.target_Id = tonumber(param:match( "^(%d+)"))
print(string.format("Following start. Victim ID %d.", main.target_Id))
elseif param:match( "^stop") then
main.target_Id = -1
print("Follow stopped.")
elseif param:match( "^bubble") then
main.bubble = not main.bubble
print(string.format("Bubble repeater %s.", main.bubble and "enabled" or "disabled"))
elseif param:match( "^offset %-?%d+") then
main.offset = tonumber(param:match( "^offset (%-?%d+)"))
print(string.format("New following offset: %d.", main.offset))
elseif param:match( "^dist %-?%d+") then
main.min_dist = tonumber(param:match( "^dist (%-?%d+)"))
print(string.format("New following min dist: %d.", main.min_dist))
end
return false
end
if cmd:match("^!enterveh %d+") then
local vehId = tonumber(cmd:match( "^!enterveh (%d+)"))
main.temp_task = newTask(function()
main.target_Id = -1
main.player_state = state.DRIVER
sendVehicleEnter(vehId, 0)
wait(500)
setBotVehicle(vehId, 0)
print(string.format("Bot enter %d vehId as driver", vehId))
end)
return false
end
if cmd:match("^!exitveh") then
main.temp_task = newTask(function()
main.target_Id = -1
print(string.format("Bot exit %d vehId.", getBotVehicle()))
sendVehicleExit(getBotVehicle())
wait(500)
setBotVehicle(0, 0)
main.player_state = state.ONFOOT
end)
return false
end
end
function onSendPacket(id, bs)
if id == PACKET_VEHICLE_SYNC then
main.player_state = state.DRIVER
elseif id == PACKET_PLAYER_SYNC then
if main.player_state == state.DRIVER and not GetTaskStatus(main.temp_task) then
main.temp_task = newTask(function()
print(string.format("Bot exit %d vehId.", getBotVehicle()))
sendVehicleExit(getBotVehicle())
wait(500)
setBotVehicle(0, 0)
main.player_state = state.ONFOOT
end)
else
main.player_state = state.ONFOOT
end
elseif id == PACKET_PASSENGER_SYNC then
main.player_state = state.PASSENGER
end
if main.packet_hold then return false end
end
function onReceivePacket(id, bs)
if id == PACKET_PLAYER_SYNC then
bs:setReadOffset(8)
local cdata = handler.packet_player_sync_reader(bs)
if cdata[1] == main.target_Id then
local bX, bY, _ = getBotPosition()
if getDistanceFromTwoPoints2D(bX, bY, cdata[2].position.x, cdata[2].position.y) <= main.min_dist then
if main.player_state == state.ONFOOT and getBotVehicle() == 0 then
clonePacketData(id, cdata[2])
elseif main.player_state == state.PASSENGER and not GetTaskStatus(main.temp_task) then
main.temp_task = newTask(function()
print(string.format("Bot exit %d vehId.", getBotVehicle()))
sendVehicleExit(getBotVehicle())
wait(500)
setBotVehicle(0, 0)
main.player_state = state.ONFOOT
end)
end
end
end
end
if id == PACKET_AIM_SYNC then
bs:setReadOffset(8)
local playerId = bs:readUInt16()
if playerId == main.target_Id then
local cdata = extra.AimSyncData.read(bs)
clonePacketData(id, cdata)
end
end
if id == PACKET_VEHICLE_SYNC then
bs:setReadOffset(8)
local cdata = handler.packet_vehicle_sync_reader(bs)
main.veh_health_pool[cdata[2]] = cdata[3].vehicleHealth
if cdata[1] == main.target_Id then
local bX, bY, _ = getBotPosition()
if main.player_state == state.ONFOOT and getBotVehicle() == 0 then
if getDistanceFromTwoPoints2D(bX, bY, cdata[3].position.x, cdata[3].position.y) <= main.min_dist and not GetTaskStatus(main.temp_task) then
main.temp_task = newTask(function()
main.player_state = state.PASSENGER
sendVehicleEnter(cdata[2], 1)
wait(500)
setBotVehicle(cdata[2], 1)
print(string.format("Bot enter %d vehId as passenger", cdata[2]))
wait(2500) -- for don`t trigger inPACKET_PLAYER_SYNC - PASSENGER check
end)
end
elseif main.player_state == state.DRIVER then
if getDistanceFromTwoPoints2D(bX, bY, cdata[3].position.x, cdata[3].position.y) <= main.min_dist*5 then
clonePacketData(id, cdata[3])
end
end
end
end
end
function onReceiveRPC(id, bs)
if id == RPC_SCRSERVERQUIT then
local playerId = bs:readUInt16()
if playerId == main.target_Id then
main.target_Id = -1
print("Follow stopped. Victim left the server")
end
end
if id == RPC_SCRCHATBUBBLE then
local playerId = bs:readUInt16()
if playerId == main.target_Id and main.bubble then
bs:setReadOffset(112)
local textLength = bs:readUInt8()
local text = bs:readString(textLength)
sendInput(text)
end
end
if id == RPC_SCRWORLDVEHICLEADD then
local wVehicleID = bs:readInt16()
bs:setReadOffset(192)
local health = bs:readFloat()
main.veh_health_pool[wVehicleID] = health
end
if id == RPC_ENTERVEHICLE then
local playerId = bs:readUInt16()
if playerId == main.target_Id then
local vehicleId = bs:readUInt16()
local bIsPassenger = bs:readUInt8()
local response, vehiclePos = pcall(function()
return getAllVehicles()[vehicleId].position
end)
if response then
local bX, bY, _ = getBotPosition()
if bIsPassenger == 0 and main.player_state == state.ONFOOT and getDistanceFromTwoPoints2D(bX, bY, vehiclePos.x, vehiclePos.y) <= main.min_dist and not GetTaskStatus(main.temp_task) then
main.temp_task = newTask(function()
main.player_state = state.PASSENGER
sendVehicleEnter(vehicleId, 1)
wait(500)
setBotVehicle(vehicleId, 1)
print(string.format("Bot enter %d vehId as passenger.", vehicleId))
wait(2500) -- for don`t trigger inPACKET_PLAYER_SYNC - PASSENGER check
end)
end
end
end
end
if id == RPC_EXITVEHICLE then
local playerId = bs:readUInt16()
local vehicleId = bs:readUInt16()
if playerId == main.target_Id and main.player_state == state.PASSENGER and not GetTaskStatus(main.temp_task) then
main.temp_task = newTask(function()
print(string.format("Bot exit %d vehId", getBotVehicle()))
sendVehicleExit(getBotVehicle())
wait(500)
setBotVehicle(0, 0)
main.player_state = state.ONFOOT
end)
end
end
if id == RPC_SCRWORLDPLAYERREMOVE then
local playerId = bs:readUInt16()
if playerId == main.target_Id then
if main.player_state == state.ONFOOT then
print("Wait until the player would be in stream.")
elseif main.player_state == state.PASSENGER and not GetTaskStatus(main.temp_task) then
main.temp_task = newTask(function()
sendVehicleExit(getBotVehicle())
wait(500)
setBotVehicle(0, 0)
main.player_state = state.ONFOOT
print("Leaving car... Wait until the player would be in stream.")
end)
end
end
end
end
Последнее редактирование: