local x, y = guiGetScreenSize ( )
local sx, sy = 1024, 768 --- غيير الارقام الى مقاس شاشتك
function loginPanel()
-- Check if autologin is enabled - If yes, then log the player in, else create and show the userpanel
local xmlFile = xmlLoadFile(xmlFileName)
if xmlFile then
status = xmlNodeGetAttribute(xmlFile,"autologin")
if (status == "true") then
local username = tostring(xmlNodeGetAttribute(xmlFile,"username"))
local password = tostring(xmlNodeGetAttribute(xmlFile,"password"))
if not (username == "") and not (password == "") then
triggerServerEvent("onRequestAutologin",getLocalPlayer(),username,password)
triggerServerEvent("automsave", getLocalPlayer())
end
else
if blackLoginScreen == true then
fadeCamera(false,363.19458007813, -1989.0324707031, 21.265274047852, 31.334917297363)
end
addEvent("onRequestIncreaseAttempts",true)
addEvent("onRequestDisplayPanel",true)
function randomimages()
return unpack(loginImages[math.random(#loginImages)])
end
mainWindow = guiCreateStaticImage( x * ( 0 / sx ), y * ( 0 / sy ), x * ( 1920 / sx ), y * ( 1200 / sy ), "ana/1.jpg", false, mainWindow)
guiWindowSetSizable(mainWindow, false)
local x, y = guiGetScreenSize()
local rx, ry = (x/1440), (y/900)
addEventHandler("onClientRender", root,
function()
dxDrawRectangle (rx*8,ry*2,rx*10,rx*5)
end)
btnLogin = guiCreateStaticImage( x * ( 189 / sx ), y * ( 500 / sy ), x * ( 420 / sx ), y * ( 60 / sy ), "ana/5.jpg", false, mainWindow)
Nameplayer = guiCreateLabel( x * ( 700 / sx ), y * ( 150 / sy ), x * ( 400 / sx ), y * ( 500 / sy ), "Welcome Mr \ Ms ", false, mainWindow)
guiSetFont(Nameplayer, "default-bold-small")
guiLabelSetColor(Nameplayer, 0, 0, 0)
guiSetFont(Nameplayer, "default-bold-small")
function changeLabelColor ( )
guiLabelSetColor ( Nameplayer, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
end
setTimer ( changeLabelColor, 300, 0 )
btnToggleRegister = guiCreateStaticImage( x * ( 700 / sx ), y * ( 226 / sy ), x * ( 400 / sx ), y * ( 60 / sy ), "ana/6.jpg", false, mainWindow)
editUsername = guiCreateEdit( x * ( 210 / sx ), y * ( 330 / sy ), x * ( 143 / sx ), y * ( 28 / sy ), "", false, mainWindow)
editPassword = guiCreateEdit( x * ( 465 / sx ), y * ( 330 / sy ), x * ( 143 / sx ), y * ( 28 / sy ), "", false, mainWindow)
guiEditSetMasked(editPassword, true)
registerWindow = guiCreateWindow( x * ( 880 / sx ), y * ( 216 / sy ), x * ( 320 / sx ), y * ( 269 / sy ), "Register Panel", false)
centerTheGUI(registerWindow)
guiWindowSetSizable(registerWindow, false)
guiSetAlpha(registerWindow, 1.00)
editRegistrationUsername = guiCreateEdit( x * ( 69 / sx ), y * ( 43 / sy ), x * ( 182 / sx ), y * ( 25 / sy ), "", false, registerWindow)
editRegistrationPassword = guiCreateEdit( x * ( 69 / sx ), y * ( 83 / sy ), x * ( 182 / sx ), y * ( 25 / sy ), "", false, registerWindow)
guiEditSetMasked(editRegistrationPassword, true)
lblRUsername = guiCreateLabel( x * ( 14 / sx ), y * ( 49 / sy ), x * ( 59 / sx ), y * ( 19 / sy ), "UserName", false, registerWindow)
lblRPassword = guiCreateLabel( x * ( 14 / sx ), y * ( 89 / sy ), x * ( 59 / sx ), y * ( 19 / sy ), "Password", false, registerWindow)
btnConfirmRegistration = guiCreateButton( x * ( 63 / sx ), y * ( 157 / sy ), x * ( 191 / sx ), y * ( 30 / sy ), "Register", false, registerWindow)
guiSetProperty(btnConfirmRegistration, "NormalTextColour", "FFAAAAAA")
editRegistrationRepeatPassword = guiCreateEdit( x * ( 68 / sx ), y * ( 122 / sy ), x * ( 182 / sx ), y * ( 25 / sy ), "", false, registerWindow)
guiEditSetMasked(editRegistrationRepeatPassword, true)
lblRepeatPassword = guiCreateLabel ( x * ( 14 / sx ), y * ( 128 / sy ), x * ( 59 / sx ), y * ( 19 / sy ), "Password", false, registerWindow)
btnCancel = guiCreateButton ( x * ( 63 / sx ), y * ( 197 / sy ), x * ( , "Cancel", false, registerWindow)
guiSetProperty(btnCancel, "NormalTextColour", "FFAAAAAA")
guiSetVisible(mainWindow, true)
guiSetVisible(mInfo, false)
guiSetVisible(registerWindow, false)
guiSetInputEnabled(true)
showCursor(true)
addEventHandler("onClientGUIClick",btnLogin,onClickLogin)
addEventHandler("onClientGUIClick",btnToggleRegister,onClickRegisterToggle)
addEventHandler("onClientGUIClick",btnPlayAsGuest,onClickGuest)
addEventHandler("onClientGUIClick",btnConfirmRegistration,onClickRegisterConfirm)
addEventHandler("onClientGUIClick",btnCancel,onClickCancel)
addEventHandler("onRequestIncreaseAttempts",getRootElement(),increaseAttempts)
attemptedLogins = 0
end
xmlUnloadFile(xmlFile)
else
xmlFileHandler(true)
end
addEventHandler("onRequestDisplayPanel",getRootElement(),logoutHandler)
end