Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(getElementData(localPlayer, "player:logged"))then return end;
- local editbox = exports["fx-editbox"];
- local scroll = exports["fx-scroll"];
- local noti = exports["fx-notifications"];
- local buttons = exports["fx-buttons"];
- local sw,sh = guiGetScreenSize();
- local zoom = 1;
- if sw < 1920 then
- zoom = math.min(2, 1920 / sw);
- end;
- local class = {};
- local self = {};
- setmetatable(self, {__index=class});
- local anims, builtins = {}, {"Linear", "InQuad", "OutQuad", "InOutQuad", "OutInQuad", "InElastic", "OutElastic", "InOutElastic", "OutInElastic", "InBack", "OutBack", "InOutBack", "OutInBack", "InBounce", "OutBounce", "InOutBounce", "OutInBounce", "SineCurve", "CosineCurve"}
- function table.find(t, v)
- for k, a in ipairs(t) do
- if a == v then
- return k
- end
- end
- return false
- end
- function animate(f, t, easing, duration, onChange, onEnd)
- assert(type(f) == "number", "Bad argument @ 'animate' [expected number at argument 1, got "..type(f).."]")
- assert(type(t) == "number", "Bad argument @ 'animate' [expected number at argument 2, got "..type(t).."]")
- assert(type(easing) == "string" or (type(easing) == "number" and (easing >= 1 or easing <= #builtins)), "Bad argument @ 'animate' [Invalid easing at argument 3]")
- assert(type(duration) == "number", "Bad argument @ 'animate' [expected function at argument 4, got "..type(duration).."]")
- assert(type(onChange) == "function", "Bad argument @ 'animate' [expected function at argument 5, got "..type(onChange).."]")
- table.insert(anims, {from = f, to = t, easing = table.find(builtins, easing) and easing or builtins[easing], duration = duration, start = getTickCount( ), onChange = onChange, onEnd = onEnd})
- return #anims
- end
- function destroyAnimation(a)
- if anims[a] then
- table.remove(anims, a)
- end
- end
- addEventHandler("onClientRender", root, function( )
- local now = getTickCount( )
- for k,v in ipairs(anims) do
- v.onChange(interpolateBetween(v.from, 0, 0, v.to, 0, 0, (now - v.start) / v.duration, v.easing))
- if now >= v.start+v.duration then
- if type(v.onEnd) == "function" then
- v.onEnd( )
- end
- table.remove(anims, k)
- end
- end
- end)
- function isMouseInPosition ( x, y, width, height )
- if ( not isCursorShowing( ) ) then
- return false
- end
- local sx, sy = guiGetScreenSize ( )
- local cx, cy = getCursorPosition ( )
- local cx, cy = ( cx * sx ), ( cy * sy )
- if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
- return true
- else
- return false
- end
- end
- function transformText(text, max)
- local x_tbl = {};
- local x_new = "";
- for i,v in pairs(split(text, "\n")) do
- if(#v > max)then
- local x = 0;
- local x2 = -max+1;
- for i = 1,#v/max do
- x = x+max;
- x2 = x2+max;
- table.insert(x_tbl, string.sub(v, x2, x));
- end;
- end;
- end;
- return x_tbl;
- end;
- local cameras = {
- {2035.0190429688,1343.0911865234,16.51189994812, 5000, 7500, 5}, -- spawn
- {2105.5305175781,2031.8415527344,21.251699447632, 1000, 3000, 5}, -- urzad
- {2166.3271484375,1990.3846435547,16.479099273682, -8000, -5000, 5}, -- sklep
- {1662.2607421875,2174.9599609375,14.306599617004, 1000, 1500, 2}, -- mechanik
- }
- local tick = getTickCount();
- local camera = math.random(1,#cameras);
- local intro_step = (cameras[camera][4]+cameras[camera][5])/2;
- local timer = false;
- local start = true;
- function setNewCamera()
- while(true)do
- local new = math.random(1,#cameras);
- if(new ~= camera)then
- camera = new;
- last_camera = camera;
- tick = getTickCount();
- intro_step = (cameras[camera][4]+cameras[camera][5])/2;
- fadeCamera(true);
- break;
- end;
- end;
- end;
- class.load = function()
- self.img = {
- dxCreateTexture("img/aktualizacje.png", "argb", false, "clamp"),
- dxCreateTexture("img/regulamin.png", "argb", false, "clamp"),
- dxCreateTexture("img/rejestracja.png", "argb", false, "clamp"),
- dxCreateTexture("img/logowanie.png", "argb", false, "clamp"),
- dxCreateTexture("img/background.png", "argb", false, "clamp"),
- dxCreateTexture("img/save.png", "argb", false, "clamp"),
- dxCreateTexture("img/save_1.png", "argb", false, "clamp"),
- dxCreateTexture("img/welcome.png", "argb", false, "clamp"),
- };
- self.selected = 0;
- self.save = 0;
- self.login, self.password = "", "";
- self.news = {};
- self.newsNumber = 1;
- self.update = 3;
- self.rules = [[
- #1# Korzystanie z czatu tekstowego/głosowego:
- &1.1 Obowiązkowe jest zachowanie kultury osobistej na kanałach głosowych oraz tekstowych - używaj ich zgodnie z przeznaczeniem.
- &1.2 Zakazuje się publikowania danych osobowych, kontaktowych lub zdjęć bez zgody danej osoby.
- &1.3 Podszywanie się pod administracje bądź danego użytkownika w celu zdobycia jakichkolwiek informacji, będzie surowo karane.
- &1.4 Reklamowanie innych serwerów Discord związanych z jakąkolwiek tematyką, jest surowo zabronione.
- &1.5 Zwracaj się z szacunkiem do innych użytkowników.
- &1.6 Zabronione jest zamieszczanie treści/postów obrażających inne orientacje, narodowości, religie, rasy ludzkie itd.
- &1.7 Zabrania się tworzenia wielokrotnych kont na serwerze Discord, tzw "Multikonta"
- &1.8 Zakazuje się obrażania użytkowników w jakikolwiek sposób.
- &1.9 Zabrania się nagrywania rozmów użytkowników bez ich zgody.
- #2# Avatar/Nick nie może:
- &2.1 Zawierać treści +18, wulgarnych oraz nawołujących do agresji/przemocy.
- &2.2 Zwierać żadnych treści prowokujący, niestosowny itd.
- &2.3 Obrażać innych użytkowników, religie oraz narodowości.
- &2.4 Być specjalnie taki sam/podobny do nicku/avataru innej osoby.
- #3# Kanały tekstowe:
- &3.1 Zabrania się pisania durnych pytań na kanale 🌍pytania.
- &3.2 Zabrania się nadmiernego spamowania - floodowania.
- &3.3 Zabrania się pisania na np. 🎦multimedia o sprawach nie związanych z tematyką.
- #4# Informacje końcowe:
- &4.1 Administracja ma zawsze rację i jej decyzję są niepodważalne.
- &4.2 Każdy członek discorda jest zobowiązany do godnego reprezentowania mienia serwera.
- &4.3 Administracja ma prawo do wyrzucenia z discorda bez podania powodu.
- &4.4 Nieznajomość regulaminu nie zwalnia z przestrzegania go.
- &4.5 Za nieprzestrzeganie regulaminu będą wyciągane konsekwencje.
- &4.6 Regulamin w każdej chwili może ulec zmianie.
- ]]
- self.rulesNumber = 1;
- self.acceptRules = 0;
- font = dxCreateFont("font.ttf", 11)
- font1 = dxCreateFont("font1.ttf", 9)
- self.tick = getTickCount();
- self.off = false;
- data.misc = playSound("music/music.mp3", true);
- self.render_fnc = function() self.render() end;
- self.click_fnc = function(...) self.click(...) end;
- addEventHandler("onClientRender", root, self.render_fnc);
- addEventHandler("onClientClick", root, self.click_fnc);
- setElementFrozen(localPlayer, true);
- showCursor(true);
- fadeCamera(true);
- showChat(false)
- showPlayerHudComponent("all", false);
- setPlayerHudComponentVisible("money", false);
- if (self.selected == 4) then
- editbox:dxCreateEdit("EDIT-LOGIN1", "", "Wprowadź swój login...", sw/2-400/2/zoom, sh/2-330/2/zoom, 400/zoom, 50/zoom, false, 3, 0);
- editbox:dxCreateEdit("EDIT-HASH1", "", "Wprowadź swoje hasło...", sw/2-400/2/zoom, sh/2-180/2/zoom, 400/zoom, 50/zoom, true, 3, 0);
- buttons:createButton("BUTTON-LOGIN1", "Zaloguj się", sw/2, sh/2, 200/zoom, 40/zoom, 5, 0);
- end
- end;
- data={ showed=nil, misc=nil}
- class.render = function()
- setElementData(localPlayer, "loguje", true)
- if(self.off and (getTickCount()-self.off) > 3500)then
- editbox:dxDestroyEdit("EDIT-LOGIN1");
- editbox:dxDestroyEdit("EDIT-HASH1");
- editbox:dxDestroyEdit("EDIT-HASH2");
- buttons:destroyButton("BUTTON-LOGIN1");
- buttons:destroyButton("BUTTON-REGISTER1");
- buttons:destroyButton("BUTTON-RULES1");
- editbox:dxDestroyEdit("EDIT-MAIL1");
- for i,v in pairs(self.img) do
- if(isElement(v))then
- destroyElement(v);
- end;
- end;
- if(isElement(self.music))then
- destroyElement(self.music);
- end;
- showCursor(false);
- setElementFrozen(localPlayer, false);
- removeEventHandler("onClientRender", root, self.render_fnc);
- removeEventHandler("onClientClick", root, self.click_fnc);
- setPlayerHudComponentVisible("all", false)
- setPlayerHudComponentVisible("crosshair", true)
- noti:addNotification("Pomyślnie zalogowano.", "success");
- setElementData(localPlayer, "user:showHud", true);
- end;
- dxDrawImage(0, 0, sw, sh, self.img[5], 0, 0, 0, tocolor(255, 255, 255, 255), false);
- local a,y1 = 0, 0;
- if((getTickCount()-self.tick) > 2000)then
- a,y1 = interpolateBetween(0, 40, 0, 255, 50, 0, (getTickCount()-self.tick-2000)/500, "Linear");
- end;
- local a_200 = a > 200 and 200 or a
- editbox:dxSetEditAlpha("EDIT-LOGIN1", a);
- editbox:dxSetEditAlpha("EDIT-HASH1", a);
- buttons:setButtonAlpha("BUTTON-LOGIN1", a);
- screenW, screenH = guiGetScreenSize()
- local anims, builtins = {}, {"Linear", "InQuad", "OutQuad", "InOutQuad", "OutInQuad", "InElastic", "OutElastic", "InOutElastic", "OutInElastic", "InBack", "OutBack", "InOutBack", "OutInBack", "InBounce", "OutBounce", "InOutBounce", "OutInBounce", "SineCurve", "CosineCurve"}
- function table.find(t, v)
- for k, a in ipairs(t) do
- if a == v then
- return k
- end
- end
- return false
- end
- function animate(f, t, easing, duration, onChange, onEnd)
- assert(type(f) == "number", "Bad argument @ 'animate' [expected number at argument 1, got "..type(f).."]")
- assert(type(t) == "number", "Bad argument @ 'animate' [expected number at argument 2, got "..type(t).."]")
- assert(type(easing) == "string" or (type(easing) == "number" and (easing >= 1 or easing <= #builtins)), "Bad argument @ 'animate' [Invalid easing at argument 3]")
- assert(type(duration) == "number", "Bad argument @ 'animate' [expected function at argument 4, got "..type(duration).."]")
- assert(type(onChange) == "function", "Bad argument @ 'animate' [expected function at argument 5, got "..type(onChange).."]")
- table.insert(anims, {from = f, to = t, easing = table.find(builtins, easing) and easing or builtins[easing], duration = duration, start = getTickCount( ), onChange = onChange, onEnd = onEnd})
- return #anims
- end
- function destroyAnimation(a)
- if anims[a] then
- table.remove(anims, a)
- end
- end
- if((getTickCount()-self.tick) > 2000)then
- for i,v in pairs(self.img) do
- if(i <= 4)then
- local newZoom = zoom;
- if(sw > 1366)then
- newZoom = newZoom*1.4;
- end;
- animate(screenW * -0.1568, screenW * 0.2427, "Linear", 1000, function(value) kuktas = value end)
- local sY = (450/newZoom)*(i-3);
- if (self.selected==0) then
- dxDrawImage(screenW * 0.0000, screenH * 0.0000, screenW * 1.0000, screenH * 1.0000, ":fx-login/img/background.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- dxDrawImage(screenW * 0.3839, screenH * 0.0620, screenW * 0.2083, screenH * 0.3704, ":fx-login/img/400.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- dxDrawImage(kuktas, screenH * 0.4417, screenW * 0.1708, screenH * 0.0713, ":fx-login/img/button_wyb0.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- logowanie
- dxDrawImage(screenW * 0.4083, screenH * 0.5213, screenW * 0.1708, screenH * 0.0713, ":fx-login/img/button_wyb0.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- lista zmian
- dxDrawImage(screenW * 0.5594, screenH * 0.4417, screenW * 0.1708, screenH * 0.0713, ":fx-login/img/button_wyb0.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- rejestracja
- dxDrawImage(screenW * 0.4042, screenH * 0.3611, screenW * 0.1708, screenH * 0.0713, ":fx-login/img/button_wyb0.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- regulamin
- dxDrawText("Logowanie", screenW * 0.2651, screenH * 0.4454, screenW * 0.3911, screenH * 0.5037, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
- dxDrawText("Rejestracja", screenW * 0.5802, screenH * 0.4454, screenW * 0.7063, screenH * 0.5037, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
- dxDrawText("Lista zmian", screenW * 0.4255, screenH * 0.3648, screenW * 0.5516, screenH * 0.4231, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
- dxDrawText("Regulamin", screenW * 0.4313, screenH * 0.5250, screenW * 0.5573, screenH * 0.5833, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
- end
- -- if(self.selected == i)then
- -- if(isMouseInPosition(50/zoom, sh/2-(270+sY)/2/zoom, 192/zoom, 128/zoom))then
- -- -- dxDrawImage(y1/zoom, sh/2-(270+sY)/2/zoom, 192/zoom, 128/zoom, v, 0, 0, 0, tocolor(0, 72, 170, a_200), false);
- -- else
- -- dxDrawImage(y1/zoom, sh/2-(270+sY)/2/zoom, 192/zoom, 128/zoom, v, 0, 0, 0, tocolor(0, 72, 170, a), false);
- --end;
- --else
- -- if(isMouseInPosition(50/zoom, sh/2-(270+sY)/2/zoom, 192/zoom, 128/zoom))then
- -- dxDrawImage(y1/zoom, sh/2-(270+sY)/2/zoom, 192/zoom, 128/zoom, v, 0, 0, 0, tocolor(222, 222, 222, a_200), false);
- -- else
- -- dxDrawImage(y1/zoom, sh/2-(270+sY)/2/zoom, 192/zoom, 128/zoom, v, 0, 0, 0, tocolor(222, 222, 222, a), false);
- -- end;
- -- end;
- if(i == 1)then
- dxDrawImage((y1+114)/zoom, sh/2-(290+sY)/2/zoom, 64/zoom, 64/zoom, "img/circle.png", 0, 0, 0, tocolor(255, 0, 32, 255), false);
- dxDrawText(self.update, (y1+130)/zoom+1, sh/2-(290+sY)/2/zoom+1, 32/zoom+(y1+130)/zoom+1, 64/zoom+sh/2-(290+sY)/2/zoom+1, tocolor(0, 0, 0, 255), 1, font1, "center", "center", false);
- dxDrawText(self.update, (y1+130)/zoom, sh/2-(290+sY)/2/zoom, 32/zoom+(y1+130)/zoom, 64/zoom+sh/2-(290+sY)/2/zoom, tocolor(200, 200, 200, 255), 1, font1, "center", "center", false);
- end;
- end;
- end;
- end;
- local w,h = 304,126;
- local Y = (sh/2)-((h/2)/zoom);
- if((getTickCount()-self.tick) > 1500)then
- Y = interpolateBetween((sh/2)-((h/2)/zoom), 0, 0, 20/zoom, 0, 0, (getTickCount()-self.tick-1500)/500, "Linear");
- end
- dxDrawImage(sw/2-w/2/zoom, Y, w/zoom, h/zoom, self.img[8], 0, 0, 0, tocolor(255, 255, 255, 255), false);
- if(self.selected == 1)then
- dxDrawText("Aktualizacje", 0+1, 0+1, sw+1, sh/1.75+1, tocolor(0, 0, 0, 255), 1, font, "center", "center", false);
- dxDrawText("Aktualizacje", 0, 0, sw, sh/1.75, tocolor(255, 255, 255, 255), 1, font, "center", "center", false);
- self.newsNumber = math.floor(scroll:dxScrollGetPosition("NEWS-SCROLL1") + 1);
- local text = "";
- for i,v in pairs(self.news) do
- if((self.newsNumber + 16) >= i and self.newsNumber <= i)then
- if(#text > 0)then
- text = text.."\n"..v.nick.." ("..v.date..") - "..v.text;
- else
- text = v.nick.." ("..v.date..") - "..v.text;
- end;
- end;
- end;
- dxDrawText(text, 0+1, sh/2-175/zoom+1, sw+1, sh+1, tocolor(0, 0, 0, 255), 1, font, "center", "top", false);
- dxDrawText(text, 0, sh/2-175/zoom, sw, sh, tocolor(235, 235, 235, 255), 1, font, "center", "top", false);
- dxDrawText("11.02 - Wszczęto prace nad serwerem\n12.02 - Dodano panel logowania oraz panel pomocy, a w nim statystyki gracza\n13.02 - Dodano licznik, interakcje oraz notyfikacje", 500/zoom+1, sh/2-175/zoom+1, sw-500/zoom+1, sh+1, tocolor(0, 0, 0, 255), 1, font1, "center", "top", false, false);
- dxDrawText("11.02 - Wszczęto prace nad serwerem\n12.02 - Dodano panel logowania oraz panel pomocy, a w nim statystyki gracza\n13.02 - Dodano licznik, interakcje oraz notyfikacje", 500/zoom, sh/2-175/zoom, sw-500/zoom, sh, tocolor(235, 235, 235, 255), 1, font1, "center", "top", false, false);
- elseif(self.selected == 2)then
- dxDrawText("Regulamin", 0+1, 0+1, sw+1, sh/1.75+1, tocolor(0, 0, 0, 255), 1, font, "center", "center", false);
- dxDrawText("Regulamin", 0, 0, sw, sh/1.75, tocolor(255, 255, 255, 255), 1, font, "center", "center", false);
- self.rulesNumber = math.floor(scroll:dxScrollGetPosition("RULES-SCROLL1") + 1);
- local text = "";
- for i,v in pairs(split(self.rules, "\n")) do
- if((self.rulesNumber + 16) >= i and self.rulesNumber <= i)then
- if(#text > 0)then
- text = text.."\n"..v;
- else
- text = v;
- end;
- end;
- end;
- dxDrawText(text, 500/zoom+1, sh/2-175/zoom+1, sw-500/zoom+1, sh+1, tocolor(0, 0, 0, 255), 1, font1, "center", "top", false, false);
- dxDrawText(text, 500/zoom, sh/2-175/zoom, sw-500/zoom, sh, tocolor(235, 235, 235, 255), 1, font1, "center", "top", false, false);
- elseif(self.selected == 3)then
- dxDrawText("Rejestracja", 0+1, 0+1, sw+1, sh/1.75+1, tocolor(0, 0, 0, 255), 1, font, "center", "center", false);
- dxDrawText("Rejestracja", 0, 0, sw, sh/1.75, tocolor(255, 255, 255, 255), 1, font, "center", "center", false);
- if(self.acceptRules == 1)then
- dxDrawImage(sw/2-235/zoom/2, sh/2+270/2/zoom+5/zoom, 25/zoom, 25/zoom, self.img[7], 0, 0, 0, tocolor(255, 255, 255, a), false);
- else
- dxDrawImage(sw/2-235/zoom/2, sh/2+270/2/zoom+5/zoom, 25/zoom, 25/zoom, self.img[6], 0, 0, 0, tocolor(255, 255, 255, a), false);
- end;
- dxDrawText("Zaakceptuj regulamin", 1, sh/2+270/2/zoom+1+7/zoom, sw+1, sh+1, tocolor(0, 0, 0, a), 1, font1, "center", "top", false, false, false, true);
- dxDrawText("Zaakceptuj #0048aaregulamin", 0, sh/2+270/2/zoom+7/zoom, sw, sh, tocolor(200, 200, 200, a), 1, font1, "center", "top", false, false, false, true);
- elseif(self.selected == 4)then
- dxDrawText("Logowanie", 0+1, 0+1, sw+1, sh/1.75+1, tocolor(0, 0, 0, a), 1, font, "center", "center", false);
- dxDrawText("Logowanie", 0, 0, sw, sh/1.75, tocolor(255, 255, 255, a), 1, font, "center", "center", false);
- if(self.save == 1)then
- dxDrawImage(sw/2-194/zoom, sh/2+7/zoom, 25/zoom, 25/zoom, self.img[7], 0, 0, 0, tocolor(255, 255, 255, a), false);
- else
- dxDrawImage(sw/2-194/zoom, sh/2+7/zoom, 25/zoom, 25/zoom, self.img[6], 0, 0, 0, tocolor(255, 255, 255, a), false);
- end;
- dxDrawText("Zapamiętaj mnie", sw/2-160/zoom+1, sh/2+1, 200/zoom+sw/2+1, 40/zoom+sh/2+1, tocolor(0, 0, 0, a), 1, font1, "left", "center", false);
- dxDrawText("Zapamiętaj mnie", sw/2-160/zoom, sh/2, 200/zoom+sw/2, 40/zoom+sh/2, tocolor(200, 200, 200, a), 1, font1, "left", "center", false);
- end;
- end;
- class.click = function(button, state)
- if(button == "left" and state == "down" and (getTickCount()-self.tick) > 2000 and not self.off)then
- if(isMouseInPosition(sw/2-194/zoom, sh/2+7/zoom, 25/zoom, 25/zoom) and self.selected == 4)then
- self.save = self.save == 1 and 0 or 1;
- elseif(isMouseInPosition(sw/2-235/zoom/2, sh/2+270/2/zoom+5/zoom, 25/zoom, 25/zoom) and self.selected == 3)then
- self.acceptRules = self.acceptRules == 1 and 0 or 1;
- elseif(isMouseInPosition(sw/2+5/zoom, sh/2+290/2/zoom, 80/zoom, 20/zoom) and self.selected == 3)then
- editbox:dxDestroyEdit("EDIT-LOGIN1");
- editbox:dxDestroyEdit("EDIT-HASH1");
- editbox:dxDestroyEdit("EDIT-HASH2");
- buttons:destroyButton("BUTTON-REGISTER1");
- editbox:dxDestroyEdit("EDIT-MAIL1");
- self.selected = 2;
- local x = {};
- for i,v in pairs(split(self.rules, "\n")) do
- table.insert(x, v);
- end;
- scroll:dxCreateScroll("RULES-SCROLL1", sw-50/zoom, sh/2-175/zoom, 10/zoom, 10/zoom, 0, 17, x, 377/zoom);
- elseif(isMouseInPosition(sw/2, sh/2, 200/zoom, 40/zoom) and self.selected == 4)then
- local login = editbox:dxGetEditText("EDIT-LOGIN1") or "";
- local pass = editbox:dxGetEditText("EDIT-HASH1") or "";
- if(#login < 3)then
- addNoti("Login powinien posiadać przynajmniej 4 znaki.");
- elseif(#pass < 5)then
- addNoti("Hasło powinno posiadać przynajmniej 7 znaków.");
- else
- triggerServerEvent("logging:checkAccount", resourceRoot, login, pass, self.save);
- end;
- elseif(isMouseInPosition(sw/2-200/2/zoom, sh/2+390/2/zoom, 200/zoom, 40/zoom) and self.selected == 3)then
- local login = editbox:dxGetEditText("EDIT-LOGIN1") or "";
- local pass = editbox:dxGetEditText("EDIT-HASH2") or "";
- local pass2 = editbox:dxGetEditText("EDIT-HASH1") or "";
- if(#login < 3)then
- addNoti("Login powinien posiadać przynajmniej 4 znaki.");
- elseif(pass ~= pass2)then
- addNoti("Powtórzone hasło nie jest takie same.");
- elseif(#pass < 5)then
- addNoti("Hasło powinno posiadać przynajmniej 7 znaków.");
- elseif(self.acceptRules ~= 1)then
- addNoti("Najpierw zaakceptuj regulamin serwera.");
- else
- triggerServerEvent("logging:newAccount", resourceRoot, login, pass,pass);
- end;
- end;
- for i,v in pairs(self.img) do
- if(i <= 4)then
- local newZoom = zoom;
- if(sw > 1366)then
- newZoom = newZoom*1.4;
- end;
- local sY = (450/newZoom)*(i-3);
- if(self.selected ~= i)then
- if(isMouseInPosition(50/zoom, sh/2-(270+sY)/2/zoom, 192/zoom, 128/zoom))then
- if(self.selected == 3)then
- editbox:dxDestroyEdit("EDIT-LOGIN1");
- editbox:dxDestroyEdit("EDIT-HASH1");
- editbox:dxDestroyEdit("EDIT-HASH2");
- buttons:destroyButton("BUTTON-REGISTER1");
- editbox:dxDestroyEdit("EDIT-MAIL1");
- elseif(self.selected == 4)then
- editbox:dxDestroyEdit("EDIT-LOGIN1");
- editbox:dxDestroyEdit("EDIT-HASH1");
- buttons:destroyButton("BUTTON-LOGIN1");
- elseif(self.selected == 1)then
- scroll:dxDestroyScroll("NEWS-SCROLL1");
- elseif(self.selected == 2)then
- scroll:dxDestroyScroll("RULES-SCROLL1");
- buttons:destroyButton("BUTTON-RULES1");
- end;
- self.selected = i;
- if(self.selected == 3)then
- editbox:dxCreateEdit("EDIT-LOGIN1", "", "Wprowadź swój login...", sw/2-400/2/zoom, sh/2-330/2/zoom, 400/zoom, 50/zoom, false, 3, 255);
- editbox:dxCreateEdit("EDIT-HASH1", "", "Wprowadź swoje hasło...", sw/2-400/2/zoom, sh/2-180/2/zoom, 400/zoom, 50/zoom, true, 3, 255);
- editbox:dxCreateEdit("EDIT-HASH2", "", "Powtórz swoje hasło...", sw/2-400/2/zoom, sh/2-30/2/zoom, 400/zoom, 50/zoom, true, 3, 255);
- buttons:createButton("BUTTON-REGISTER1", "Zarejestruj się", sw/2-200/2/zoom, sh/2+390/2/zoom, 200/zoom, 40/zoom, 5, 255);
- editbox:dxCreateEdit("EDIT-MAIL1", "", "Wprowadź swój e-mail...", sw/2-400/2/zoom, sh/2+120/2/zoom, 400/zoom, 50/zoom, false, 3, 255)
- elseif(self.selected == 4)then
- editbox:dxCreateEdit("EDIT-LOGIN1", self.login, "Wprowadź swój login...", sw/2-400/2/zoom, sh/2-330/2/zoom, 400/zoom, 50/zoom, false, 3, 0);
- editbox:dxCreateEdit("EDIT-HASH1", self.password, "Wprowadź swoje hasło...", sw/2-400/2/zoom, sh/2-180/2/zoom, 400/zoom, 50/zoom, true, 3, 0);
- buttons:createButton("BUTTON-LOGIN1", "Zaloguj się", sw/2, sh/2, 200/zoom, 40/zoom, 5, 0);
- elseif(self.selected == 1)then
- scroll:dxCreateScroll("NEWS-SCROLL1", sw-50/zoom, sh/2-175/zoom, 10/zoom, 10/zoom, 0, 17, self.news, 377/zoom);
- elseif(self.selected == 2)then
- local x = {};
- for i,v in pairs(split(self.rules, "\n")) do
- table.insert(x, v);
- end;
- scroll:dxCreateScroll("RULES-SCROLL1", sw-50/zoom, sh/2-175/zoom, 10/zoom, 10/zoom, 0, 17, x, 377/zoom);
- end;
- end;
- end;
- end;
- end;
- end;
- end;
- function addNoti(text)
- noti:addNotification(text, "error", 2);
- end;
- addEvent("logging.addNoti", true)
- addEventHandler("logging.addNoti", resourceRoot, addNoti);
- addEvent("logging:result", true)
- addEventHandler("logging:result", resourceRoot, function(text)
- self.off = getTickCount();
- editbox:dxDestroyEdit("EDIT-LOGIN1");
- editbox:dxDestroyEdit("EDIT-HASH1");
- editbox:dxDestroyEdit("EDIT-HASH2");
- scroll:dxDestroyScroll("NEWS-SCROLL1");
- scroll:dxDestroyScroll("RULES-SCROLL1");
- buttons:destroyButton("BUTTON-LOGIN1");
- buttons:destroyButton("BUTTON-REGISTER1");
- buttons:destroyButton("BUTTON-RULES1");
- editbox:dxDestroyEdit("EDIT-MAIL1");
- noti:addNotification("Pomyślnie wczytano dane, trwa logowanie...", "success", 2);
- removeEventHandler("onClientRender", root, self.render_fnc);
- stopSound(data.misc)
- setCameraTarget(localPlayer)
- showCursor(false)
- showChat(true)
- setElementFrozen(localPlayer, false);
- setElementData(localPlayer,"loguje", false)
- end)
- class.load();
- addEventHandler("onClientResourceStop", resourceRoot, function()
- editbox:dxDestroyEdit("EDIT-LOGIN1");
- editbox:dxDestroyEdit("EDIT-HASH1");
- editbox:dxDestroyEdit("EDIT-HASH2");
- scroll:dxDestroyScroll("NEWS-SCROLL1");
- scroll:dxDestroyScroll("RULES-SCROLL1");
- buttons:destroyButton("BUTTON-LOGIN1");
- buttons:destroyButton("BUTTON-REGISTER1");
- buttons:destroyButton("BUTTON-RULES1");
- end)
- -- saves
- function loadDateFromXML()
- local xml = xmlLoadFile("data.xml")
- if xml then
- local myLogin = xmlFindChild(xml, "login", 0)
- local myPassword = xmlFindChild(xml, "password", 0)
- local dateLogin = xmlNodeGetValue(myLogin) or ""
- local datePass = xmlNodeGetValue(myPassword) or ""
- datePass = base64Decode(datePass)
- xmlUnloadFile(xml)
- return {dateLogin, datePass}
- end
- return {"", ""}
- end
- function saveDateToXML(login, password)
- password = base64Encode(password)
- local xml = xmlLoadFile("data.xml")
- if not xml then
- xml = xmlCreateFile("data.xml", "data")
- end
- local myLogin = xmlFindChild(xml, "login", 0)
- if not myLogin then
- myLogin = xmlCreateChild(xml, "login")
- end
- local myPassword = xmlFindChild(xml, "password", 0)
- if not myPassword then
- myPassword = xmlCreateChild(xml, "password")
- end
- xmlNodeSetValue(myLogin, login)
- xmlNodeSetValue(myPassword, password)
- xmlSaveFile(xml)
- xmlUnloadFile(xml)
- end
- addEvent("logging.saveDates", true)
- addEventHandler("logging.saveDates", resourceRoot, saveDateToXML)
- addEvent("logging.setDates", true)
- addEventHandler("logging.setDates", resourceRoot, function()
- local data = loadDateFromXML() or {"", ""};
- self.login, self.password = unpack(data);
- self.save = 1;
- editbox:dxSetEditText("EDIT-LOGIN1", self.login);
- editbox:dxSetEditText("EDIT-HASH1", self.password);
- end)
- addEvent("logging.setNews", true)
- addEventHandler("logging.setNews", resourceRoot, function(r)
- for i,v in pairs(r) do
- v.date = string.sub(v.date, 1, #v.date-3);
- end;
- self.news = r;
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement