- 3
- 1
- Версия MoonLoader
- .026-beta
функция получения цен и информации о товарах корректно проходит только 1 цикл, после переключения на другой раздел почему то вообще в таблицу не записываются айдишники текстдравов когда по сути ev.onShowTextDraw сам по себе цикл и при каждой возможности будет записывать значение в эту таблицу
getprice():
function getPrice()
while not functions.be2 do
wait(200)
end
local table_all = getAllElementsBuyOrSell()
local ret_table_price_purchase = {}
local ret_table_price_sale = {}
for i = 1, #table_all do
wait(50)
sampCloseCurrentDialogWithButton(0)
sampSendClickTextdraw(table_all[i])
function ev.onShowDialog(dialogId, style, title, button1, button2, text)
if button1 == 'Купить' then
local number = getLavochka()
local price = text:match('$%s*(%d+)')
local more = string.match(text, "В наличии:%s*(%d+)")
local name = getFirstFourWords(text)
table.insert(ret_table_price_purchase,{number, 'purchase', price, more, name})
table_purchase = ret_table_price_purchase
-- elseif button1 == 'Продать' then
-- local number = getLavochka()
-- local price = text:match('$%s*(%d+)')
-- table.insert(ret_table_price_sale,{number, 'sale', price})
-- table_sell = ret_table_price_sale
elseif button1 == 'Выбрать' then
sampSendDialogResponse(dialogId, 1, 0, '')
local number = getLavochka()
local price = text:match('$%s*(%d+)')
local more = string.match(text, "В наличии:%s*(%d+)")
local name = string.match(text,"Предмет:%s*(%S+)") or string.match(text,"Эликсир:%s*(%S+)")
table.insert(ret_table_price_purchase,{number, 'purchase', price, more, name})
end
end
end -- 2068 - left
-- 2070 - right
table_all = {}
sampSendClickTextdraw(2084)
sampAddChatMessage('НАЖАТО', -1)
sampAddChatMessage(#table_all, -1)
for i = 1, #table_all do
wait(50)
sampAddChatMessage('test', -1)
sampCloseCurrentDialogWithButton(0)
sampSendClickTextdraw(table_two[i])
function ev.onShowDialog(dialogId, style, title, button1, button2, text)
if button1 == 'Продать' then
local number = getLavochka()
local price = text:match('$%s*(%d+)')
local more = string.match(text, "покупает:%s*(%d+)")
local name = getFirstFourWords(text)
table.insert(ret_table_price_sale,{number, 'sale', price, more, name})
table_sell = ret_table_price_sale
end
end
end
return ret_table_price_purchase, ret_table_price_sale
end
getAllElementsBuyOrSell():
function getAllElementsBuyOrSell()
local table1 = {}
while functions.be1 do
wait(0)
function ev.onShowTextDraw(textdrawId, textdraw)
if textdraw.backgroundColor ~= -16777216 then
table.insert(table1, textdrawId)
end
end
if #table1 ~= 0 then
functions.be1 = false
end
end
return table1
end