Достать информация из list диалога

kazantsev

Новичок
Автор темы
12
1
Версия MoonLoader
.026-beta
Есть значит на аризоне вот такое окно:
gta_sa_O9MROrhr7L.jpg

И вот такой код:
Код:
function sampev.onServerMessage(color,text)
-- if text:find("SF") and color == 7582817 or text:find("SF") and color == 16558669 then
  if (text:find("SF") and color == 1941201407)   then
    lua_thread.create(function() wait(200)
     autostate = 2
     namestate.v = "SF"
    end)
  end
  -- if text:find("LS") and color == 7582817 or text:find("LS") and color == 16558669 then
  if (text:find("LS") and color == 1941201407)  then
    lua_thread.create(function() wait(200)
     autostate = 0
     namestate.v = "LS"
    end)
  end
  -- if text:find("LV") and color == 7582817 or text:find("LV") and color == 16558669 then
  if (text:find("LV") and color == 1941201407)  then
    lua_thread.create(function() wait(200)
     autostate = 1
     namestate.v = "LV"
    end)
  end
end

function sampev.onShowDialog(id, style, title, btn1, btn2, text)
    if act_ad.v and id == 25476 then
        sampSendDialogResponse(dialogId, 1, autostate, -1)
    end
end

Только вот не задача, аризонка то багнутая у нас, и данная система не работает как нужно(постоянно меняется местами фиг пойми как эти смишки, и нет, 0 не всегда самая лучшая, сам вчера тестил и там бред был). Нужно чтобы из листа он сам как-то находил нужную смишку и выбрал
 

MLycoris

Режим чтения
Проверенный
1,821
1,860
немного не понял, тебя смущает, что ид диалога меняется? Если да, то лучше проверять через заголовок диалога или на крайняк текст
Lua:
function sampev.onShowDialog(id, style, title, btn1, btn2, text)
    if title:find('Выберите радиостанцию') and autostate ~= -1 then
        sampSendDialogResponse(id,1,autostate,'')
    end
end
 

meowprd

Тот самый Котовский
Проверенный
1,280
712
Lua:
function sampev.onServerMessage(color, text)
  if text:find("Отредактировал сотрудник СМИ %[ (%S+) %]") then
    local studio = text:match("Отредактировал сотрудник СМИ %[ (%S+) %]")
    namestate.v = studio
    if studio == "SF" then autostate = 2
    elseif studio == "LS" then autostate = 0
    elseif studio == "LV" then autostate = 1
    end
  end
end

function sampev.onShowDialog(id, style, title, btn1, btn2, text)
  if act_ad.v then
    if title:find("Выберите радиостанцию") then
      sampSendDialogResponse(id, 1, autostate, "")
    end
  end
end