local on = require('lib.samp.events')
local stdial = 0
local timer = -1
local air = {
[417] = 'Leviathon',
[425] = 'Hunter',
[487] = 'Maverick',
[511] = 'Beagle',
[512] = 'Cropduster',
[548] = 'Cargobob',
[553] = 'Nevada',
[577] = 'AT-400',
[592] = 'Andromada',
[593] = 'Dodo'
}
function on.onShowDialog(dId, style, title, b1, b2, text)
for i, k in pairs(air) do
if string.find(text,k) then
local index = sampUseListboxItemByText(dId,k)
if index == -1 then
sampSendDialogResponse(dId, 0, nil,nil)
stdial = 2
else
stdial = 1
timer = os.time() + 3
end
end
end
end
function sampUseListboxItemByText(id,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
sampSendDialogResponse(id, 1, i,nil)
return i
end
end
return -1
end
function main()
repeat wait(0) until isSampAvailable()
--Дрочим в присядку :D
while true do wait(0)
if timer < os.time() then
if stdial == 1 then
stdial = 0
elseif stdial == 2 then
setVirtualKeyDown(18, true) -- 18 id key (alt)
wait(10)
setVirtualKeyDown(18, false)
stdial = 0
end
end
end
end