local q = require 'lib.samp.events'
function main()
repeat wait(0) until isSampAvailable()
sampRegisterChatCommand('arhbot', function() LearnLanguage = not LearnLanguage end)
while true do wait(0)
if LearnLanguage then
SendKey(64)
wait(7000)
end
end
end
function q.onShowDialog(dialogId, style, title, button1, button2, text)
if LearnLanguage and title:find('Исследование') then return false end
end
function q.onServerMessage(clr, str)
if LearnLanguage then
if str:find('Я нихрена не вижу без фонарика') then
lua_thread.create(function() wait(0)
sampSendChat('/fonar')
SendKey(64)
end)
end
end
end
function SendKey(Key)
local _, myId = sampGetPlayerIdByCharHandle(PLAYER_PED)
local data = allocateMemory(68)
sampStorePlayerOnfootData(myId, data)
setStructElement(data, 36, 1, Key, false)
sampSendOnfootData(data)
freeMemory(data)
end