Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Author: michalMonster
- Contact: Discord(michalMonster#3295)
- ]]
- if getElementData(localPlayer, 'player:pid') then return end;
- local auth = {}
- local sw, sh = guiGetScreenSize()
- local zoom = 1920/sw
- local editbox = exports['editbox']
- local auth_page = 1
- local auth_rules = 0
- local auth_login, auth_pass
- local rot = 0
- local tick
- local rules = [[
- §1 Pierwsza zasada
- §2 Druga zasada
- §3 Trzecia zasada, która jest dłuższa od pierwszej i drugiej zasady
- ]]
- auth.font = {
- dxCreateFont('assets/fonts/light.ttf', 15, false, 'draft'),
- dxCreateFont('assets/fonts/medium.ttf', 25, false, 'draft'),
- dxCreateFont('assets/fonts/medium.ttf', 15, false, 'draft'),
- dxCreateFont('assets/fonts/light.ttf', 30, false, 'draft'),
- dxCreateFont('assets/fonts/medium.ttf', 30, false, 'draft')
- }
- auth.textures = {
- vinyl = dxCreateTexture('assets/img/vinyl.png', 'argb', false, 'clamp'),
- button = dxCreateTexture('assets/img/button.png', 'argb', false, 'clamp'),
- checkoff = dxCreateTexture('assets/img/checkbox_off.png', 'argb', false, 'clamp'),
- checkon = dxCreateTexture('assets/img/checkbox_on.png', 'argb', false, 'clamp'),
- map = dxCreateTexture('assets/img/map.png', 'argb', false, 'clamp'),
- pin = dxCreateTexture('assets/img/pin.png', 'argb', false, 'clamp'),
- }
- auth.render = function()
- local meta = getSoundMetaTags(auth_music)
- rot = rot + 1
- wpl = anim(tick, 1039, 444, 2000, 'Linear')
- bpl = anim(tick, 444, 920, 2000, 'Linear')
- wpr = anim(tick, 444, 1039, 1500, 'Linear')
- if auth_page == 1 then
- editbox:createEditbox('L_Login', 512, 450, 342, 47, 'Login', auth_login or '')
- editbox:createEditbox('L_Haslo', 512, 560, 342, 47, 'Hasło', auth_pass or '')
- editbox:setEditboxMasked('L_Haslo', true)
- dxDrawRectangle(0, 0, 1920, 1080, tocolor(28, 29, 50, 255), false)
- dxDrawRectangle(444, 140, 476, 800, tocolor(255, 255, 255, 255), false)
- dxDrawRectangle(920, 140, 595, 800, tocolor(34, 35, 66, 255), false)
- dxDrawRectangle(512, 607, 342, 2, tocolor(34, 35, 66, 255), false)
- dxDrawRectangle(512, 497, 342, 2, tocolor(34, 35, 66, 255), false)
- dxDrawImage(512, 680, 340, 57, auth.textures['button'], 0, 0, 0, tocolor(255, 255, 255), false)
- dxDrawImage(10, 964, 106, 106, auth.textures['vinyl'], rot, 0, 0, tocolor(255, 255, 255, 255), false)
- dxDrawImage(512, 617, 30, 30, auth.textures['checkoff'], 0, 0, 0, tocolor(255, 255, 255, 255), false)
- if auth_save and auth_save == 1 then
- dxDrawImage(517, 622, 20, 20, auth.textures['checkon'], 0, 0, 0, tocolor(255, 255, 255, 255), false)
- end
- dxDrawText('ZALOGUJ', 509, 710, 854, 710, tocolor(255, 255, 255, 255), 1, auth.font[2], 'center', 'center', false, false, false, false, false)
- dxDrawText('HASŁO', 512, 530, 855, 573, tocolor(34, 35, 66, 255), 1, auth.font[3], 'left', 'center', false, false, false, false, false)
- dxDrawText('LOGIN', 512, 310, 855, 573, tocolor(34, 35, 66, 255), 1, auth.font[3], 'left', 'center', false, false, false, false, false)
- dxDrawText('Nie posiadasz konta?', 507, 690, 862, 645, tocolor(34, 35, 66, 255), 1, auth.font[1], 'left', 'center', false, false, false, false, false)
- dxDrawText('Zarejestruj się', 715, 690, 862, 645, tocolor(34, 35, 66, 255), 1, auth.font[3], 'left', 'center', false, false, false, false, false)
- dxDrawText('Logo projektu', 445, 115, 920, 209, tocolor(34, 35, 66, 255), 1, auth.font[4], 'left', 'center', false, false, false, false, false)
- dxDrawText('Witaj na NAZWA SERWERA', 854, 469, 1582, 1276, tocolor(255, 255, 255, 255), 1, auth.font[2], 'center', 'top', false, false, false, false, false)
- dxDrawText('Zaloguj się, aby uzyskać dostęp do konta', 1011, 508, 1425, 532, tocolor(255, 255, 255, 255), 1, auth.font[1], 'center', 'center', false, false, false, false, false)
- dxDrawText("Zapamiętaj dane", 544, 617, 887, 647, tocolor(34, 35, 66, 255), 1.00, auth.font[1], "left", "center", false, false, false, false, false)
- dxDrawText(meta.artist.." - "..meta.title, 121, 991, 1910, 1070, tocolor(255, 255, 255, 255), 1.00, auth.font[4], "left", "center", false, false, false, false, false)
- editbox:renderEditbox('L_Login')
- editbox:renderEditbox('L_Haslo')
- end
- if auth_page == 2 then
- editbox:createEditbox('R_Login', 1107, 332, 342, 47, 'Login')
- editbox:createEditbox('R_Haslo', 1107, 442, 342, 47, 'Hasło')
- editbox:createEditbox('R_Email', 1107, 552, 342, 47, 'Email')
- editbox:setEditboxMasked('R_Haslo', true)
- dxDrawRectangle(0, 0, 1920, 1080, tocolor(28, 29, 50, 255), false)
- dxDrawRectangle(wpr, 140, 476, 800, tocolor(255, 255, 255, 255), false)
- dxDrawRectangle(444, 140, 595, 800, tocolor(34, 35, 66, 255), false)
- dxDrawRectangle(1107, 379, 342, 2, tocolor(34, 35, 66, 255), false)
- dxDrawRectangle(1107, 489, 342, 2, tocolor(34, 35, 66, 255), false)
- dxDrawRectangle(1107, 599, 342, 2, tocolor(34, 35, 66, 255), false)
- dxDrawImage(1108, 646, 340, 57, auth.textures['button'], 0, 0, 0, tocolor(255, 255, 255), false)
- dxDrawImage(10, 964, 106, 106, auth.textures['vinyl'], rot, 0, 0, tocolor(255, 255, 255, 255), false)
- dxDrawImage(1107, 608, 30, 30, auth.textures['checkoff'], 0, 0, 0, tocolor(255, 255, 255, 255), false)
- if auth_rules and auth_rules == 1 then
- dxDrawImage(1112, 613, 20, 20, auth.textures['checkon'], 0, 0, 0, tocolor(255, 255, 255, 255), false)
- end
- dxDrawText('Logo projektu', 1040, 115, 920, 209, tocolor(34, 35, 66, 255), 1, auth.font[4], 'left', 'center', false, false, false, false, false)
- dxDrawText('ZAREJESTRUJ', 1107, 650, 1447, 703, tocolor(255, 255, 255, 255), 1, auth.font[2], 'center', 'center', false, false, false, false, false)
- dxDrawText('REGULAMIN', 444, 137, 1037, 202, tocolor(255, 255, 255, 255), 1, auth.font[5], 'center', 'center', false, false, false, false, false)
- dxDrawText(rules, 442, 192, 1037, 940, tocolor(255, 255, 255, 255), 1, auth.font[1], "center", "top", false, true, false, false, false)
- dxDrawText("Akceptuje regulamin", 1139, 608, 1457, 638, tocolor(34, 35, 66, 255), 1, auth.font[1], "left", "center", false, false, false, false, false)
- dxDrawText('LOGIN', 1107, 75, 855, 573, tocolor(34, 35, 66, 255), 1, auth.font[3], 'left', 'center', false, false, false, false, false)
- dxDrawText('HASŁO', 1107, 292, 855, 573, tocolor(34, 35, 66, 255), 1, auth.font[3], 'left', 'center', false, false, false, false, false)
- dxDrawText('EMAIL', 1107, 513, 855, 573, tocolor(34, 35, 66, 255), 1, auth.font[3], 'left', 'center', false, false, false, false, false)
- dxDrawText("Wróć do logowania", 1037, 903, 1514, 939, tocolor(34, 35, 66, 255), 1.00, auth.font[3], "center", "center", false, false, false, false, false)
- dxDrawText(meta.artist.." - "..meta.title, 121, 991, 1910, 1070, tocolor(255, 255, 255, 255), 1.00, auth.font[4], "left", "center", false, false, false, false, false)
- editbox:renderEditbox('R_Login')
- editbox:renderEditbox('R_Haslo')
- editbox:renderEditbox('R_Email')
- end
- if auth_page == 3 then
- dxDrawRectangle(0, 0, 1920, 1080, tocolor(28, 29, 50, 255), false)
- dxDrawImage(10, 964, 106, 106, auth.textures['vinyl'], rot, 0, 0, tocolor(255, 255, 255, 255), false)
- dxDrawImage(884, 60, 977, 960, auth.textures['map'], 0, 0, 0, tocolor(255, 255, 255, 255), false)
- dxDrawImage(215, 512, 340, 57, auth.textures['button'], 0, 0, 0, tocolor(255, 255, 255, 255), false)
- dxDrawImage(215, 412, 340, 57, auth.textures['button'], 0, 0, 0, tocolor(255, 255, 255, 255), false)
- dxDrawImage(215, 612, 340, 57, auth.textures['button'], 0, 0, 0, tocolor(255, 255, 255, 255), false)
- if isMouseInPosition(215, 411, 341, 57) then
- dxDrawImage(1516, 177, 28, 48, auth.textures['pin'], 0, 0, 0, tocolor(255, 255, 255, 255), false)
- elseif isMouseInPosition(215, 511, 341, 57) then
- dxDrawImage(1675, 792, 28, 48, auth.textures['pin'], 0, 0, 0, tocolor(255, 255, 255, 255), false)
- elseif isMouseInPosition(215, 611, 341, 57) then
- dxDrawImage(921, 490, 28, 48, auth.textures['pin'], 0, 0, 0, tocolor(255, 255, 255, 255), false)
- end
- dxDrawText("LAS VENTURAS", 213, 411, 556, 471, tocolor(255, 255, 255, 255), 1.00, auth.font[2], "center", "center", false, false, false, false, false)
- dxDrawText("LOS SANTOS", 213, 510, 556, 570, tocolor(255, 255, 255, 255), 1.00, auth.font[2], "center", "center", false, false, false, false, false)
- dxDrawText("SAN FIERRO", 213, 610, 556, 670, tocolor(255, 255, 255, 255), 1.00, auth.font[2], "center", "center", false, false, false, false, false)
- dxDrawText(meta.artist.." - "..meta.title, 121, 991, 1910, 1070, tocolor(255, 255, 255, 255), 1.00, auth.font[4], "left", "center", false, false, false, false, false)
- end
- end
- auth.click = function(b, s)
- if b == 'left' and s == 'down' then
- if isMouseInPosition(712, 658, 155, 21) then
- auth_page = 2
- editbox:deleteEditbox('L_Login')
- editbox:deleteEditbox('L_Haslo')
- elseif isMouseInPosition(1175, 907, 206, 26) then
- auth_page = 1
- editbox:deleteEditbox('R_Login')
- editbox:deleteEditbox('R_Haslo')
- editbox:deleteEditbox('R_Email')
- end
- elseif isMouseInPosition(511, 679, 342, 60) and auth_page == 1 then
- local login = editbox:getEditboxText('L_Login') or '';
- local pass = editbox:getEditboxText('L_Haslo') or '';
- if (#login < 3) then
- outputConsole('Login powinien zawierać przynajmniej 4 znaki.');
- elseif (#pass < 7) then
- outputConsole('Niepoprawne hasło');
- else
- triggerServerEvent('logging.loginPlayer', resourceRoot, login, pass);
- end;
- elseif isMouseInPosition(1108, 646, 340, 57) and auth_page == 2 then
- local login = editbox:getEditboxText('R_Login') or '';
- local pass = editbox:getEditboxText('R_Haslo') or '';
- local email = editbox:getEditboxText('R_Email') or '';
- if (#login < 4) then
- outputConsole('Login powinien zawierać przynajmniej 4 znaki.');
- elseif (#pass < 7) then
- outputConsole('Ze względów bezpieczeństwa hasło powinno zawierać minimum 7 znaków.');
- elseif (#email < 5) then
- outputConsole('Adres e-mail powinien zawierać przynajmniej 5 znaków');
- elseif(not isValidMail(email))then
- outputConsole('Adres e-mail jest nieprawidłowy.');
- elseif auth_rules == 0 then
- outputConsole('Aby dokonać rejestracji musisz zaakceptować regulamin');
- else
- triggerServerEvent('logging.registerPlayer', resourceRoot, login, pass, email);
- outputConsole('Pomyślnie utworzono konto.');
- end;
- elseif isMouseInPosition(1107, 608, 30, 30) and auth_page == 2 then
- auth_rules = auth_rules or 0
- if auth_rules and auth_rules == 0 then
- auth_rules = 1
- else
- auth_rules = 0
- end
- elseif isMouseInPosition(512, 617, 30, 30) and auth_page == 1 then
- auth_save = auth_save or 0
- if auth_save and auth_save == 0 then
- auth_save = 1
- local xml = xmlCreateFile('account.xml', 'auth')
- local login = editbox:getEditboxText('L_Login', tostring(login)) or ''
- local pass = editbox:getEditboxText('L_Haslo', tostring(pass)) or ''
- if not xml then return end
- xmlNodeSetValue(xmlCreateChild(xml, 'login'), login)
- xmlNodeSetValue(xmlCreateChild(xml, 'passwd'), pass)
- xmlSaveFile(xml)
- else
- auth_save = 0
- end
- elseif isMouseInPosition(215, 411, 341, 57) and auth_page == 3 then
- setElementData(localPlayer, 'player:spawn', {-1971.24854, 479.79395, 35.17188})
- triggerServerEvent('core:spawnPlayer', localPlayer, localPlayer)
- auth.end_login()
- elseif isMouseInPosition(215, 511, 341, 57) and auth_page == 3 then
- auth.end_login()
- setElementData(localPlayer, 'player:spawn', {947.36078, 1733.41956, 8.85156})
- triggerServerEvent('core:spawnPlayer', localPlayer, localPlayer)
- elseif isMouseInPosition(215, 611, 341, 57) and auth_page == 3 then
- auth.end_login()
- setElementData(localPlayer, 'player:spawn', {1, 2, 3})
- triggerServerEvent('core:spawnPlayer', localPlayer, localPlayer)
- end
- end
- auth.loadAccounts = function()
- local xml = xmlLoadFile('account.xml')
- if not xml then return end
- login = xmlNodeGetValue(xmlFindChild(xml, 'login', 0))
- editbox:setEditboxText('L_Login', tostring(login))
- pass = xmlNodeGetValue(xmlFindChild(xml, 'passwd', 0))
- editbox:setEditboxText('L_Haslo', tostring(pass))
- auth_save = 1
- auth_login, auth_pass = login, pass
- end;
- auth.toggle = function(b)
- if b then
- auth.loadAccounts()
- tick = getTickCount();
- showChat(false)
- showCursor(true)
- auth_music = playSound('assets/music/'..math.random(1,3)..'.mp3',true);
- setSoundVolume(auth_music, 1)
- addEventHandler('onClientRender', root, auth.render)
- addEventHandler('onClientClick', root, auth.click)
- else
- tick = nil;
- destroyElement(auth.textures['vinyl']); destroyElement(auth.textures['button']); destroyElement(auth.textures['checkon']); destroyElement(auth.textures['checkoff']); destroyElement(auth.textures['map']); destroyElement(auth.textures['pin']);
- stopSound(auth_music)
- showChat(true)
- showCursor(false)
- removeEventHandler('onClientRender', root, auth.render)
- removeEventHandler('onClientClick', root, auth.click)
- end
- end;
- auth.end_login = function(b)
- if b then
- auth_page = 3
- else
- auth.toggle()
- end
- end;
- auth.toggle(true)
- addEvent('LOGIN', true)
- addEventHandler('LOGIN', resourceRoot, function(...)
- end);
Advertisement
Add Comment
Please, Sign In to add comment