RakSAMP / помощь / афк при пд

Teror Lorenzo

Новичок
Автор темы
22
1
помощь по раку

написал марщрут, вроде всё норм (писал по этт теме - https://www.blast.hk/threads/53666/ ) , ставлю ботов для качки, почему при пейдее пишет что вы находитесь в афк, и не дает пейдей, в чем прикол? как фиксануть?


1735484558593.png
 

Nichoo

Участник
74
24
помощь по раку

написал марщрут, вроде всё норм (писал по этт теме - https://www.blast.hk/threads/53666/ ) , ставлю ботов для качки, почему при пейдее пишет что вы находитесь в афк, и не дает пейдей, в чем прикол? как фиксануть?


Посмотреть вложение 260535
скрипт скинь которым качаешь ,без него не понять
 

Teror Lorenzo

Новичок
Автор темы
22
1
rjl:
--         + Onfoot sync record/replay system
--        + Incar sync record/replay system.
--         + Moonloader lua script for this shit to record sync in compatible file format (.rt)
--
--
--    Author: Shamanije
--    URL: https://blast.hk/members/163165/
--    Version: 1.2.1

local sampev = require("samp.events")
require("addon")

local rep = false
local loop = false
local packet, veh = {}, {}
local counter = 0

local bitstream = {
    onfoot = bitStream.new(),
    incar = bitStream.new(),
    aim = bitStream.new()
}

function onRunCommand(cmd)
    if cmd:find('!play') or cmd:find('!stop') or cmd:find('!loop') then
        runRoute(cmd)
        return false
    end
end

function sampev.onSendVehicleSync(data)
    if rep then return false end
end

function sampev.onSendPlayerSync(data)
    if rep then return false end
end

function sampev.onVehicleStreamIn(vehid, data)
    veh[vehid] = data.health
end

newTask(function()
    while true do
        check_update()
        wait(50)
    end
end)

function check_update()
    if rep then
        local ok = fillBitStream(getVehicle() ~= 0 and 2 or 1)
        if ok then
            if getVehicle() ~= 0 then bitstream.incar:sendPacket() else bitstream.onfoot:sendPacket() end
            setPosition(packet[counter].x, packet[counter].y, packet[counter].z)
            counter = counter + 1
            if counter%20 == 0 then
                local aok = fillBitStream(3)
                if aok then
                    bitstream.aim:sendPacket()
                else
                    err()
                end
            end
        else
            err()
        end
                    
        bitstream.onfoot:reset()
        bitstream.incar:reset()
        bitstream.aim:reset()
                    
        if counter == #packet then
            if not loop then
                rep = false
                setPosition(packet[counter].x, packet[counter].y, packet[counter].z)
                setQuaternion(packet[counter].qw, packet[counter].qx, packet[counter].qy, packet[counter].qz)
                packet = {}
            end
            counter = 1
        end
    end
end

local print = function(arg) return print('[Route Player]: '..arg) end

function err()
    rep = false
    packet = {}
    counter = 1
    print('an error has occured while writing data')
end

function fillBitStream(mode)
    if mode == 2 then
        local bs = bitstream.incar
        bs:writeUInt8(packet[counter].packetId)
        bs:writeUInt16(getVehicle())
        bs:writeUInt16(packet[counter].lr)
        bs:writeUInt16(packet[counter].ud)
        bs:writeUInt16(packet[counter].keys)
        bs:writeFloat(packet[counter].qw)
        bs:writeFloat(packet[counter].qx)
        bs:writeFloat(packet[counter].qy)
        bs:writeFloat(packet[counter].qz)
        bs:writeFloat(packet[counter].x)
        bs:writeFloat(packet[counter].y)
        bs:writeFloat(packet[counter].z)
        bs:writeFloat(packet[counter].sx)
        bs:writeFloat(packet[counter].sy)
        bs:writeFloat(packet[counter].sz)
        bs:writeFloat(veh[getVehicle()])
        bs:writeUInt8(getHealth())
        bs:writeUInt8(getArmour())
        bs:writeUInt8(0)
        bs:writeUInt8(0)
        bs:writeUInt8(packet[counter].gear)
        bs:writeUInt16(0)
        bs:writeFloat(0)
        bs:writeFloat(0)
        
    elseif mode == 1 then       
        local bs = bitstream.onfoot
        bs:writeUInt8(packet[counter].packetId)
        bs:writeUInt16(packet[counter].lr)
        bs:writeUInt16(packet[counter].ud)
        bs:writeUInt16(packet[counter].keys)
        bs:writeFloat(packet[counter].x)
        bs:writeFloat(packet[counter].y)
        bs:writeFloat(packet[counter].z)
        bs:writeFloat(packet[counter].qw)
        bs:writeFloat(packet[counter].qx)
        bs:writeFloat(packet[counter].qy)
        bs:writeFloat(packet[counter].qz)
        bs:writeUInt8(getHealth())
        bs:writeUInt8(getArmour())
        bs:writeUInt8(0)
        bs:writeUInt8(packet[counter].sa)
        bs:writeFloat(packet[counter].sx)
        bs:writeFloat(packet[counter].sy)
        bs:writeFloat(packet[counter].sz)
        bs:writeFloat(0)
        bs:writeFloat(0)
        bs:writeFloat(0)
        bs:writeUInt16(0)
        bs:writeUInt16(packet[counter].anim)
        bs:writeUInt16(packet[counter].flags)
        
    elseif mode == 3 then
        local bs = bitstream.aim
        bs:writeUInt8(203)
        bs:writeUInt8(packet[counter].mode)
        bs:writeFloat(packet[counter].cx)
        bs:writeFloat(packet[counter].cy)
        bs:writeFloat(packet[counter].cz)
        bs:writeFloat(packet[counter].px)
        bs:writeFloat(packet[counter].py)
        bs:writeFloat(packet[counter].pz)
        bs:writeFloat(packet[counter].az)
        bs:writeUInt8(packet[counter].zoom)
        bs:writeUInt8(packet[counter].wstate)
        bs:writeUInt8(packet[counter].unk)
        
    else return false end
    return true
end

function runRoute(act)
    if act:find('!play .*') then
        packet = loadIni(getPath()..'routes\\'..act:match('!play (.*)')..'.rt')
        if packet then
            print('playing route "'..act:match('!play (.*)')..'". total length: '..#packet)
            counter = 1
            rep = true
            loop = false
        else
            print('route doesnt exist')
        end
    elseif act:find('!loop') then
        if rep then loop = not loop; print(loop and 'looping current route' or 'loop off') else print('not playing any route') end
    elseif act:find('!stop') then
        if counter > 1 then rep = not rep else print('not playing any route') end
        if not rep then setQuaternion(packet[counter].qw, packet[counter].qx, packet[counter].qy, packet[counter].qz) end
        print(rep and 'playing resumed' or 'stopped on packet: '.. counter)
    end
end

function loadIni(fileName)
    local file = io.open(fileName, 'r')
    if file then
        local data = {}
        local section
        for line in file:lines() do
            local tempSection = line:match('^%[([^%[%]]+)%]$')
            if tempSection then
                section = tonumber(tempSection) and tonumber(tempSection) or tempSection
                data[section] = data[section] or {}
            end
            local param, value = line:match('^([%w|_]+)%s-=%s-(.+)$')
            if param and value ~= nil then
                if tonumber(value) then
                    value = tonumber(value)
                elseif value == 'true' then
                    value = true
                elseif value == 'false' then
                    value = false
                end
                if tonumber(param) then
                    param = tonumber(param)
                end
                data[section][param] = value
            end
        end
        file:close()
        return data
    end
    return false
end