[RakSamp] Как добавить автооткрытия вторых тайников.

kudy

Известный
Автор темы
67
22
Версия SA-MP
  1. Другая
Приветствую, на аризоне добавили возможность иметь и открывать.
2 тайника Илона Маска и 3 тайника ViceCity.
Как добавить чтоб скрипт протыкивал каждый тайник, а не уперался в один.
Код:
AutoChest:
local sampev = require("samp.events")
require("addon")

local textdraw = {
    [1] = {_, 2302, 1000},
    [2] = {_, 2302, 1000},
    [3] = {_, 2302, 1000},
    [4] = {_, 2302, 1000},
    [5] = {_, 2302, 1000},
    [6] = {_, 2302, 1000},
    [7] = {_, 2302, 1000},
}


local time1 = 1
local timer = os.time()

function onRunCommand(cmd)
    if cmd == '!chest' then
        chest()
        return true
    end
end

function chest()
    newTask(function()
        sendClickTextdraw(65535)
        wait(500)
        runCommand("/mm")
        wait(3000)
        runCommand('/invent')
        wait(1000)
        for i = 1, 7 do
            if(tonumber(textdraw[i][1])) then
                sendClickTextdraw(textdraw[i][1])
                wait(textdraw[i][3])
                sendClickTextdraw(textdraw[i][2])
                wait(textdraw[i][3])
            end
            wait(500)
        end
        wait(500)
        sendClickTextdraw(65535)
    end)
end

function sampev.onShowTextDraw(id, data)
    if data.modelId == 19918 then
        textdraw[1][1] = id
    end
    if data.modelId == 1353 then
        textdraw[2][1] = id
    end
    if data.modelId == 1733 then
        textdraw[3][1] = id
    end
    if data.modelId == 19613 then
        textdraw[4][1] = id
    end
    if data.modelId == 1733 then
        textdraw[5][1] = id
    end
    if data.modelId == 2887 then
        textdraw[6][1] = id
    end
    if data.modelId == 1333 then
        textdraw[7][1] = id
    end
end

function sampev.onShowDialog(id, style, title, btn1, btn2, text)
    if id == 722 then
        sendDialogResponse(id, 0, -1, "")
        return false
    end
end

function onUpdate()
        if os.time() - timer >= 1800 then
            timer = os.time()
            chest()
        end
end
С таким кодом он открывает только один, второй игнорит.
 
Последнее редактирование:

kultizdat.

Известный
82
5
Lua:
local sunduk = {}

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

local textdraw = {
    [1] = {_, 2302, 1000},
    [2] = {_, 2302, 1000},
    [3] = {_, 2302, 1000},
    [4] = {_, 2302, 1000},
    [5] = {_, 2302, 1000},
    [6] = {_, 2302, 1000},
    [7] = {_, 2302, 1000},
    [8] = {_, 2302, 1000}
 [9] = {_, 2302, 1000}
}


local time1 = 1
local timer = os.time()

function onRunCommand(cmd)
    if cmd == '!chest' then
        chest()
        return true
    end
end

function chest()
    newTask(function()
        sendClickTextdraw(65535)
        wait(500)
        runCommand("/mm")
        wait(3000)
        runCommand('/invent')
        wait(1000)
        for i = 1, #textdraw do
            if(tonumber(textdraw[i][1])) then
                sendClickTextdraw(textdraw[i][1])
                wait(textdraw[i][3])
                sendClickTextdraw(textdraw[i][2])
                wait(textdraw[i][3])
            end
            wait(500)
        end
        wait(500)
        sendClickTextdraw(65535)
    end)
end

function sampev.onShowTextDraw(id, data)
    if data.modelId == 19918 then
        textdraw[1][1] = id
    end
    if data.modelId == 1353 then
        textdraw[2][1] = id
    end
    if data.modelId == 1733 then
        table.insert(sunduk, id)
    end
if data.modelId == 1733 then

        textdraw[8] = sunduk[1]
       textdraw[9] = sunduk[2]

    end
    if data.modelId == 19613 then
        textdraw[4][1] = id
    end
    if data.modelId == 1733 then
        textdraw[5][1] = id
    end
    if data.modelId == 2887 then
        textdraw[6][1] = id
    end
    if data.modelId == 1333 then
        textdraw[7][1] = id
    end
end

function sampev.onShowDialog(id, style, title, btn1, btn2, text)
    if id == 722 then
        sendDialogResponse(id, 0, -1, "")
        return false
    end
end

function onUpdate()
        if os.time() - timer >= 1800 then
            timer = os.time()
            chest()
        end
end
 
Последнее редактирование:

kudy

Известный
Автор темы
67
22
Lua:
local sunduk = {}

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

local textdraw = {
    [1] = {_, 2302, 1000},
    [2] = {_, 2302, 1000},
    [3] = {_, 2302, 1000},
    [4] = {_, 2302, 1000},
    [5] = {_, 2302, 1000},
    [6] = {_, 2302, 1000},
    [7] = {_, 2302, 1000},
    [8] = {_, 2302, 1000}
 [9] = {_, 2302, 1000}
}


local time1 = 1
local timer = os.time()

function onRunCommand(cmd)
    if cmd == '!chest' then
        chest()
        return true
    end
end

function chest()
    newTask(function()
        sendClickTextdraw(65535)
        wait(500)
        runCommand("/mm")
        wait(3000)
        runCommand('/invent')
        wait(1000)
        for i = 1, #textdraw do
            if(tonumber(textdraw[i][1])) then
                sendClickTextdraw(textdraw[i][1])
                wait(textdraw[i][3])
                sendClickTextdraw(textdraw[i][2])
                wait(textdraw[i][3])
            end
            wait(500)
        end
        wait(500)
        sendClickTextdraw(65535)
    end)
end

function sampev.onShowTextDraw(id, data)
    if data.modelId == 19918 then
        textdraw[1][1] = id
    end
    if data.modelId == 1353 then
        textdraw[2][1] = id
    end
    if data.modelId == 1733 then
        table.insert(sunduk, id)
    end
if data.modelId == 1733 then

        textdraw[8] = sunduk[1]
       textdraw[9] = sunduk[2]

    end
    if data.modelId == 19613 then
        textdraw[4][1] = id
    end
    if data.modelId == 1733 then
        textdraw[5][1] = id
    end
    if data.modelId == 2887 then
        textdraw[6][1] = id
    end
    if data.modelId == 1333 then
        textdraw[7][1] = id
    end
end

function sampev.onShowDialog(id, style, title, btn1, btn2, text)
    if id == 722 then
        sendDialogResponse(id, 0, -1, "")
        return false
    end
end

function onUpdate()
        if os.time() - timer >= 1800 then
            timer = os.time()
            chest()
        end
end
Не работает открывает 3 сундука и встаёт на месте. Ни чего не происходит.