Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script_name('AutoLoginForPP')
- script_author('imring')
- script_version('1.2.1')
- boolmsg = true
- -- true - включить сообщения
- -- false - выключить сообщения
- colorTexts = 0xFF8C00
- serversPP = {
- ['176.32.37.62'] = 'Pears Project 1',
- ['176.32.39.34'] = 'Pears Project 2',
- ['176.32.37.63'] = 'Pears Project 3'
- }
- function main()
- while not isSampAvailable() do wait(0) end
- while sampGetCurrentServerAddress() == nil do wait(0) end
- local server = serversPP[sampGetCurrentServerAddress()]
- if server == nil then
- if boolmsg then sampAddChatMessage('Скрипт '..thisScript().name..' не загружён [ '..thisScript().version..' ]. Причина: подключённый сервер НЕ Pears Project.', colorTexts) end
- thisScript():unload()
- else if boolmsg then sampAddChatMessage('Скрипт '..thisScript().name..' загружён [ '..thisScript().version..' ]. Сервер: '..server..'. Команда: [ /autolog ]', colorTexts) end end
- if not doesFileExist("moonloader\\autologPP.txt") then
- local f = io.open('moonloader/autologPP.txt', 'a')
- local nick = 'nick: nil'
- f:write(nick..'\n')
- local pass = 'pass: nil'
- f:write(pass..'\n')
- local pin = 'pin: nil'
- f:write(pin)
- f:close()
- end
- sampRegisterChatCommand('autolog', autoLogin)
- wait(-1)
- end
- function autoLogin(gacode)
- local googlecode = string.match(gacode, '(%d+)')
- local text = ''
- local f = io.open('moonloader/autologPP.txt', 'r')
- for lines in f:lines() do
- local i = string.match(lines, '.+: (.*)')
- text = text..' '..i
- end
- text = text..' '..tostring(googlecode)
- lua_thread.create(loginPlayer, text)
- end
- function loginPlayer(text)
- local _, idme = sampGetPlayerIdByCharHandle(playerPed)
- local nickname, password, pincode, gacode = string.match(text, ' (.*) (.*) (.*) (.*)')
- if not sampTextdrawIsExists(292) and sampTextdrawGetString ~= 'PEARS' then
- if nickname == sampGetPlayerNickname(idme) and string.lower(password) ~= 'nil' then
- if sampTextdrawIsExists(232) then
- sampSendClickTextdraw(232)
- wait(100)
- if not sampIsDialogActive() and sampGetCurrentDialogId() ~= 1 then return end
- sampSendDialogResponse(1, 1, 0, password)
- wait(100)
- sampCloseCurrentDialogWithButton(0)
- end
- if sampTextdrawIsExists(233) then
- sampSendClickTextdraw(233)
- wait(100)
- if sampTextdrawIsExists(269) then
- if string.lower(pincode) ~= 'nil' then
- for i = 1, tonumber(#pincode) do
- local pin = string.sub(pincode, i, i)
- for i = 0, 8 do
- local tdnumb = 2099+i
- if sampTextdrawGetString(tdnumb) == pin then
- sampSendClickTextdraw(tdnumb)
- end
- end
- end
- sampSendClickTextdraw(269)
- else if boolmsg then sampAddChatMessage(thisScript().name..' не выполнин ввод кода. Причина: Код - \'nil\'.', colorTexts) end end
- end
- end
- wait(100)
- if sampIsDialogActive() and sampGetCurrentDialogId() == 798 then
- if gacode ~= 'nil' then
- sampSendDialogResponse(798, 1, 0, gacode)
- wait(100)
- sampCloseCurrentDialogWithButton(0)
- else if boolmsg then sampAddChatMessage(thisScript().name..' не выполнин ввод Google Auth кода. Причина: Вы не введи Google Auth код.', colorTexts) end end
- end
- else if boolmsg then sampAddChatMessage(thisScript().name..' не выполнен. Причина: Pass - \'nil\', или Nick не совпадает, измените в autologPP.txt Ваш ник и пароль.', colorTexts) end end
- else if boolmsg then sampAddChatMessage(thisScript().name..' не выполнен. Причина: Вы авторизированы.', colorTexts) end end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement