script_author('INFERNOFAM')
script_description('autoanswer')
require "lib.moonloader"
require "socket"
sampev = require "lib.samp.events"
tag = "[AutoAns] "
-- Colors:
main_color = 0x2FD6EA
main_color_hex = '{2FD6EA}'
simple_color_hex = '{989797}'
activated_hex = '{16AF0C}'
deactivated_hex = '{BB2222}'
-- Keys:
KEY_LEFT_RIGHT = 0
KEY_FORWARD_BACK = 1
KEY_F = 15
KEY_SPRINT = 16
KEY_ALT = 21
-- Anims:
PICK_PLANT_ANIM = 'BOM_Plant'
CHARS_SEARCH_RADIUS = 60
THINKING_ANSWERS = {
'ща',
'А ТЕПЕРЬ СЛУШАЮ СЮДА, СКОЛЬКО БУДЕТ 100+200? У ТРАКТОРИСТА ХАПХВАХП',
'эээээ',
'хм хм хм',
'хмхмхм',
'ща',
'ща посчитаю',
}
XZ_ANSWERS = {
'хуй знает',
'xz',
'хз',
'хз, давай попроще пример',
'я неуч цуплдуцпьд',
'я неуч ахахахуцхпах',
'я неуч взпазавпзвпзв',
'я неуч ацдуазцупа',
}
ADMIN_ANSWERS = {
'шо такое',
'а что?',
'да?',
'рп путем',
'я тут',
'на месте',
'ага тут',
'что такое',
'DA',
'yes',
'yeah',
'Ага',
'ага.',
'dA',
'агас',
'Ну да',
'Угу',
'да тут я',
'da',
'да',
'Да',
'Нет',
'Ага',
'Да, тут.',
'+',
'+ тут',
'Да тут я',
'все дома!',
'угу тут',
'ага здесь',
'ну вроде да',
'да тут вроде',
'угум',
'присутствую',
'Да-с',
'ну да тут так то',
'не понял',
'Нет не тут',
'я тут',
'до сих пор тут',
'нет блять не тут',
'Вы правы я тут',
'да тут я тут',
'нет, не тут',
'нет блять там',
'угадали бля',
'никуда не уходил',
}
--[[ lua_thread.create(function()
while true do wait(1)
if isKeyJustPressed(VK_X) then
text = 'Администратор Rxnell_McShow[233] для Victoria_Murphy[134]: вы тут?'
pattern = 'Администратор %w+_%w+%[%d+%] для ' .. myNick .. '%[' .. myId
if text:find(pattern) then
if not adminResponded then
deactivate()
playSound(5)
adminResponded = true
wait(2500)
calculatorText = string.gsub(text, pattern, '')
calculatorText = string.gsub(calculatorText, '[^-+/*%d]', '')
print('calculatorText: ' .. (calculatorText or ''))
if #calculatorText > 2 then
print('trying to answer as calculator')
if #calculatorText > 3 then
print('big math, thinking')
sendMessage(THINKING_ANSWERS[math.random(1, #THINKING_ANSWERS)])
wait(2500)
end
local result = calculator(calculatorText)
if result then
sendMessage(result)
else
sendMessage(XZ_ANSWERS[math.random(1, #XZ_ANSWERS)])
end
else
print('trying to answer as eblan')
sendMessage(ADMIN_ANSWERS[math.random(1, #ADMIN_ANSWERS)])
wait(5000)
activate()
end
end
end
end
end
end)]]
function sampev.onServerMessage(color, text)
local text = text or ''
if enabled then
pattern = 'Администратор %w+_%w+%[%d+%] для %w+_%w+%[%d+%]'
if text:find(pattern) then
lua_thread.create(function()
wait(1)
if not adminResponded then
deactivate()
playSound(5)
adminResponded = true
wait(2500)
calculatorText = string.gsub(text, pattern, '')
calculatorText = string.gsub(calculatorText, '[^-+/*%d]', '')
print('calculatorText: ' .. (calculatorText or ''))
if #calculatorText > 2 then
print('trying to answer as calculator')
if #calculatorText > 3 then
print('big math, thinking')
sampSendChat(THINKING_ANSWERS[math.random(1, #THINKING_ANSWERS)])
wait(2500)
end
local result = calculator(calculatorText)
sampSendChat(result or XZ_ANSWERS[math.random(1, #XZ_ANSWERS)])
else
print('trying to answer as eblan')
sampSendChat(ADMIN_ANSWERS[math.random(1, #ADMIN_ANSWERS)])
wait(5000)
activate()
end
end
end)
end
end
end