Тема: RakSAMP Lite
Показать сообщение отдельно

  #6  
Старый 26.05.2024, 15:16
chromiusj
Флудер
Регистрация: 10.08.2021
Сообщений: 6,010
С нами: 2505538

Репутация: 133


По умолчанию

Цитата:
Сообщение от kultizdat.  

Всем привет.

Код:





Код:
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
             return i
         end
     end
     return -1
end


Выдает ошибку

Код:





Код:
attempt to call global 'sampGetListboxItemsCount' (a nil value)


Помогите, плиз. Есть аналоги на раксамп ?
Lua:





Код:
function
sampGetListboxItemByText
(
text
,
searchText
,
plain
)
plain
=
plain
~=
false
local
i
=
0
for
line
in
text
:
gmatch
(
"[^\r\n]+"
)
do
if
(
plain
and
line
==
searchText
)
or
(
not
plain
and
line
:
find
(
searchText
)
)
then
return
i
end
i
=
i
+
1
end
return
-
1
end


1716722202517.pngchromiusj · 26 Май 2024 в 14:16' data-fancybox="lb-post-1500975" data-lb-caption-extra-html="" data-lb-sidebar-href="" data-single-image="1" data-src="https://www.blast.hk/attachments/241609/" style="cursor: pointer;" title="1716722202517.png">


Lua:





Код:
local
sampev
=
require
(
'samp.events'
)
function
sampev
.
onShowDialog
(
dialogId
,
style
,
title
,
button1
,
button2
,
text
)
if
title
:
find
(
"{.-}Игровое меню"
)
then
local
number
=
sampGetListboxItemByText
(
text
,
"{ff6666}%[6%]{FFFFFF} Донат"
,
false
)
print
(
number
)
end
end
 
Ответить с цитированием