Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sx, sy = guiGetScreenSize()
- local currentPanel = nil
- local loginEdits = false
- local loginNevActive = false
- local loginNevTime = 0
- local loginJelszoActive = false
- local loginJelszoTime = 0
- local currentNem = 0
- local characterEdits = false
- local tableAccounts = nil
- local font = dxCreateFont("files/font.ttf", 10)
- local font2 = dxCreateFont("files/font.ttf", 20)
- login = playSound( "files/login.mp3", true)
- local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted", "radar" }
- local created = false
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),function()
- triggerServerEvent("join",localPlayer)
- end
- )
- addEvent("startlogin",true)
- addEventHandler("startlogin",root, function()
- setPlayerHudComponentVisible("all", false )
- setCameraMatrix(2098.5517578125, 1285.4072265625, 71.978401184082, 2173.1533203125, 1285.568359375, 27.976778030396)
- currentPanel = "playerLogin"
- showCursor(true)
- showChat(false)
- fadeCamera(true)
- executeCommandHandler("togradar", playerSource)
- executeCommandHandler("toghud", playerSource)
- executeCommandHandler("togooc", playerSource)
- guiSetInputMode("no_binds_when_editing")
- end)
- function render ()
- if currentPanel == "playerLogin" then
- --dxDrawText("#e64343once#ffffffMTA", sx/2 - 275/2 + 275, sy/2 - 350/2 - 50, sx/2 - 275/2, sy/2 - 350/2, tocolor(255, 255, 255, 255), 1, font2, "center", "center", false, false, false, true)
- --dxDrawText("#FFFFFF2#e64343k#ffffff17", sx/2 - 275/2 + 275, sy/2 - 350/2 - 200, sx/2 - 275/2, sy/2 - 350/2, tocolor(255, 255, 255, 255), 1, font2, "center", "center", false, false, false, true)
- dxDrawRectangle(sx/2 - 250, sy/2 - 200, 500, 45,tocolor(0,0,0,50))
- dxDrawRectangle(sx/2 - 245, sy/2 - 195, 490, 35,tocolor(0,0,0,130))
- dxDrawImage(sx/2 - 235, sy/2 - 200, 500, 45, "/files/loginimage.png")
- dxDrawRectangle(sx/2 - 250, sy/2 - 145, 500, 300,tocolor(0,0,0,50))
- dxDrawRectangle(sx/2 - 245, sy/2 - 140, 490, 290, tocolor(0,0,0,130))
- dxDrawText("Üdvözlünk a szerveren! Kellemes időtöltést kívánunk a szerverünkön. ;)", sx/2 - 10/2 + 2 + 110 - 4, sy/2 - 300, sx/2 - 200/2 + 2, sy/2 + 50 + 2, tocolor(255,255, 255, 255), 1, "default-bold", "center", "center", false, false, false, true)
- dxDrawText("#e64343Figyelem!! #FFFFFFA szerverre történő regisztrációval elfogadod a szerver szabályzatát.", sx/2 - 10/2 + 2 + 110 - 4, sy/2 + 200, sx/2 - 200/2 + 2, sy/2 + 50 + 2, tocolor(255, 255, 255, 255), 1, "default-bold", "center", "center", false, false, false, true)
- dxDrawImage(sx/2 - 140, sy/2 - 100, 30, 30, "/files/user.png")
- dxDrawImage(sx/2 - 140, sy/2 - 45, 30, 30, "/files/pass.png")
- if not loginEdits then
- loginEdits = true
- loginNev = guiCreateEdit(sx/2 - 200/2, sy/2 - 350/2 + 75, 200, 30, "", true)
- loginJelszo = guiCreateEdit(sx/2 - 200/2, sy/2 - 350/2 + 130, 200, 30, "", true)
- guiEditSetMaxLength(loginNev, 15)
- guiEditSetMaxLength(loginJelszo, 20)
- end
- local accountNameText = guiGetText(loginNev)
- local accountPassText = guiGetText(loginJelszo)
- if accountNameText == "" then
- accountNameText = "Felhasználónév"
- end
- local username = ""
- local password = ""
- local password2 = ""
- for i = 1, string.len(accountPassText) do
- password = password .. "•"
- end
- if password == "" then
- password = "Jelszó"
- end
- if loginNevActive then
- loginNevTime = loginNevTime + 1
- if loginNevTime >= 100 and loginNevTime < 200 then
- username = "#FFFFFF|"
- elseif loginNevTime == 200 then
- loginNevTime = 0
- elseif loginNevTime == 0 then
- username = ""
- end
- end
- if loginJelszoActive then
- loginJelszoTime = loginJelszoTime + 1
- if loginJelszoTime >= 100 and loginJelszoTime < 200 then
- password2 = "#FFFFFF|"
- elseif loginJelszoTime == 200 then
- loginJelszoTime = 0
- elseif loginJelszoTime == 0 then
- password2 = ""
- end
- end
- local loginGomb = 0
- local regisztracioGomb = 0
- if isCursorInRectangle(sx/2 - 200/2, sy/2 + 50, 95, 30) then
- loginGomb = 150
- elseif isCursorInRectangle(sx/2 - 200/2, sy/2 + 50, 210, 30) then
- regisztracioGomb = 150
- end
- dxDrawRectangle(sx/2 - 200/2, sy/2 - 350/2 + 75, 200, 30, tocolor(120, 120, 120, 50))
- dxDrawText(accountNameText, sx/2 - 200/2 + 5, sy/2 - 350/2 + 75 + 7, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top")
- dxDrawText(username, sx/2 - 200/2 + 5 + dxGetTextWidth(accountNameText, 1, font), sy/2 - 350/2 + 75 + 7, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top", false, false, false, true)
- dxDrawRectangle(sx/2 - 200/2, sy/2 - 350/2 + 130, 200, 30, tocolor(120, 120, 120, 50))
- dxDrawText(password, sx/2 - 200/2 + 5, sy/2 - 350/2 + 130 + 7, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top")
- dxDrawText(password2, sx/2 - 200/2 + 5 + dxGetTextWidth(password, 1, font), sy/2 - 350/2 + 130 + 7, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top", false, false, false, true)
- dxDrawRectangle(sx/2 - 200/2, sy/2 + 50, 95, 30, tocolor(120, 120, 120, 50))
- dxDrawRectangle(sx/2 - 200/2 + 2, sy/2 + 50 + 2, 95 - 4, 30 - 4, tocolor(230, 67, 67, loginGomb))
- dxDrawText("Bejelentkezés", sx/2 - 200/2 + 2 + 95 - 4, sy/2 + 50 + 2 + 30 - 4, sx/2 - 200/2 + 2, sy/2 + 50 + 2, tocolor(255, 255, 255, 255), 1, font, "center", "center", false, false, false, true)
- dxDrawRectangle(sx/2 - -10/2, sy/2 + 50, 95, 30, tocolor(120, 120, 120, 50))
- dxDrawRectangle(sx/2 - -10/2 + 2, sy/2 + 50 + 2, 95 - 4, 30 - 4, tocolor(230, 67, 67, regisztracioGomb))
- dxDrawText("Regisztráció", sx/2 - 10/2 + 2 + 210 - 4, sy/2 + 50 + 2 + 30 - 4, sx/2 - 200/2 + 2, sy/2 + 50 + 2, tocolor(255, 255, 255, 255), 1, font, "center", "center", false, false, false, true)
- elseif currentPanel == "characterCreate" then
- if not characterEdits then
- characterEdits = true
- charName = guiCreateEdit(30, sy/2 - 400/2 + 25, 315, 30, "", false)
- charKor = guiCreateEdit(30, sy/2 - 400/2 + 80, 315, 30, "", false)
- charSuly = guiCreateEdit(30, sy/2 - 400/2 + 135, 315, 30, "", false)
- charMagassag = guiCreateEdit(30, sy/2 - 10, 315, 30, "", false)
- guiEditSetMaxLength(charName, 36)
- guiEditSetMaxLength(charKor, 2)
- guiEditSetMaxLength(charSuly, 2)
- guiEditSetMaxLength(charMagassag, 3)
- guiSetAlpha(charName, 0)
- guiSetAlpha(charKor, 0)
- guiSetAlpha(charSuly, 0)
- guiSetAlpha(charMagassag, 0)
- end
- local nameText = guiGetText(charName)
- local korText = guiGetText(charKor)
- local sulyText = guiGetText(charSuly)
- local magassagText = guiGetText(charMagassag)
- local ferfiAlpha = 0
- local noAlpha = 0
- if isCursorInRectangle(30 + 2, sy/2 + 45 + 2, 145 - 4, 30 - 4) then
- ferfiAlpha = 150
- elseif isCursorInRectangle(200 + 2, sy/2 + 45 + 2, 145 - 4, 30 - 4) then
- noAlpha = 150
- end
- if currentNem == 0 then
- ferfiAlpha = 150
- else
- noAlpha = 150
- end
- dxDrawRectangle(25, sy/2 - 380/2, 325, 220, tocolor(0, 0, 0, 120))
- dxDrawRectangle(30, sy/2 - 400/2 + 25, 315, 30, tocolor(0, 0, 0, 150)) -- NÉV
- dxDrawText("Név", 30, sy/2 - 400/2 + 10, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top")
- dxDrawText(nameText, 30 + 5, sy/2 - 400/2 + 25 + 9, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top")
- dxDrawRectangle(30, sy/2 - 400/2 + 80, 315, 30, tocolor(0, 0, 0, 150)) -- KOR
- dxDrawText("Kor", 30, sy/2 - 400/2 + 65, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top")
- dxDrawText(korText, 30 + 5, sy/2 - 400/2 + 80 + 9, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top")
- dxDrawRectangle(30, sy/2 - 400/2 + 135, 315, 30, tocolor(0, 0, 0, 150)) -- SÚLY
- dxDrawText("Súly", 30, sy/2 - 400/2 + 120, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top")
- dxDrawText(sulyText, 30 + 5, sy/2 - 400/2 + 135 + 9, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top")
- dxDrawRectangle(30, sy/2 - 10, 315, 30, tocolor(0, 0, 0, 150)) -- MAGASSÁG
- dxDrawText("Magasság", 30, sy/2 - 25, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top")
- dxDrawText(magassagText, 30 + 5, sy/2 - 10 + 9, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top")
- dxDrawRectangle(30, sy/2 + 45, 145, 30, tocolor(0, 0, 0, 150)) -- FÉRFI
- dxDrawRectangle(30 + 2, sy/2 + 45 + 2, 145 - 4, 30 - 4, tocolor(230, 67, 67, ferfiAlpha))
- dxDrawText("Férfi", 30 + 2 + 145 - 4, sy/2 + 45 + 2 + 30 - 4, 30 + 2, sy/2 + 45 + 2, tocolor(255, 255, 255, 255), 1, font, "center", "center")
- dxDrawRectangle(200, sy/2 + 45, 145, 30, tocolor(0, 0, 0, 150)) -- NŐ
- dxDrawRectangle(200 + 2, sy/2 + 45 + 2, 145 - 4, 30 - 4, tocolor(230, 67, 67, noAlpha))
- dxDrawText("Nő", 200 + 2 + 145 - 4, sy/2 + 45 + 2 + 30 - 4, 200 + 2, sy/2 + 45 + 2, tocolor(255, 255, 255, 255), 1, font, "center", "center")
- dxDrawRectangle(115, sy/2 + 85, 146, 32, tocolor(0, 0, 0, 150)) -- Gomb
- dxDrawRectangle(115, sy/2 + 85, 145, 30, tocolor(230, 67, 67, 150)) -- Gomb
- dxDrawText("Létrehozás", 25 + 325, sy/2 - 400/2 + 600, 25, sy/2 - 400/2, tocolor(255, 255, 255, 255), 1, font, "center", "center")
- elseif currentPanel == "characterPanel" then
- if created == true then
- dxDrawRectangle(25, sy/2 - 400/2, 325, 200, tocolor(0, 0, 0, 150))
- dxDrawRectangle(25 + 2, sy/2 - 400/2 + 2, 325 - 4, 26 - 4, tocolor(0, 0, 0, 150))
- local charname = characterdeatil[1]:gsub("_"," ")
- --local cked =
- --local area =
- local age = characterdeatil[2]
- local gender = characterdeatil[3]
- --local factionName =
- --local factionRank =
- local skinID = characterdeatil[4]
- --local difference =
- if gender == 0 then
- gender = "Férfi"
- else
- gender = "Nő"
- end
- dxDrawText(charname, 25 + 325, sy/2 - 400/2 + 26, 25, sy/2 - 400/2, tocolor(255, 255, 255, 255), 1, font, "center", "center")
- --dxDrawText("Tartózkodási hely:#e64343 " .. area, 30, sy/2 - 170, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top", false, false, false, true)
- dxDrawText("Kor:#e64343 " .. age .. " éves", 30, sy/2 - 150, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top", false, false, false, true)
- dxDrawText("Nem:#e64343 " .. gender, 30, sy/2 - 130, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top", false, false, false, true)
- --dxDrawText("Szervezet:#e64343 " .. factionName, 30, sy/2 - 110, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top", false, false, false, true)
- --dxDrawText("Szervezetbeli rang:#e64343 " .. factionRank, 30, sy/2 - 90, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top", false, false, false, true)
- dxDrawText("Skin:#e64343 " .. skinID, 30, sy/2 - 70, 0, 0, tocolor(255, 255, 255, 255), 1, font, "left", "top", false, false, false, true)
- dxDrawRectangle(25, sy/1.99, 325, 26 - 4, tocolor(230, 67, 67, 150))
- dxDrawText("Belépéshez kattints ide!" ,25 + 325, sy/2 - 400/2 + 430, 25, sy/2 - 400/2, tocolor(255, 255, 255, 255), 1, font, "center", "center")
- else
- dxDrawRectangle(25, sy/2 - 225/2, 225, 225, tocolor(0, 0, 0, 150))
- local letrehozasAlpha = 0
- if isCursorInRectangle(25 + 15 + 2, sy/2 - 30/2 + 2, 200 - 4, 30 - 4) then
- letrehozasAlpha = 150
- end
- dxDrawRectangle(25 + 15, sy/2 - 400/2 + 100, 200, 30, tocolor(0, 0, 0, 150))
- dxDrawText("Jelenleg nincs karaktered!", 25 + 15 + 200, sy/2 - 400/2 + 100 + 30, 25 + 15, sy/2 - 400/2 + 100, tocolor(255, 255, 255, 255), 1, font, "center", "center")
- dxDrawRectangle(25 + 15, sy/2 - 30/2, 200, 30, tocolor(0, 0, 0, 150))
- dxDrawRectangle(25 + 15 + 2, sy/2 - 30/2 + 2, 200 - 4, 30 - 4, tocolor(230, 67, 67, letrehozasAlpha))
- dxDrawText("Létrehozás", 25 + 15 + 2 + 200 - 4, sy/2 - 30/2 + 2 + 30 - 4, 25 + 15 + 2, sy/2 - 30/2 + 2, tocolor(255, 255, 255, 255), 1, font, "center", "center")
- end
- end
- end
- addEventHandler("onClientRender", root, render)
- addEvent("showCharacterUI", true)
- addEventHandler("showCharacterUI", root, function()
- currentPanel = "characterPanel"
- setCameraInterior(1)
- setCameraMatrix(2.8955078125, 29.984375, 1199.778125, 2.439453125, 29.501953125, 1199.6011962891)
- toggleAllControls(false, true, false)
- local width, height = 420, 400
- triggerServerEvent("reganim",localPlayer)
- end)
- addEvent("showCharacter", true)
- addEventHandler("showCharacter", root, function(input)
- currentPanel = "characterPanel"
- created = true
- characterdeatil = input
- end)
- addEvent("hideCharacterUI", true)
- addEventHandler("hideCharacterUI", root, function()
- removeEventHandler("onClientRender", getRootElement(), render)
- removeEventHandler("onClientRender", root, click)
- showCursor(false)
- showChat(true)
- toggleAllControls(true)
- stopSound(login)
- end)
- addEventHandler("onClientKey", root, function(g, s)
- if currentPanel == "playerLogin" then
- if g == "tab" and s then
- if loginNevActive then
- loginNevActive = false
- loginJelszoActive = true
- loginJelszoTime = 0
- elseif loginJelszoActive then
- loginJelszoActive = false
- loginNevActive = true
- loginNevTime = 0
- end
- end
- end
- end)
- function click (g, s, x, y)
- if g == "left" and s == "down" then
- if currentPanel == "playerLogin" then
- if inBox(sx/2 - 200/2, sy/2 - 350/2 + 75, 200, 30, x, y) then
- if loginJelszoActive then loginJelszoActive = false end
- loginNevActive = true
- loginNevTime = 0
- if guiEditSetCaretIndex(loginNev, string.len(guiGetText(loginNev))) then
- guiBringToFront(loginNev)
- end
- elseif inBox(sx/2 - 200/2, sy/2 - 350/2 + 130, 200, 30, x, y) then
- if loginNevActive then loginNevActive = false end
- loginJelszoActive = true
- loginJelszoTime = 0
- if guiEditSetCaretIndex(loginJelszo, string.len(guiGetText(loginJelszo))) then
- guiBringToFront(loginJelszo)
- end
- elseif not inBox(sx/2 - 200/2, sy/2 - 350/2 + 75, 200, 30, x, y) or not inBox(sx/2 - 200/2, sy/2 - 350/2 + 130, 200, 30, x, y) then
- if loginNevActive then loginNevActive = false end
- if loginJelszoActive then loginJelszoActive = false end
- end
- if inBox(sx/2 - 200/2 + 2, sy/2 + 50 + 2, 95 - 4, 30 - 4, x, y) then
- --outputChatBox("login")
- local accountNameText = guiGetText(loginNev)
- local accountPassText = guiGetText(loginJelszo)
- if string.len(accountNameText) >= 3 and string.len(accountPassText) >= 6 then
- triggerServerEvent("login", localPlayer, localPlayer, accountNameText, accountPassText)
- end
- end
- if inBox(sx/2 - -10/2 + 2, sy/2 + 50 + 2, 210 - 4, 30 - 4, x, y) then
- --outputChatBox("register")
- local accountNameText = guiGetText(loginNev)
- local accountPassText = guiGetText(loginJelszo)
- if string.len(accountNameText) >= 3 and string.len(accountPassText) >= 6 then
- triggerServerEvent("register", localPlayer, localPlayer, accountNameText, accountPassText)
- end
- end
- elseif currentPanel == "characterPanel" then
- if created == true then
- if inBox(25, sy/1.99, 325 - 4, 26 - 4, x, y) then
- showCursor(false)
- executeCommandHandler ( "togradar", playerSource )
- executeCommandHandler ( "toghud", playerSource )
- executeCommandHandler ( "togooc", playerSource )
- stopSound(login)
- showChat(true)
- triggerServerEvent("logincar", localPlayer)
- end
- else
- if inBox(25 + 15 + 2, sy/2 - 30/2 + 2, 200 - 4, 30 - 4, x, y) then
- currentPanel = "characterCreate"
- end
- end
- elseif currentPanel == "characterCreate" then
- if inBox(30 + 2, sy/2 + 45 + 2, 145 - 4, 30 - 4, x, y) then
- currentNem = 0
- setElementModel(localPlayer, 0)
- triggerServerEvent("reganim",localPlayer)
- elseif inBox(200 + 2, sy/2 + 45 + 2, 145 - 4, 30 - 4, x, y) then
- currentNem = 1
- setElementModel(localPlayer, 56)
- triggerServerEvent("reganim",localPlayer)
- end
- if inBox(250/2 - 15, sy/2 + 200/2 - 13, dxGetTextWidth("Létrehozáshoz kattints ide!", 1, font) + 20, 26, x, y) then
- --outputChatBox("Létrehozás")
- local nameText = guiGetText(charName)
- local korText = guiGetText(charKor)
- local sulyText = guiGetText(charSuly)
- showChat(false)
- local magassagText = guiGetText(charMagassag)
- triggerServerEvent("registercar", localPlayer, nameText, currentNem, sulyText, magassagText, korText, getElementModel(localPlayer))
- end
- end
- end
- end
- addEventHandler("onClientClick", root, click)
- function inBox(dX, dY, dSZ, dM, eX, eY)
- if( eX >= dX and eX <= dX + dSZ and eY >= dY and eY <= dY + dM ) then
- return true
- else
- return false
- end
- end
- function isCursorInRectangle(x,y,w,h)
- if isCursorShowing() then
- local mx,my = getCursorPosition()
- local cursorx,cursory = mx*sx,my*sy
- if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
- return true
- else
- return false
- end
- end
- end
- addCommandHandler("poss", function()
- local x, y, z, x2, y2, z2 = getCameraMatrix()
- outputChatBox(x .. ", " .. y .. ", " .. z .. ", " .. x2 .. ", " .. y2 .. ", " .. z2)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement