Gyrosos Posted February 5, 2022 Share Posted February 5, 2022 Sziasztok! Akadt egy olyan gondom, hogy a login panelemben amikor meg akarom hívni a szerver oldali eventeket amiket én hoztam részre, a debugscript folyamat spameli, hogy nincs létrehozva. Elég hosszúra sikeredett a script, tudom lehetett volna egyszerűbben, de na. Itt a kliens és a szerver oldali: Kliens: showCursor(true); setPlayerHudComponentVisible("all", false); local cameraPos = { ["camera"] = 1870.80188, -1199.45056, 77.37451; ["lookingAt"] = 1960.03711, -1199.62573, 27.18720; }; local music = "files/music.mp3"; local x, y = guiGetScreenSize(); local relX, relY = x/1920, y/1080; local panelPos = {0.4, 0.3}; local showLoginPanel = true; local panelState = 1; local textBoxNumber = 0; local textBoxPos = {0.415, 0.35}; local colors = { ["background"] = tocolor(50, 50, 50, 180), ["textBox"] = tocolor(150, 150, 150, 180), ["loginButton"] = tocolor(100, 255, 100, 180), ["regButton"] = tocolor(255, 100, 100, 180), ["charSexButtonNő"] = tocolor(30, 30, 30, 180), ["charSexButtonFérfi"] = tocolor(30, 30, 30, 180), }; local rememberLogin = false; local userData = { [1] = { -- Login [1] = ""; -- Adatok [2] = ""; }, [2] = { -- Regisztráció [1] = ""; -- Felhasználónév [2] = ""; -- Jelszó [3] = ""; -- Jelszó újra [4] = ""; -- E-Mail }, [3] = { -- Karakter létrehozás [1] = ""; -- Karakternév [2] = ""; -- Karakter leírás [3] = ""; -- Karakter életkora [4] = ""; -- Karakter neme }, }; local selectedDataBox = { [1] = { [1] = false; -- Felhasználónév kiválasztva [2] = false; -- Jelszó kiválasztva }, [2] = { [1] = false; -- Felhasználónév kiválasztva [2] = false; -- Jelszó kiválasztva [3] = false; -- Jelszó újra kiválasztva [4] = false; -- E-Mail kiválasztva }, [3] = { [1] = false; -- Karakternév kiválasztva [2] = false; -- Karakter leírása kiválasztva [3] = false; -- Karakter életkora kiválasztva }, }; addEventHandler("onClientRender", root, function() if showLoginPanel then local isBanned = triggerServerEvent("isPlayerBanned", localPlayer); if isBanned then panelState = 4; end dxDrawImage(x*(panelPos[1])+50, y*(panelPos[2]-0.2), 600/2, 480/2, "files/logo.png"); setCameraMatrix(1870.80188, -1199.45056, 77.37451, 1960.03711, -1199.62573, 27.18720, 0, 90); dxDrawRectangle(x*panelPos[1], y*panelPos[2], relX*400, relY*400, colors["background"] ) dxDrawText("LoyalMTA - Login Panel", x*panelPos[1], y*(panelPos[2]-0.05), (x*panelPos[1])+400, (y*(panelPos[2]-0.05)+40), tocolor(255, 255, 255, 255), 1.75, "arial", "center", "center" ); for i=1, textBoxNumber, 1 do dxDrawRectangle(x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05+(i-1)*0.06), relX*350, relY*30, colors["textBox"] ); end if panelState == 1 then local text = string.rep("*", string.len(userData[1][2])); textBoxNumber = 2; dxDrawRectangle(x*(panelPos[1]+0.0125), y*(panelPos[2]+0.25), relX*25, relY*25, colors["textBox"] ); dxDrawText("Bejelentkezési adatok mentése", x*(panelPos[1]+0.0125)+27, y*(panelPos[2]+0.25), x*(panelPos[1]+0.125)+350, y*(panelPos[2]+0.25)+25, tocolor(255, 255, 255, 255), 1.25, "arial", "left", "center" ); dxDrawImage(x*(panelPos[1]+0.0125)+320, y*(panelPos[2]+0.05), relX*30, relY*30, "files/usericon.png"); dxDrawImage(x*(panelPos[1]+0.0125)+320, y*(panelPos[2]+0.11), relX*30, relY*30, "files/keyicon.png"); if selectedDataBox[1][1] then dxDrawText(userData[1][1].."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.05)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.11)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[1][2] then dxDrawText(userData[1][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.05)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text.."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.11)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[1][1] == false and selectedDataBox[1][2] == false then dxDrawText(userData[1][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.05)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.11)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); end if rememberLogin == true then dxDrawImage(x*(panelPos[1]+0.0125), y*(panelPos[2]+0.25), relX*25, relY*25, "files/check.png") end dxDrawRectangle(x*(panelPos[1]+0.0125), y*(panelPos[2]+0.3), relX*175, relY*30, colors["loginButton"] ); dxDrawText("Bejelentkezés", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.3), x*(panelPos[1]+0.0125)+175, y*(panelPos[2]+0.3)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawRectangle(x*(panelPos[1]+0.0125)+175, y*(panelPos[2]+0.3), relX*175, relY*30, colors["regButton"] ); dxDrawText("Regisztráció", x*(panelPos[1]+0.0125)+175, y*(panelPos[2]+0.3), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.3)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif panelState == 2 then local text = string.rep("*", string.len(userData[2][2])); local text2 = string.rep("*", string.len(userData[2][3])); textBoxNumber = 4; --[[dxDrawImage(x*(panelPos[1]+0.0125)+320, y*(panelPos[2]+0.05), relX*30, relY*30, "files/usericon.png"); dxDrawImage(x*(panelPos[1]+0.0125)+320, y*(panelPos[2]+0.11), relX*30, relY*30, "files/keyicon.png"); dxDrawImage(x*(panelPos[1]+0.0125)+320, y*(panelPos[2]+0.17), relX*30, relY*30, "files/keyicon.png"); dxDrawImage(x*(panelPos[1]+0.0125)+320, y*(panelPos[2]+0.23), relX*30, relY*30, "files/mailicon.png");]]-- if selectedDataBox[2][1] then dxDrawText(userData[2][1].."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text2, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[2][4], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.23), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.23)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[2][2] then dxDrawText(userData[2][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text.."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text2, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[2][4], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.23), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.23)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[2][3] then dxDrawText(userData[2][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text2.."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[2][4], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.23), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.23)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[2][4] then dxDrawText(userData[2][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text2, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[2][4].."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.23), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.23)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[2][1] == false and selectedDataBox[2][2] == false and selectedDataBox[2][3] == false and selectedDataBox[2][4] == false then dxDrawText(userData[2][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text2, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[2][4], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.23), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.23)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); end dxDrawRectangle(x*(panelPos[1]+0.0125), y*(panelPos[2]+0.3), relX*175, relY*30, colors["loginButton"] ); dxDrawText("Regisztráció", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.3), x*(panelPos[1]+0.0125)+relX*175, y*(panelPos[2]+0.3)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawRectangle(x*(panelPos[1]+0.0125)+175, y*(panelPos[2]+0.3), relX*175, relY*30, colors["regButton"] ); dxDrawText("Bejelentkezés", x*(panelPos[1]+0.0125)+175, y*(panelPos[2]+0.3), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.3)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif panelState == 3 then textBoxNumber = 3 if selectedDataBox[3][1] then dxDrawText(userData[3][1].."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][2], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][3], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[3][2] then dxDrawText(userData[3][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][2].."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][3], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[3][3] then dxDrawText(userData[3][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][2], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][3].."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[3][1] == false and selectedDataBox[3][2] == false and selectedDataBox[3][3] == false then dxDrawText(userData[3][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][2], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][3], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); end if userData[3][4] == "Férfi" then colors["charSexButtonFérfi"] = tocolor(100, 255, 100, 180); colors["charSexButtonNő"] = tocolor(30, 30, 30, 180); elseif userData[3][4] == "Nő" then colors["charSexButtonNő"] = tocolor(100, 255, 100, 180); colors["charSexButtonFérfi"] = tocolor(30, 30, 30, 180); elseif userData[3][4] == "" then colors["charSexButtonNő"] = tocolor(30, 30, 30, 180); colors["charSexButtonFérfi"] = tocolor(30, 30, 30, 180); end --\\ Férfi gomb dxDrawRectangle(x*(panelPos[1]+0.0125), y*(panelPos[2]+0.23), relX*175, relY*30, colors["charSexButtonFérfi"] ); dxDrawText("Férfi", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.23), x*(panelPos[1]+0.0125)+relX*175, y*(panelPos[2]+0.23)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); --\\ Nő gomb dxDrawRectangle(x*(panelPos[1]+0.0125)+175, y*(panelPos[2]+0.23), relX*175, relY*30, colors["charSexButtonNő"] ); dxDrawText("Nő", x*(panelPos[1]+0.0125)+175, y*(panelPos[2]+0.23), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.23)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawRectangle(x*(panelPos[1]+0.0125), y*(panelPos[2]+0.3), relX*350, relY*30, colors["loginButton"] ); dxDrawText("Karakter létrehozása", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.3), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.3)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif panelState == 4 then local serial = triggerServerEvent("getPlayerSerial", root, localPlayer); local bannedReason = triggerServerEvent("getBannedReason", root, localPlayer); local bannedUntil = triggerServerEvent("getBannedUntil", root, localPlayer); local getBannedDate = triggerServerEvent("getBannedData", root, localPlayer); textBoxNumber = 4; dxDrawText("Te serialod:"..serial, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); end end end); addEventHandler("onClientClick", root, function(button, state, cX, cY) if showLoginPanel then if button == "left" and state == "down" then if panelState == 1 then if cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.05) and cY < y*(panelPos[2]+0.05)+30 then selectedDataBox[1][1] = true; selectedDataBox[1][2] = false; elseif cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.11) and cY < y*(panelPos[2]+0.11)+30 then selectedDataBox[1][1] = false; selectedDataBox[1][2] = true; end --\\ Gombok if (cX > (x*(panelPos[1]+0.0125)) and cX < (x*(panelPos[1]+0.0125)+175) and cY > (y*(panelPos[2]+0.3)) and cY < (y*(panelPos[2]+0.3)+30)) then execLogin(userData[1][1], userData[1][2]); elseif (cX > (x*(panelPos[1]+0.0125)+175) and cX < (x*(panelPos[1]+0.0125)+350) and cY > (y*(panelPos[2]+0.3)) and cY < (y*(panelPos[2]+0.3)+30)) then panelState = 3; elseif (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+25 and cY > y*(panelPos[2]+0.25) and cY < y*(panelPos[2]+0.25)+25) then if rememberLogin then rememberLogin = false; else rememberLogin = true; end end elseif panelState == 2 then if (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.05) and cY < y*(panelPos[2]+0.05)+30) then selectedDataBox[2][1] = true; selectedDataBox[2][2] = false; selectedDataBox[2][3] = false; selectedDataBox[2][4] = false; elseif (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.11) and cY < y*(panelPos[2]+0.11)+30) then selectedDataBox[2][1] = false; selectedDataBox[2][2] = true; selectedDataBox[2][3] = false; selectedDataBox[2][4] = false; elseif (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.17) and cY < y*(panelPos[2]+0.17)+30) then selectedDataBox[2][1] = false; selectedDataBox[2][2] = false; selectedDataBox[2][3] = true; selectedDataBox[2][4] = false; elseif (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.23) and cY < y*(panelPos[2]+0.23)+30) then selectedDataBox[2][1] = false; selectedDataBox[2][2] = false; selectedDataBox[2][3] = false; selectedDataBox[2][4] = true; end --\\ Gombok if (cX > (x*(panelPos[1]+0.0125)) and cX < (x*(panelPos[1]+0.0125)+175) and cY > (y*(panelPos[2]+0.3)) and cY < (y*(panelPos[2]+0.3)+30)) then execReg(userData[2][1], userData[2][2], userData[2][3], userData[2][4]); elseif (cX > (x*(panelPos[1]+0.0125)+175) and cX < (x*(panelPos[1]+0.0125)+350) and cY > (y*(panelPos[2]+0.3)) and cY < (y*(panelPos[2]+0.3)+30)) then panelState = 1; end elseif panelState == 3 then if (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.05) and cY < y*(panelPos[2]+0.05)+30) then selectedDataBox[3][1] = true; selectedDataBox[3][2] = false; selectedDataBox[3][3] = false; elseif (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.11) and cY < y*(panelPos[2]+0.11)+30) then selectedDataBox[3][1] = false; selectedDataBox[3][2] = true; selectedDataBox[3][3] = false; elseif (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.17) and cY < y*(panelPos[2]+0.17)+30) then selectedDataBox[3][1] = false; selectedDataBox[3][2] = false; selectedDataBox[3][3] = true; end --\\ Gombok if (cX > (x*(panelPos[1]+0.0125)) and cX < (x*(panelPos[1]+0.0125)+350) and cY > (y*(panelPos[2]+0.3)) and cY < (y*(panelPos[2]+0.3)+30)) then execCharMaking(userData[3][1], userData[3][2], userData[3][3], userData[3][4]); panelState = 2; elseif cX > x*(panelPos[1]+0.0125)+175 and cY > y*(panelPos[2]+0.23) and cX < x*(panelPos[1]+0.0125)+350 and cY < y*(panelPos[2]+0.23)+30 then userData[3][4] = "Nő" elseif cX > x*(panelPos[1]+0.0125) and cY > y*(panelPos[2]+0.23) and cX < x*(panelPos[1]+0.0125)+175 and cY < y*(panelPos[2]+0.23)+30 then userData[3][4] = "Férfi" end end end end end); function writing(char) if showLoginPanel then if char then if panelState == 1 then if selectedDataBox[1][1] then if string.len(userData[1][1]) < 32 then userData[1][1] = userData[1][1]..char; end elseif selectedDataBox[1][2] then if string.len(userData[1][1]) < 32 then userData[1][2] = userData[1][2]..char; end end elseif panelState == 2 then if selectedDataBox[2][1] then if string.len(userData[2][1]) < 32 then userData[2][1] = userData[2][1]..char; end elseif selectedDataBox[2][2] then if string.len(userData[2][2]) < 32 then userData[2][2] = userData[2][2]..char; end elseif selectedDataBox[2][3] then if string.len(userData[2][3]) < 32 then userData[2][3] = userData[2][3]..char; end elseif selectedDataBox[2][4] then if string.len(userData[2][4]) < 32 then userData[2][4] = userData[2][4]..char; end end elseif panelState == 3 then if selectedDataBox[3][1] then if string.len(userData[3][1]) < 32 then userData[3][1] = userData[3][1]..char; end elseif selectedDataBox[3][2] then if string.len(userData[3][2]) < 32 then userData[3][2] = userData[3][2]..char; end elseif selectedDataBox[3][3] then if string.len(userData[3][3]) < 32 then userData[3][3] = userData[3][3]..char; end end end end end end addEventHandler("onClientCharacter", root, writing); function delAndTab(button, pOr) if showLoginPanel then if button == "tab" and pOr == true then if panelState == 1 then if selectedDataBox[1][1] then selectedDataBox[1][1] = false; selectedDataBox[1][2] = true; elseif selectedDataBox[1][2] then selectedDataBox[1][1] = true; selectedDataBox[1][2] = false; end elseif panelState == 2 then if selectedDataBox[2][1] then selectedDataBox[2][1] = false; selectedDataBox[2][2] = true; selectedDataBox[2][3] = false; selectedDataBox[2][4] = false; elseif selectedDataBox[2][2] then selectedDataBox[2][1] = false; selectedDataBox[2][2] = false; selectedDataBox[2][3] = true; selectedDataBox[2][4] = false; elseif selectedDataBox[2][3] then selectedDataBox[2][1] = false; selectedDataBox[2][2] = false; selectedDataBox[2][3] = false; selectedDataBox[2][4] = true; elseif selectedDataBox[2][4] then selectedDataBox[2][1] = true; selectedDataBox[2][2] = false; selectedDataBox[2][3] = false; selectedDataBox[2][4] = false; end elseif panelState == 3 then if selectedDataBox[3][1] then selectedDataBox[3][1] = false; selectedDataBox[3][2] = true; selectedDataBox[3][3] = false; elseif selectedDataBox[3][2] then selectedDataBox[3][1] = false; selectedDataBox[3][2] = false; selectedDataBox[3][3] = true; elseif selectedDataBox[3][3] then selectedDataBox[3][1] = true; selectedDataBox[3][2] = false; selectedDataBox[3][3] = false; end end elseif button == "backspace" and pOr == true then if panelState == 1 then if selectedDataBox[1][1] then userData[1][1] = string.sub(userData[1][1], 0, string.len(userData[1][1])-1); delTimer = setTimer(function() userData[1][1] = string.sub(userData[1][1], 0, string.len(userData[1][1])-1); end, 100, 0); elseif selectedDataBox[1][2] then userData[1][2] = string.sub(userData[1][2], 0, string.len(userData[1][2])-1); delTimer = setTimer(function() userData[1][2] = string.sub(userData[1][2], 0, string.len(userData[1][2])-1); end, 100, 0); end elseif panelState == 2 then if selectedDataBox[2][1] then userData[2][1] = string.sub(userData[2][1], 0, string.len(userData[2][1])-1); delTimer = setTimer(function() userData[2][1] = string.sub(userData[2][1], 0, string.len(userData[2][1])-1); end, 100, 0); elseif selectedDataBox[2][2] then userData[2][2] = string.sub(userData[2][2], 0, string.len(userData[2][2])-1); delTimer = setTimer(function() userData[2][2] = string.sub(userData[2][2], 0, string.len(userData[2][2])-1); end, 100, 0); elseif selectedDataBox[2][3] then userData[2][3] = string.sub(userData[2][3], 0, string.len(userData[2][3])-1); delTimer = setTimer(function() userData[2][3] = string.sub(userData[2][3], 0, string.len(userData[2][3])-1); end, 100, 0); elseif selectedDataBox[2][4] then userData[2][4] = string.sub(userData[2][4], 0, string.len(userData[2][4])-1); delTimer = setTimer(function() userData[2][4] = string.sub(userData[2][4], 0, string.len(userData[2][4])-1); end, 100, 0); end elseif panelState == 3 then if selectedDataBox[3][1] then userData[3][1] = string.sub(userData[3][1], 0, string.len(userData[3][1])-1); delTimer = setTimer(function() userData[3][1] = string.sub(userData[3][1], 0, string.len(userData[3][1])-1); end, 100, 0); elseif selectedDataBox[3][2] then userData[3][2] = string.sub(userData[3][2], 0, string.len(userData[3][2])-1); delTimer = setTimer(function() userData[3][2] = string.sub(userData[3][2], 0, string.len(userData[3][2])-1); end, 100, 0); elseif selectedDataBox[3][3] then userData[3][3] = string.sub(userData[3][3], 0, string.len(userData[3][3])-1); delTimer = setTimer(function() userData[3][3] = string.sub(userData[3][3], 0, string.len(userData[3][3])-1); end, 100, 0); end end elseif pOr == false then killTimer(delTimer); end end end addEventHandler("onClientKey", root, delAndTab); function execLogin(username, password) if username == "" or password == "" then if username == "" then notify("Nincs megadva felhasználónév", 1); elseif password == "" then notify("Nincs megadva jelszó", 1); end else --triggerServerEvent("execServerLog", localPlayer, username, password); notify("Bejelentkezés végrehajtva!", 2); end end function execReg(username, password, password2, email) if not password == password2 and not string.find(email, "@") and not username then if not password == password2 then notify("A két jelszó nem egyezik!", 1); elseif not string.find(email, "@") then notify("Hibás E-Mail cím!", 1); elseif not email then notify("Nincs megadva E-Mail cím", 1); elseif not username then notify("Nincs megadva felhasználónév", 1); end else --triggerServerEvent("execServerReg", localPlayer, username, password, password2, email); notify("Sikeres regisztráció!", 2); end end function execCharMaking(charName, charLeiras, charAge, charNem) if not charName and not charLeiras and not charAge and not charNem then if not charName then notify("Nincs megadva karakternév", 1); elseif not charLeiras then notify("Nincs megadva karakter leírás", 1); elseif not charAge then notify("Nincs megadva karakter életkora", 1); elseif not charNem then notify("Nincs megadva a karaktered neme", 1); end else --triggerServerEvent("execCharMaking", localPlayer, charName, charLeiras, charAge, charNem); notify("Sikeresen elkészítetted a karaktered!", 2) end end function notify(msg, msgType) local msgTypeColor = { [1] = tocolor(255, 100, 100, 180); [2] = tocolor(100, 255, 100, 180); }; if showLoginPanel then outputConsole(msg); end end Szerver: local con = exports.ly_mysql:getConnection(); function isPlayerBanned(player) if player then local serial = getPlayerSerial(player); local qh = dbQuery(con, "SELECT * FROM bans WHERE bannedSerial=? AND bannedUntil > CURRENT_TIME()", serial); local bans = dbPoll(qh, 1000); if bans then if (#bans > 0) then return true; else return false; end else return false; end else return false; end end addEventHandler("isPlayerBanned", root, isPlayerBanned); addEvent("isPlayerBanned", true); function getPlayerSerial(player) local serial = getPlayerSerial(player); return serial; end addEventHandler("getPlayerSerial", root, getPlayerSerial); addEvent("getPlayerSerial", true); function getBannedReason(player); local serial = getPlayerSerial(player); local qh = dbQuery(con, "SELECT bannedReason FROM bans WHERE bannedSerial=?", serial); local reason = dbPoll(qh, 1000); return reason; end addEventHandler("getBannedReason", root, getBannedReason); addEvent("getBannedReason", true); function getBannedDate(player); local serial = getPlayerSerial(player); local qh = dbQuery(con, "SELECT bannedDate FROM bans WHERE bannedSerial=?", serial); end addEventHandler("getBannedDate", root, getBannedData); addEvent("getBannedDate", true); function getBannedUntil(player); local serial = getPlayerSerial(player); local qh = dbQuery(con, "SELECT bannedUntil FROM bans WHERE bannedSerial=?", serial); local untilDate = dbPoll(qh, 1000); return untilDate; end addEventHandler("getBannedUntil", root, getBannedUntil); addEvent("getBannedUntil", true); function execServerLog(username, password) end function execServerReg(username, password, password2, email) end function execCharMaking(charName, charLeiras, charAge, charNem) end Akinek van kedve segíteni, és ideje elolvasni, annak megköszönöm! Link to comment
Gyrosos Posted February 9, 2022 Author Share Posted February 9, 2022 A hiba forrása meglett, a szerver oldali funkciók argumentjei után raktam véletlen ;-t, viszont most egy másik probléma keletkezett.. Most valamiért a MySQL-hez nem akar csatlakozni. Link to comment
Gyrosos Posted February 10, 2022 Author Share Posted February 10, 2022 Sziasztok! Sikeresen átnéztem a MySQL csatlakozást, azzal nincs semmi probléma, most azzal van a gond, hogy nem hajtja végre se a login-t, regisztrációt, se a karakter létrehozást. A scripten azóta dolgozgattam. Kliens oldal: showCursor(true); setPlayerHudComponentVisible("all", false); local cameraPos = { ["camera"] = 1870.80188, -1199.45056, 77.37451; ["lookingAt"] = 1960.03711, -1199.62573, 27.18720; }; local music = "files/music.mp3"; local x, y = guiGetScreenSize(); local relX, relY = x/1920, y/1080; local panelPos = {0.4, 0.3}; local showLoginPanel = true; local panelState = 1; local textBoxNumber = 0; local textBoxPos = {0.415, 0.35}; local msg = {"", 0}; local colors = { ["background"] = tocolor(50, 50, 50, 180), ["textBox"] = tocolor(150, 150, 150, 180), ["loginButton"] = tocolor(100, 255, 100, 180), ["regButton"] = tocolor(255, 100, 100, 180), ["charSexButtonNő"] = tocolor(30, 30, 30, 180), ["charSexButtonFérfi"] = tocolor(30, 30, 30, 180), }; local rememberLogin = false; local userData = { [1] = { -- Login [1] = ""; -- Adatok [2] = ""; }, [2] = { -- Regisztráció [1] = ""; -- Felhasználónév [2] = ""; -- Jelszó [3] = ""; -- Jelszó újra [4] = ""; -- E-Mail }, [3] = { -- Karakter létrehozás [1] = ""; -- Karakternév [2] = ""; -- Karakter leírás [3] = ""; -- Karakter életkora [4] = ""; -- Karakter neme }, }; local selectedDataBox = { [1] = { [1] = false; -- Felhasználónév kiválasztva [2] = false; -- Jelszó kiválasztva }, [2] = { [1] = false; -- Felhasználónév kiválasztva [2] = false; -- Jelszó kiválasztva [3] = false; -- Jelszó újra kiválasztva [4] = false; -- E-Mail kiválasztva }, [3] = { [1] = false; -- Karakternév kiválasztva [2] = false; -- Karakter leírása kiválasztva [3] = false; -- Karakter életkora kiválasztva }, }; addEventHandler("onClientRender", root, function() if showLoginPanel then if msg then if msg[2] == 2 then dxDrawRectangle(x*panelPos[1], y*(panelPos[2])+relY*420, relX*400, relY*150, colors["loginButton"]); elseif msg[2] == 1 then dxDrawRectangle(x*panelPos[1], y*(panelPos[2])+relY*420, relX*400, relY*150, colors["regButton"]); end dxDrawText(msg[1], x*panelPos[1], y*(panelPos[2])+relY*420, x*(panelPos[1])+relX*400, y*(panelPos[2])+relY*560, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center"); end dxDrawImage(x*(panelPos[1])+relX*140, y*(panelPos[2]-0.2)+relY*70, 240/2, 240/2, "files/logo.png"); setCameraMatrix(1870.80188, -1199.45056, 77.37451, 1960.03711, -1199.62573, 27.18720, 0, 90); dxDrawRectangle(x*panelPos[1], y*panelPos[2], relX*400, relY*400, colors["background"] ) dxDrawText("LoyalMTA - Login Panel", x*panelPos[1], y*(panelPos[2]-0.05), (x*panelPos[1])+400, (y*(panelPos[2]-0.05)+40), tocolor(255, 255, 255, 255), 1.75, "arial", "center", "center" ); for i=1, textBoxNumber, 1 do dxDrawRectangle(x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05+(i-1)*0.06), relX*350, relY*30, colors["textBox"] ); end if panelState == 1 then local text = string.rep("*", string.len(userData[1][2])); textBoxNumber = 2; dxDrawRectangle(x*(panelPos[1]+0.0125), y*(panelPos[2]+0.25), relX*25, relY*25, colors["textBox"] ); dxDrawText("Bejelentkezési adatok mentése", x*(panelPos[1]+0.0125)+27, y*(panelPos[2]+0.25), x*(panelPos[1]+0.125)+350, y*(panelPos[2]+0.25)+25, tocolor(255, 255, 255, 255), 1.25, "arial", "left", "center" ); dxDrawImage(x*(panelPos[1]+0.0125)+320, y*(panelPos[2]+0.05), relX*30, relY*30, "files/usericon.png"); dxDrawImage(x*(panelPos[1]+0.0125)+320, y*(panelPos[2]+0.11), relX*30, relY*30, "files/keyicon.png"); if selectedDataBox[1][1] then dxDrawText(userData[1][1].."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.05)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.11)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[1][2] then dxDrawText(userData[1][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.05)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text.."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.11)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[1][1] == false and selectedDataBox[1][2] == false then dxDrawText(userData[1][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.05)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.11)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); end if rememberLogin == true then dxDrawImage(x*(panelPos[1]+0.0125), y*(panelPos[2]+0.25), relX*25, relY*25, "files/check.png") end dxDrawRectangle(x*(panelPos[1]+0.0125), y*(panelPos[2]+0.3), relX*175, relY*30, colors["loginButton"] ); dxDrawText("Bejelentkezés", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.3), x*(panelPos[1]+0.0125)+175, y*(panelPos[2]+0.3)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawRectangle(x*(panelPos[1]+0.0125)+175, y*(panelPos[2]+0.3), relX*175, relY*30, colors["regButton"] ); dxDrawText("Regisztráció", x*(panelPos[1]+0.0125)+175, y*(panelPos[2]+0.3), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.3)+30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif panelState == 2 then local text = string.rep("*", string.len(userData[2][2])); local text2 = string.rep("*", string.len(userData[2][3])); textBoxNumber = 4; --[[dxDrawImage(x*(panelPos[1]+0.0125)+320, y*(panelPos[2]+0.05), relX*30, relY*30, "files/usericon.png"); dxDrawImage(x*(panelPos[1]+0.0125)+320, y*(panelPos[2]+0.11), relX*30, relY*30, "files/keyicon.png"); dxDrawImage(x*(panelPos[1]+0.0125)+320, y*(panelPos[2]+0.17), relX*30, relY*30, "files/keyicon.png"); dxDrawImage(x*(panelPos[1]+0.0125)+320, y*(panelPos[2]+0.23), relX*30, relY*30, "files/mailicon.png");]]-- if selectedDataBox[2][1] then dxDrawText(userData[2][1].."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text2, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[2][4], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.23), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.23)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[2][2] then dxDrawText(userData[2][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text.."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text2, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[2][4], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.23), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.23)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[2][3] then dxDrawText(userData[2][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text2.."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[2][4], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.23), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.23)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[2][4] then dxDrawText(userData[2][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text2, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[2][4].."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.23), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.23)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[2][1] == false and selectedDataBox[2][2] == false and selectedDataBox[2][3] == false and selectedDataBox[2][4] == false then dxDrawText(userData[2][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(text2, x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[2][4], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.23), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.23)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); end dxDrawRectangle(x*(panelPos[1]+0.0125), y*(panelPos[2]+0.3), relX*175, relY*30, colors["loginButton"] ); dxDrawText("Regisztráció", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.3), x*(panelPos[1]+0.0125)+relX*175, y*(panelPos[2]+0.3)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawRectangle(x*(panelPos[1]+0.0125)+175, y*(panelPos[2]+0.3), relX*175, relY*30, colors["regButton"] ); dxDrawText("Bejelentkezés", x*(panelPos[1]+0.0125)+175, y*(panelPos[2]+0.3), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.3)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif panelState == 3 then textBoxNumber = 3 if selectedDataBox[3][1] then dxDrawText(userData[3][1].."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][2], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][3], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[3][2] then dxDrawText(userData[3][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][2].."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][3], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[3][3] then dxDrawText(userData[3][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][2], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][3].."|", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); elseif selectedDataBox[3][1] == false and selectedDataBox[3][2] == false and selectedDataBox[3][3] == false then dxDrawText(userData[3][1], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.05), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.05)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][2], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.11), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.11)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawText(userData[3][3], x*(panelPos[1]+0.0125), y*(panelPos[2]+0.17), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.17)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); end if userData[3][4] == "Férfi" then colors["charSexButtonFérfi"] = tocolor(100, 255, 100, 180); colors["charSexButtonNő"] = tocolor(30, 30, 30, 180); elseif userData[3][4] == "Nő" then colors["charSexButtonNő"] = tocolor(100, 255, 100, 180); colors["charSexButtonFérfi"] = tocolor(30, 30, 30, 180); elseif userData[3][4] == "" then colors["charSexButtonNő"] = tocolor(30, 30, 30, 180); colors["charSexButtonFérfi"] = tocolor(30, 30, 30, 180); end --\\ Férfi gomb dxDrawRectangle(x*(panelPos[1]+0.0125), y*(panelPos[2]+0.23), relX*175, relY*30, colors["charSexButtonFérfi"] ); dxDrawText("Férfi", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.23), x*(panelPos[1]+0.0125)+relX*175, y*(panelPos[2]+0.23)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); --\\ Nő gomb dxDrawRectangle(x*(panelPos[1]+0.0125)+175, y*(panelPos[2]+0.23), relX*175, relY*30, colors["charSexButtonNő"] ); dxDrawText("Nő", x*(panelPos[1]+0.0125)+175, y*(panelPos[2]+0.23), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.23)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); dxDrawRectangle(x*(panelPos[1]+0.0125), y*(panelPos[2]+0.3), relX*350, relY*30, colors["loginButton"] ); dxDrawText("Karakter létrehozása", x*(panelPos[1]+0.0125), y*(panelPos[2]+0.3), x*(panelPos[1]+0.0125)+relX*350, y*(panelPos[2]+0.3)+relY*30, tocolor(255, 255, 255, 255), 1.25, "arial", "center", "center" ); end end end); addEventHandler("onClientClick", root, function(button, state, cX, cY) if showLoginPanel then if button == "left" and state == "down" then if panelState == 1 then if cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.05) and cY < y*(panelPos[2]+0.05)+30 then selectedDataBox[1][1] = true; selectedDataBox[1][2] = false; elseif cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.11) and cY < y*(panelPos[2]+0.11)+30 then selectedDataBox[1][1] = false; selectedDataBox[1][2] = true; end --\\ Gombok if (cX > (x*(panelPos[1]+0.0125)) and cX < (x*(panelPos[1]+0.0125)+175) and cY > (y*(panelPos[2]+0.3)) and cY < (y*(panelPos[2]+0.3)+30)) then execLogin(userData[1][1], hash("sha512", userData[1][2])); elseif (cX > (x*(panelPos[1]+0.0125)+175) and cX < (x*(panelPos[1]+0.0125)+350) and cY > (y*(panelPos[2]+0.3)) and cY < (y*(panelPos[2]+0.3)+30)) then panelState = 3; elseif (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+25 and cY > y*(panelPos[2]+0.25) and cY < y*(panelPos[2]+0.25)+25) then if rememberLogin then rememberLogin = false; else rememberLogin = true; end end elseif panelState == 2 then if (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.05) and cY < y*(panelPos[2]+0.05)+30) then selectedDataBox[2][1] = true; selectedDataBox[2][2] = false; selectedDataBox[2][3] = false; selectedDataBox[2][4] = false; elseif (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.11) and cY < y*(panelPos[2]+0.11)+30) then selectedDataBox[2][1] = false; selectedDataBox[2][2] = true; selectedDataBox[2][3] = false; selectedDataBox[2][4] = false; elseif (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.17) and cY < y*(panelPos[2]+0.17)+30) then selectedDataBox[2][1] = false; selectedDataBox[2][2] = false; selectedDataBox[2][3] = true; selectedDataBox[2][4] = false; elseif (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.23) and cY < y*(panelPos[2]+0.23)+30) then selectedDataBox[2][1] = false; selectedDataBox[2][2] = false; selectedDataBox[2][3] = false; selectedDataBox[2][4] = true; end --\\ Gombok if (cX > (x*(panelPos[1]+0.0125)) and cX < (x*(panelPos[1]+0.0125)+175) and cY > (y*(panelPos[2]+0.3)) and cY < (y*(panelPos[2]+0.3)+30)) then execReg(userData[2][1], hash("sha512", userData[2][2]), hash("sha512", userData[2][3]), userData[2][4]); elseif (cX > (x*(panelPos[1]+0.0125)+175) and cX < (x*(panelPos[1]+0.0125)+350) and cY > (y*(panelPos[2]+0.3)) and cY < (y*(panelPos[2]+0.3)+30)) then panelState = 1; end elseif panelState == 3 then if (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.05) and cY < y*(panelPos[2]+0.05)+30) then selectedDataBox[3][1] = true; selectedDataBox[3][2] = false; selectedDataBox[3][3] = false; elseif (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.11) and cY < y*(panelPos[2]+0.11)+30) then selectedDataBox[3][1] = false; selectedDataBox[3][2] = true; selectedDataBox[3][3] = false; elseif (cX > x*(panelPos[1]+0.0125) and cX < x*(panelPos[1]+0.0125)+350 and cY > y*(panelPos[2]+0.17) and cY < y*(panelPos[2]+0.17)+30) then selectedDataBox[3][1] = false; selectedDataBox[3][2] = false; selectedDataBox[3][3] = true; end --\\ Gombok if (cX > (x*(panelPos[1]+0.0125)) and cX < (x*(panelPos[1]+0.0125)+350) and cY > (y*(panelPos[2]+0.3)) and cY < (y*(panelPos[2]+0.3)+30)) then execCharMaking(userData[3][1], userData[3][2], userData[3][3], userData[3][4]); elseif cX > x*(panelPos[1]+0.0125)+175 and cY > y*(panelPos[2]+0.23) and cX < x*(panelPos[1]+0.0125)+350 and cY < y*(panelPos[2]+0.23)+30 then userData[3][4] = "Nő" elseif cX > x*(panelPos[1]+0.0125) and cY > y*(panelPos[2]+0.23) and cX < x*(panelPos[1]+0.0125)+175 and cY < y*(panelPos[2]+0.23)+30 then userData[3][4] = "Férfi" end end end end end); function writing(char) if showLoginPanel then if char then if panelState == 1 then if selectedDataBox[1][1] then if string.len(userData[1][1]) < 32 then userData[1][1] = userData[1][1]..char; end elseif selectedDataBox[1][2] then if string.len(userData[1][2]) < 32 then userData[1][2] = userData[1][2]..char; end end elseif panelState == 2 then if selectedDataBox[2][1] then if string.len(userData[2][1]) < 32 then userData[2][1] = userData[2][1]..char; end elseif selectedDataBox[2][2] then if string.len(userData[2][2]) < 32 then userData[2][2] = userData[2][2]..char; end elseif selectedDataBox[2][3] then if string.len(userData[2][3]) < 32 then userData[2][3] = userData[2][3]..char; end elseif selectedDataBox[2][4] then if string.len(userData[2][4]) < 32 then userData[2][4] = userData[2][4]..char; end end elseif panelState == 3 then if selectedDataBox[3][1] then if string.len(userData[3][1]) < 32 then userData[3][1] = userData[3][1]..char; end elseif selectedDataBox[3][2] then if string.len(userData[3][2]) < 32 then userData[3][2] = userData[3][2]..char; end elseif selectedDataBox[3][3] then if string.len(userData[3][3]) < 32 then userData[3][3] = userData[3][3]..char; end end end end end end addEventHandler("onClientCharacter", root, writing); function delAndTab(button, pOr) if showLoginPanel then if button == "tab" and pOr == true then if panelState == 1 then if selectedDataBox[1][1] then selectedDataBox[1][1] = false; selectedDataBox[1][2] = true; elseif selectedDataBox[1][2] then selectedDataBox[1][1] = true; selectedDataBox[1][2] = false; end elseif panelState == 2 then if selectedDataBox[2][1] then selectedDataBox[2][1] = false; selectedDataBox[2][2] = true; selectedDataBox[2][3] = false; selectedDataBox[2][4] = false; elseif selectedDataBox[2][2] then selectedDataBox[2][1] = false; selectedDataBox[2][2] = false; selectedDataBox[2][3] = true; selectedDataBox[2][4] = false; elseif selectedDataBox[2][3] then selectedDataBox[2][1] = false; selectedDataBox[2][2] = false; selectedDataBox[2][3] = false; selectedDataBox[2][4] = true; elseif selectedDataBox[2][4] then selectedDataBox[2][1] = true; selectedDataBox[2][2] = false; selectedDataBox[2][3] = false; selectedDataBox[2][4] = false; end elseif panelState == 3 then if selectedDataBox[3][1] then selectedDataBox[3][1] = false; selectedDataBox[3][2] = true; selectedDataBox[3][3] = false; elseif selectedDataBox[3][2] then selectedDataBox[3][1] = false; selectedDataBox[3][2] = false; selectedDataBox[3][3] = true; elseif selectedDataBox[3][3] then selectedDataBox[3][1] = true; selectedDataBox[3][2] = false; selectedDataBox[3][3] = false; end end elseif button == "backspace" and pOr == true then if panelState == 1 then if selectedDataBox[1][1] then userData[1][1] = string.sub(userData[1][1], 0, string.len(userData[1][1])-1); delTimer = setTimer(function() userData[1][1] = string.sub(userData[1][1], 0, string.len(userData[1][1])-1); end, 100, 0); elseif selectedDataBox[1][2] then userData[1][2] = string.sub(userData[1][2], 0, string.len(userData[1][2])-1); delTimer = setTimer(function() userData[1][2] = string.sub(userData[1][2], 0, string.len(userData[1][2])-1); end, 100, 0); end elseif panelState == 2 then if selectedDataBox[2][1] then userData[2][1] = string.sub(userData[2][1], 0, string.len(userData[2][1])-1); delTimer = setTimer(function() userData[2][1] = string.sub(userData[2][1], 0, string.len(userData[2][1])-1); end, 100, 0); elseif selectedDataBox[2][2] then userData[2][2] = string.sub(userData[2][2], 0, string.len(userData[2][2])-1); delTimer = setTimer(function() userData[2][2] = string.sub(userData[2][2], 0, string.len(userData[2][2])-1); end, 100, 0); elseif selectedDataBox[2][3] then userData[2][3] = string.sub(userData[2][3], 0, string.len(userData[2][3])-1); delTimer = setTimer(function() userData[2][3] = string.sub(userData[2][3], 0, string.len(userData[2][3])-1); end, 100, 0); elseif selectedDataBox[2][4] then userData[2][4] = string.sub(userData[2][4], 0, string.len(userData[2][4])-1); delTimer = setTimer(function() userData[2][4] = string.sub(userData[2][4], 0, string.len(userData[2][4])-1); end, 100, 0); end elseif panelState == 3 then if selectedDataBox[3][1] then userData[3][1] = string.sub(userData[3][1], 0, string.len(userData[3][1])-1); delTimer = setTimer(function() userData[3][1] = string.sub(userData[3][1], 0, string.len(userData[3][1])-1); end, 100, 0); elseif selectedDataBox[3][2] then userData[3][2] = string.sub(userData[3][2], 0, string.len(userData[3][2])-1); delTimer = setTimer(function() userData[3][2] = string.sub(userData[3][2], 0, string.len(userData[3][2])-1); end, 100, 0); elseif selectedDataBox[3][3] then userData[3][3] = string.sub(userData[3][3], 0, string.len(userData[3][3])-1); delTimer = setTimer(function() userData[3][3] = string.sub(userData[3][3], 0, string.len(userData[3][3])-1); end, 100, 0); end end elseif button == "backspace" and pOr == false then killTimer(delTimer); elseif button == "enter" and pOr then if panelState == 1 then execLogin(userData[1][1], hash("sha512", userData[1][2])); elseif panelState == 2 then execReg(userData[2][1], hash("sha512", userData[2][2]), hash("sha512", userData[2][3]), userData[2][4]); elseif panelState == 3 then execCharMaking(userData[3][1], userData[3][2], userData[3][3], userData[3][4]); end end end end addEventHandler("onClientKey", root, delAndTab); function execLogin(username, password) if string.len(userData[1][1]) >= 3 then if string.len(userData[1][2]) >= 3 then triggerServerEvent("execLogin", root, username, password); else notify("Rövid jelszó!", 1); end else notify("Rövid felhasználónév", 1); end end function execReg(username, password, password2, email) if string.len(userData[2][1]) >= 3 then if string.len(userData[2][2]) >= 3 then if string.len(userData[2][3]) >= 3 then if string.len(userData[2][4]) >= 6 then triggerServerEvent("execReg", root, username, password, password2, email); else notify("Rövid az email!", 1); end else notify("Rövid a második jelszó!", 1); end else notify("Rövid a jelszó!", 1); end else notify("Rövid a felhasználónév!", 1); end end function execCharMaking(charName, charLeiras, charAge, charNem) if string.len(userData[3][1]) >= 6 then if string.len(userData[3][2]) >= 6 then if string.len(userData[3][3]) >= 1 and string.len(userData[3][3]) <= 99 then if userData[3][4] then triggerServerEvent("execReg", root, charName, charLeiras, charAge, charNem); else notify("Válaszd ki a karaktered nemét!", 1); end else notify("Adj meg egy érvényes életkort a karatkerednek!", 1); end else notify("Rövid a karakterleírás!", 1); end else notify("Rövid a karakternév!", 1); end end function notify(mssg, msgType) local msgTypeColor = { [1] = tocolor(255, 100, 100, 180); [2] = tocolor(100, 255, 100, 180); }; if showLoginPanel then msg = {mssg, tonumber(msgType)}; outputConsole(mssg); end end addEventHandler("notify", root, notify); addEvent("notify", true); Szerver oldal: local con = exports.ly_connect:getConnection(); function isPlayerBanned(player) if player then local serial = getPlayerSerial(player); local qh = dbQuery(con, "SELECT * FROM bans WHERE bannedSerial=? AND bannedUntil > CURRENT_TIME()", serial); local bans = dbPoll(qh, 1000); outputDebugString(#bans); if bans then if (#bans > 0) then return true; else return false; end else return false; end else return false; end end function execServerLog(username, password) outputChatBox("1") if not isPlayerBanned() then local serial = getPlayerSerial(client); local qh = dbQuery("SELECT * FROM accounts WHERE serial=?", serial); local user = dbPoll(qh, 500); if user then if #user > 0 then if user[1]["password"] == password then setElementData(client, "acc:id", user[1]["id"]); triggerClientEvent(client, "notify", root, "Sikeres bejelentkezés!", 2); spawnPlayer(0, 0, 4, 29); setCameraTarget(client, client); fadeCamera(client); else triggerClientEvent(client, "notify", root, "Nem egyezik a jelszó!", 1); end else triggerClientEvent(client, "notify", root, "Nincs létrehozva felhasználó!", 1); end else triggerClientEvent(client, "notify", root, "Ismeretlen hiba!", 1); end else outputChatBox("1") triggerClientEvent(client, "notify", root, "Bannolva vagy! Keress fel egy szuperadmint/fejlesztőt!", 1); end end addEventHandler("execLogin", root, execServerLog); addEvent("execLogin", true); function execServerReg(username, password, password2, email) if not isPlayerBanned() then local serial = getPlayerSerial(client); local qh = dbQuery("SELECT * FROM accounts WHERE serial=? OR username=? OR email=?", serial, username, email); local user = dbPoll(qh, 500); if user then if not #user > 0 then dbExec("INSERT INTO accounts SET username=?, password=?, email=?", username, password, email); triggerClientEvent(client, "notify", root, "Sikeresen létrehoztad a fiókodat!", 2); else triggerClientEvent(client, "notify", root, "Létezik felhasználó a te serialodon!", 1); end else triggerClientEvent(client, "notify", root, "Ismeretlen hiba!", 1); end else triggerClientEvent(client, "notify", root, "Bannolva vagy! Keress fel egy szuperadmint/fejlesztőt!", 1); end end addEventHandler("execReg", root, execServerReg); addEvent("execReg", true); function execCharMaking(charName, charLeiras, charAge, charNem) if not isPlayerBanned() then local serial = getPlayerSerial(client); local qh = dbQuery("SELECT * FROM accounts WHERE serial=? OR charName=?", serial, charName); local user = dbPoll(qh, 500); if user then if not #user > 0 then dbExec("INSERT INTO accounts SET charName=?, charLeiras=?, charSex=?", charName, charLeiras, charAge, charNem); triggerClientEvent(client, "notify", root, "Sikeres karakter létrehozás!", 2); else triggerClientEvent(client, "notify", root, "A karakternév foglalt!", 1); end else triggerClientEvent(client, "notify", root, "Ismeretlen hiba!", 1); end else triggerClientEvent(client, "notify", root, "Bannolva vagy! Keress fel egy szuparadmint/fejlesztőt!", 1); end end addEventHandler("execCharMake", root, execCharMaking); addEvent("execCharMake", true); Link to comment
Flashmyname Posted March 25, 2022 Share Posted March 25, 2022 Cső, megpróbálnék segíteni a problémádon, nem igérek semmit csak tapasztalatból próbálkoznék neked segíteni, első kérdésem az lenne hogy aktuális-e még a dolog? - a második kérdés pedig ha igen, akkor hogy amikor rákattintasz mondjuk a karakter létrehozás/login/reg gombokra, akkor reagál-e a rendszer arra hogy ezek közül valamelyiket végrehajtottad? - itt például az output-ra gondolok hogy "Sikeresen létrehoztad a karaktered" etc.. (ha ott akad el hogy ki sem adja, akkor a mentéssel lesz a gond és nem lép tovább a script, próbáld ellenőrizni hogy rendesen van-e összekötve sql-el) illetve hogy debugscripted ír-e ki hibát amennyiben ezt megteszed. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now