RAKSAMP проблема

Soldik

Новичок
Автор темы
14
1
Использовал для записи маршрута Route Recording System v1.3 , вроде все работает, но бот все равно не бежит, в lua не особо разбираюсь. Может кто подскажет, что именно в этом говнокоде не так?


Lua:
require("addon")
sampev = require 'samp.events'
password = '123123123'     
referals = 'Sam_Mason' 
referals_active = true

function sampev.onShowDialog(id, style, title, button1, button2, text)
    if title:match('Дополнительная информация') then
        return false
    end
    if id == 1 then
        if text:match('Добро пожаловать') then
            sendDialogResponse(id, 1, -1, password)
            return false
        end
        if text:match('Мужской') then
            sendDialogResponse(id, 1, 0, '')
            return false
        end
        if text:match('Светлый') then
            sendDialogResponse(id, 1, 0, '')
            return false
        end
        if text:match('Вкладка') then
            if referals_active == true then
                sendDialogResponse(id, 1, 1, '')
            else
                sendDialogResponse(id, 1, 0, '')
            end
            return false
        end
        if text:match('Введите ник') then
            sendDialogResponse(id, 1, -1, referals)
            return false
        end
    end
end

function sampev.onShowTextDraw(id, data)
    if data.position.x == 233 then
        sendClickTextdraw(id)
        newTask(teleport, 2000)
    end
end


function teleport()
    local x,y,z = getBotPosition()
    if z < 500 then
        coordStart(1771.2655, -1896.7964, 13.5552, 50, 3, true)
        newTask(moped,2000)
    end
    
end

function moped()
    wait(1000)
    runRoute("moped")
    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   
    
    
function runRoute(act)
    if not isBotConnected() then return end
    packet = loadIni(getPath()..'routes\\'..act..'.rt')
    if packet then
        print('playing route "'..act..'". total length: '..#packet)
        counter = 1
        rep = true
    else
        print('route doesnt exist')
    end
end
 

Вложения

  • AAAAAAAAAAAAAAAA HELP.png
    AAAAAAAAAAAAAAAA HELP.png
    2 KB · Просмотры: 25

Cocolemunto.

Потрачен
126
34
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Во первых одной функции runRoute ясен фиг не будет хватать..
Во вторых, ремейк рут рекордера - полной говно.
Юзай
ML Route Recorder и роут плеер от юлонга.

Полный код роут плеера.
Код:
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
 
  • Нравится
Реакции: Soldik

Soldik

Новичок
Автор темы
14
1
Может глупый вопрос, но все же. Вставил полный код, но не совсем понимаю как теперь активировать маршрут? А также скрипт вообще отказывается запускаться из-за: attempt to call global 'check_update' (a nil value) 😔
 

zxcrashed

Участник
44
21
Может глупый вопрос, но все же. Вставил полный код, но не совсем понимаю как теперь активировать маршрут? А также скрипт вообще отказывается запускаться из-за: attempt to call global 'check_update' (a nil value) 😔
runRoute("!play marshrut")


route:
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

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

newTask(function()
    while true do
        check_update()
        wait(50)
    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
 
  • Нравится
Реакции: Soldik

Soldik

Новичок
Автор темы
14
1
runRoute("!play marshrut")


route:
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

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

newTask(function()
    while true do
        check_update()
        wait(50)
    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
Делал так, все равно ошибки остались


[LUA]\rakbot\scripts\libs\addon.lua:166: \rakbot\scripts\AutoRegistrationBySURVERS.lua:93: attempt to call global 'check_update' (a nil value)
stack traceback:
[C]: in function 'error'
\rakbot\scripts\libs\addon.lua:160: in function 'tick'
\rakbot\scripts\libs\addon.lua:166: in function 'newTask'
\rakbot\scripts\AutoRegistrationBySURVERS.lua:91: in main chunk
[12:02:19] [LUA]\rakbot\scripts\libs\addon.lua:166: \rakbot\scripts\route player.lua:45: attempt to call global 'check_update' (a nil value)
stack traceback:
[C]: in function 'error'
\rakbot\scripts\libs\addon.lua:160: in function 'tick'
\rakbot\scripts\libs\addon.lua:166: in function 'newTask'
\rakbot\scripts\route player.lua:43: in main chunk
 

Cocolemunto.

Потрачен
126
34
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Делал так, все равно ошибки остались


[LUA]\rakbot\scripts\libs\addon.lua:166: \rakbot\scripts\AutoRegistrationBySURVERS.lua:93: attempt to call global 'check_update' (a nil value)
stack traceback:
[C]: in function 'error'
\rakbot\scripts\libs\addon.lua:160: in function 'tick'
\rakbot\scripts\libs\addon.lua:166: in function 'newTask'
\rakbot\scripts\AutoRegistrationBySURVERS.lua:91: in main chunk
[12:02:19] [LUA]\rakbot\scripts\libs\addon.lua:166: \rakbot\scripts\route player.lua:45: attempt to call global 'check_update' (a nil value)
stack traceback:
[C]: in function 'error'
\rakbot\scripts\libs\addon.lua:160: in function 'tick'
\rakbot\scripts\libs\addon.lua:166: in function 'newTask'
\rakbot\scripts\route player.lua:43: in main chunk
так у тебя роут плеер должен быть в одном скрипте.. а у тебя видно что ошибка в автореге и роут плеере
 

Soldik

Новичок
Автор темы
14
1
так у тебя роут плеер должен быть в одном скрипте.. а у тебя видно что ошибка в автореге и роут плеере
засунул роут в 1 скрипт, все равно ошибка
[LUA] \rakbot\scripts\libs\addon.lua:166:\rakbot\scripts\AutoRegistrationBySURVERS.lua:101: attempt to call global 'check_update' (a nil value)
stack traceback:
[C]: in function 'error'
\rakbot\scripts\libs\addon.lua:160: in function 'tick'
\rakbot\scripts\libs\addon.lua:166: in function 'newTask'
\rakbot\scripts\AutoRegistrationBySURVERS.lua:99: in main chunk
 

Cocolemunto.

Потрачен
126
34
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
засунул роут в 1 скрипт, все равно ошибка
[LUA] \rakbot\scripts\libs\addon.lua:166:\rakbot\scripts\AutoRegistrationBySURVERS.lua:101: attempt to call global 'check_update' (a nil value)
stack traceback:
[C]: in function 'error'
\rakbot\scripts\libs\addon.lua:160: in function 'tick'
\rakbot\scripts\libs\addon.lua:166: in function 'newTask'
\rakbot\scripts\AutoRegistrationBySURVERS.lua:99: in main chunk
скинь свой скрипт сюда
 

Soldik

Новичок
Автор темы
14
1
скинь свой скрипт сюда

Код:
require("addon")
sampev = require 'samp.events'
password = '123123123'     
referals = 'Sam_Mason' 
referals_active = true

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

function sampev.onShowDialog(id, style, title, button1, button2, text)
    if title:match('Дополнительная информация') then
        return false
    end
    if id == 1 then
        if text:match('Добро пожаловать') then
            sendDialogResponse(id, 1, -1, password)
            return false
        end
        if text:match('Мужской') then
            sendDialogResponse(id, 1, 0, '')
            return false
        end
        if text:match('Светлый') then
            sendDialogResponse(id, 1, 0, '')
            return false
        end
        if text:match('Вкладка') then
            if referals_active == true then
                sendDialogResponse(id, 1, 1, '')
            else
                sendDialogResponse(id, 1, 0, '')
            end
            return false
        end
        if text:match('Введите ник') then
            sendDialogResponse(id, 1, -1, referals)
            return false
        end
    end
end

function sampev.onShowTextDraw(id, data)
    if data.position.x == 233 then
        sendClickTextdraw(id)
        newTask(teleport, 2000)
    end
end


function teleport()
    local x,y,z = getBotPosition()
    if z < 500 then
        coordStart(1772.1360, -1894.5587, 13.5535, 50, 3, true)
        newTask(moped,2000)
    end

end

function moped()
    runRoute("!play moped")
end


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
 

Notepad++

Известный
279
154
Используй рекордер под новую версию
 
  • Нравится
Реакции: Soldik

Soldik

Новичок
Автор темы
14
1
Используй рекордер под новую версию
Cпасибо, ошибки пропали 😁