диалоги.....

Статус
В этой теме нельзя размещать новые ответы.

blessave

Известный
Автор темы
364
106
Версия MoonLoader
.026-beta
1637090944082.png


как выбрать строку с Mountain?
Не по ее порядковому номеру, а именно чтобы искало по тексту?

sampSendDialogResponse(162,1, 1,nil) - по номеру
 
Решение
как выбрать строку с Mountain?
Не по ее порядковому номеру, а именно чтобы искало по тексту?

sampSendDialogResponse(162,1, 1,nil) - по номеру
Lua:
function sampGetListboxItemByText(text, plain)
    if not sampIsDialogActive() then return -1 end
    plain = not (plain == false)
    for i = 0, sampGetListboxItemsCount() - 1 do
        if sampGetListboxItemText(i):find(text, 1, plain) then
            print(i)
            sampSendDialogResponse(162,1, i,nil)
            return i
        end
    end
    return -1
end
local index = sampGetListboxItemByText('Mountain')
local index = sampGetListboxItemByText('%Mountain.-%a+', false)

qdIbp

Автор темы
Проверенный
1,388
1,146
как выбрать строку с Mountain?
Не по ее порядковому номеру, а именно чтобы искало по тексту?

sampSendDialogResponse(162,1, 1,nil) - по номеру
Lua:
function sampGetListboxItemByText(text, plain)
    if not sampIsDialogActive() then return -1 end
    plain = not (plain == false)
    for i = 0, sampGetListboxItemsCount() - 1 do
        if sampGetListboxItemText(i):find(text, 1, plain) then
            print(i)
            sampSendDialogResponse(162,1, i,nil)
            return i
        end
    end
    return -1
end
local index = sampGetListboxItemByText('Mountain')
local index = sampGetListboxItemByText('%Mountain.-%a+', false)
 
  • Нравится
Реакции: blessave
Статус
В этой теме нельзя размещать новые ответы.