local sampev = require('samp.events')
local key = require 'vkeys'
local state = false
function msg(t) return sampAddChatMessage('{cecece} '..t, -1) end
function main()
repeat wait(1) until isSampAvailable()
sampRegisterChatCommand('tgx', function() -- если введешь команду /tgx , то скрипт включится/выключится
lua_thread.create(function() state = not state
if state then msg('Включен +') end
if not state then msg('Выключен -') end
end)
end)
while true do wait(0)
if wasKeyPressed(key.VK_J) then -- Если нажмешь клавишу J , то скрипт включится/выключится
state = not state
msg(state and 'Включен +' or 'Выключен -')
end
end
end
function sampev.onServerMessage(color, text)
if text:find('пришло сообщение от') and state then -- Если в чате сообщение - пришло сообщение от
lua_thread.create(function()
print('жму alt')
setVirtualKeyDown(18, true) -- зажатие 87 клавиши (ALT)
wait(300) -- задержка на 0,3 сек
setVirtualKeyDown(18, false) -- отпускание 87 клавиши (ALT)
end)
end
end