Jump to content

ارجو مساعدتي في هذا المود ..


Recommended Posts

اخواني لقد صنعت لوحة تسجيل

من الأخير ~

اخواني اللوحة ما اشتغلت

ومدري شصار فيها اذا تسمحون تعدلون الي الكودات يمكن ؟

الكلنت

fadeCamera(true, 6, 0, 0, 0) 
setCameraMatrix(-1475.5, 831.18, 65.5, -1487.5, 800.18, 65.5)
----------------------------------
-----------| Settings |-----------
----------------------------------
 
 
 
enableKickPlayer = true         -- Set whether to kick the player after they fail to login specified amount of times.
 
disallowLogout = false          -- Set whether to show the userpanel to the players if they log out of their accounts.
 
maxLoginAttempts = 5            -- Set the maximum incorrect login attempts before the player gets kicked - If player kicking is enabled.
 
----------------------------------
 
 
 
-- Set the text you want displayed in the "rules" window here - use '\n' to go into the next line
infoText = "------ Rules ------ \n\n* No cheating!\n* No insulting and spamming!\n* No vehicle mods\n\nEdit the text however you like\n\n\n\n\n\n\n\nLogin panel by BiG,BoSs"
 
 
 
-- Screen and GUI window sizes
screenWidth,screenHeight = guiGetScreenSize()
mainWidth,mainHeight = 749,472
regWidth,regHeight = 439,344
 
 
-- Generate the XML file name
function getServerName()
    triggerServerEvent("onClientLoginLoaded",getLocalPlayer())
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),getServerName)
 
function setXmlFileName(sName)
    xmlFileName = tostring("login_"..sName..".xml")
    loginPanel()
end
addEvent("onGetServerData",true)
addEventHandler("onGetServerData",getRootElement(),setXmlFileName)
 
 
 
 
 
----------------------------------
 
addEvent("onRequestIncreaseAttempts",true)
addEvent("onRequestDisplayPanel",true)
 
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)
                end
            else
                if blackLoginScreen == true then
                    fadeCamera(false,0,0,0,0)
                end
 
 
 
 
GUIEditor = {
    button = {},
    staticimage = {},
    label = {},
    memo = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        login = guiCreateWindow(143, 114, 467, 372, "login-Panel By #BiG,BoSs~", false)
        guiWindowSetSizable(login, false)
 
        GUIEditor.staticimage[1] = guiCreateStaticImage(9, 19, 448, 343, ":login-panel/images/SoftWaves.png", false, login)
 
        GUIEditor.memo[1] = guiCreateMemo(224, 127, 220, 32, "", false, GUIEditor.staticimage[1])
        GUIEditor.memo[2] = guiCreateMemo(223, 170, 221, 31, "", false, GUIEditor.staticimage[1])
        GUIEditor.button[1] = guiCreateButton(227, 230, 211, 86, "Login", false, GUIEditor.staticimage[1])
        guiSetFont(GUIEditor.button[1], "sa-header")
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF51ADAC")
        GUIEditor.button[2] = guiCreateButton(10, 230, 213, 86, "Register ", false, GUIEditor.staticimage[1])
        guiSetFont(GUIEditor.button[2], "sa-header")
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FEEFE707")
        GUIEditor.label[1] = guiCreateLabel(10, 125, 211, 35, "USERNAME :~", false, GUIEditor.staticimage[1])
        guiSetFont(GUIEditor.label[1], "sa-header")
        guiLabelSetColor(GUIEditor.label[1], 0, 0, 0)
        guiLabelSetHorizontalAlign(GUIEditor.label[1], "right", false)
        GUIEditor.label[2] = guiCreateLabel(10, 170, 211, 31, "PASSWORD :~", false, GUIEditor.staticimage[1])
        guiSetFont(GUIEditor.label[2], "sa-header")
        guiLabelSetColor(GUIEditor.label[2], 0, 0, 0)
        guiLabelSetHorizontalAlign(GUIEditor.label[2], "right", false)    
    end
)
 
 
 
                guiSetVisible(GUIEditor_Window[1], true)
                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
--addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),loginPanel)
 
 
 
-- Disable autologin
function removeAutoLogin()
    local xmlFile = xmlLoadFile(xmlFileName)
    if xmlFile then
        local status = xmlNodeGetAttribute(xmlFile,"autologin")
        if status == "true" then
            xmlNodeSetAttribute(xmlFile,"autologin","false")
            outputChatBox("#0000FF* #FFFFFFAuto-login is now #FF0000DISABLED#FFFFFF!",255,255,255,true)
            xmlSaveFile(xmlFile)
            xmlUnloadFile(xmlFile)
        else
            outputChatBox("#0000FF* #FFFFFFAuto-login is already #FF0000DISABLED#FFFFFF!",255,255,255,true)
            xmlUnloadFile(xmlFile)
        end
    end
end
addCommandHandler("disableauto", removeAutoLogin)
 
 
 
-- Enable autologin
function addAutoLogin()
    local xmlFile = xmlLoadFile(xmlFileName)
    if xmlFile then
        local status  = xmlNodeGetAttribute(xmlFile,"autologin")
        if status == "false" then
            xmlNodeSetAttribute(xmlFile,"autologin","true")
            outputChatBox("#0000FF* #FFFFFFAuto-login is now #00FF00ENABLED#FFFFFF! You will be automatically logged in every time you join the server.",255,255,255,true)
            setTimer(outputChatBox,1000,1,"#0000FF* #FFFFFFTo #FF0000DISABLE#FFFFFF auto-login, use #ABCDEF/disableauto#FFFFFF!",255,255,255,true)
            xmlSaveFile(xmlFile)
            xmlUnloadFile(xmlFile)
        else
            outputChatBox("#0000FF* #FFFFFFAuto-login is already #00FF00ENABLED#FFFFFF!",255,255,255,true)
            xmlUnloadFile(xmlFile)
        end
    end
end
addCommandHandler("enableauto", addAutoLogin)
 
 
 
-- LOGIN PLAYER
function onClickLogin(button,state)
    if(button == "left" and state == "up") then
        if (source == btnLogin) then
            username = guiGetText(editUsername)
            password = guiGetText(editPassword)
            triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,enableKickPlayer,attemptedLogins,maxLoginAttempts)
            xmlFileHandler()
        end
    end
end
 
 
 
-- REGISTER PLAYER
function onClickRegisterConfirm(button,state)
    if(button == "left" and state == "up") then
        if (source == btnConfirmRegistration) then
            username = guiGetText(editRegistrationUsername)
            password = guiGetText(editRegistrationPassword)
            passwordConfirm = guiGetText(editRegistrationRepeatPassword)
            triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm)
        end
    end
end
 
 
 
-- Open registration window
function onClickRegisterToggle(button,state)
    if(button == "left" and state == "up") then
        if (source == btnToggleRegister) then
            guiSetVisible(registerWindow, true)
            guiBringToFront(registerWindow)
            guiSetInputEnabled(true)
            showCursor(true)
        end
    end
end
 
 
 
-- Cancel registration
function onClickCancel(button,state)
    if(button == "left" and state == "up") then
        if (source == btnCancel) then
            guiSetVisible(mainWindow, true)
            guiSetVisible(registerWindow, false)
            guiSetInputEnabled(true)
            showCursor(true)
        end
    end
end
 
 
 
-- Guest mode
function onClickGuest(button,state)
    if(button == "left" and state == "up") then
        if (source == btnPlayAsGuest) then
            guiSetVisible(GUIEditor_Window[1], false)
            guiSetInputEnabled(false)
            showCursor(false)
            outputChatBox("#0000FF* #FFFFFFYou've chosen to play as a #ABCDEFGUEST#FFFFFF!",255,255,255,true)
            triggerServerEvent("onRequestGuest",getLocalPlayer(), "Guest mode")
            if blackLoginScreen == true then
                fadeCamera(true,removeBlackScreenTime)
            end
        end
    end
end
 
 
-- Show login window
function showLoginWindow()
    guiSetVisible(GUIEditor_Window[1], true)
    guiSetInputEnabled(true)
    showCursor(true)
end
addEvent("showLoginWindow", true)
addEventHandler("showLoginWindow",getRootElement(),showLoginWindow)
 
 
 
-- Hide login window
function hideLoginWindow()
Link to comment
اخواني لقد صنعت لوحة تسجيل

من الأخير ~

اخواني اللوحة ما اشتغلت

ومدري شصار فيها اذا تسمحون تعدلون الي الكودات يمكن ؟

الكلنت

fadeCamera(true, 6, 0, 0, 0) 
setCameraMatrix(-1475.5, 831.18, 65.5, -1487.5, 800.18, 65.5)
----------------------------------
-----------| Settings |-----------
----------------------------------
 
 
 
enableKickPlayer = true         -- Set whether to kick the player after they fail to login specified amount of times.
 
disallowLogout = false          -- Set whether to show the userpanel to the players if they log out of their accounts.
 
maxLoginAttempts = 5            -- Set the maximum incorrect login attempts before the player gets kicked - If player kicking is enabled.
 
----------------------------------
 
 
 
-- Set the text you want displayed in the "rules" window here - use '\n' to go into the next line
infoText = "------ Rules ------ \n\n* No cheating!\n* No insulting and spamming!\n* No vehicle mods\n\nEdit the text however you like\n\n\n\n\n\n\n\nLogin panel by BiG,BoSs"
 
 
 
-- Screen and GUI window sizes
screenWidth,screenHeight = guiGetScreenSize()
mainWidth,mainHeight = 749,472
regWidth,regHeight = 439,344
 
 
-- Generate the XML file name
function getServerName()
    triggerServerEvent("onClientLoginLoaded",getLocalPlayer())
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),getServerName)
 
function setXmlFileName(sName)
    xmlFileName = tostring("login_"..sName..".xml")
    loginPanel()
end
addEvent("onGetServerData",true)
addEventHandler("onGetServerData",getRootElement(),setXmlFileName)
 
 
 
 
 
----------------------------------
 
addEvent("onRequestIncreaseAttempts",true)
addEvent("onRequestDisplayPanel",true)
 
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)
                end
            else
                if blackLoginScreen == true then
                    fadeCamera(false,0,0,0,0)
                end
 
 
 
 
GUIEditor = {
    button = {},
    staticimage = {},
    label = {},
    memo = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        login = guiCreateWindow(143, 114, 467, 372, "login-Panel By #BiG,BoSs~", false)
        guiWindowSetSizable(login, false)
 
        GUIEditor.staticimage[1] = guiCreateStaticImage(9, 19, 448, 343, ":login-panel/images/SoftWaves.png", false, login)
 
        GUIEditor.memo[1] = guiCreateMemo(224, 127, 220, 32, "", false, GUIEditor.staticimage[1])
        GUIEditor.memo[2] = guiCreateMemo(223, 170, 221, 31, "", false, GUIEditor.staticimage[1])
        GUIEditor.button[1] = guiCreateButton(227, 230, 211, 86, "Login", false, GUIEditor.staticimage[1])
        guiSetFont(GUIEditor.button[1], "sa-header")
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF51ADAC")
        GUIEditor.button[2] = guiCreateButton(10, 230, 213, 86, "Register ", false, GUIEditor.staticimage[1])
        guiSetFont(GUIEditor.button[2], "sa-header")
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FEEFE707")
        GUIEditor.label[1] = guiCreateLabel(10, 125, 211, 35, "USERNAME :~", false, GUIEditor.staticimage[1])
        guiSetFont(GUIEditor.label[1], "sa-header")
        guiLabelSetColor(GUIEditor.label[1], 0, 0, 0)
        guiLabelSetHorizontalAlign(GUIEditor.label[1], "right", false)
        GUIEditor.label[2] = guiCreateLabel(10, 170, 211, 31, "PASSWORD :~", false, GUIEditor.staticimage[1])
        guiSetFont(GUIEditor.label[2], "sa-header")
        guiLabelSetColor(GUIEditor.label[2], 0, 0, 0)
        guiLabelSetHorizontalAlign(GUIEditor.label[2], "right", false)    
    end
)
 
 
 
                guiSetVisible(GUIEditor_Window[1], true)
                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
--addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),loginPanel)
 
 
 
-- Disable autologin
function removeAutoLogin()
    local xmlFile = xmlLoadFile(xmlFileName)
    if xmlFile then
        local status = xmlNodeGetAttribute(xmlFile,"autologin")
        if status == "true" then
            xmlNodeSetAttribute(xmlFile,"autologin","false")
            outputChatBox("#0000FF* #FFFFFFAuto-login is now #FF0000DISABLED#FFFFFF!",255,255,255,true)
            xmlSaveFile(xmlFile)
            xmlUnloadFile(xmlFile)
        else
            outputChatBox("#0000FF* #FFFFFFAuto-login is already #FF0000DISABLED#FFFFFF!",255,255,255,true)
            xmlUnloadFile(xmlFile)
        end
    end
end
addCommandHandler("disableauto", removeAutoLogin)
 
 
 
-- Enable autologin
function addAutoLogin()
    local xmlFile = xmlLoadFile(xmlFileName)
    if xmlFile then
        local status  = xmlNodeGetAttribute(xmlFile,"autologin")
        if status == "false" then
            xmlNodeSetAttribute(xmlFile,"autologin","true")
            outputChatBox("#0000FF* #FFFFFFAuto-login is now #00FF00ENABLED#FFFFFF! You will be automatically logged in every time you join the server.",255,255,255,true)
            setTimer(outputChatBox,1000,1,"#0000FF* #FFFFFFTo #FF0000DISABLE#FFFFFF auto-login, use #ABCDEF/disableauto#FFFFFF!",255,255,255,true)
            xmlSaveFile(xmlFile)
            xmlUnloadFile(xmlFile)
        else
            outputChatBox("#0000FF* #FFFFFFAuto-login is already #00FF00ENABLED#FFFFFF!",255,255,255,true)
            xmlUnloadFile(xmlFile)
        end
    end
end
addCommandHandler("enableauto", addAutoLogin)
 
 
 
-- LOGIN PLAYER
function onClickLogin(button,state)
    if(button == "left" and state == "up") then
        if (source == btnLogin) then
            username = guiGetText(editUsername)
            password = guiGetText(editPassword)
            triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,enableKickPlayer,attemptedLogins,maxLoginAttempts)
            xmlFileHandler()
        end
    end
end
 
 
 
-- REGISTER PLAYER
function onClickRegisterConfirm(button,state)
    if(button == "left" and state == "up") then
        if (source == btnConfirmRegistration) then
            username = guiGetText(editRegistrationUsername)
            password = guiGetText(editRegistrationPassword)
            passwordConfirm = guiGetText(editRegistrationRepeatPassword)
            triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm)
        end
    end
end
 
 
 
-- Open registration window
function onClickRegisterToggle(button,state)
    if(button == "left" and state == "up") then
        if (source == btnToggleRegister) then
            guiSetVisible(registerWindow, true)
            guiBringToFront(registerWindow)
            guiSetInputEnabled(true)
            showCursor(true)
        end
    end
end
 
 
 
-- Cancel registration
function onClickCancel(button,state)
    if(button == "left" and state == "up") then
        if (source == btnCancel) then
            guiSetVisible(mainWindow, true)
            guiSetVisible(registerWindow, false)
            guiSetInputEnabled(true)
            showCursor(true)
        end
    end
end
 
 
 
-- Guest mode
function onClickGuest(button,state)
    if(button == "left" and state == "up") then
        if (source == btnPlayAsGuest) then
            guiSetVisible(GUIEditor_Window[1], false)
            guiSetInputEnabled(false)
            showCursor(false)
            outputChatBox("#0000FF* #FFFFFFYou've chosen to play as a #ABCDEFGUEST#FFFFFF!",255,255,255,true)
            triggerServerEvent("onRequestGuest",getLocalPlayer(), "Guest mode")
            if blackLoginScreen == true then
                fadeCamera(true,removeBlackScreenTime)
            end
        end
    end
end
 
 
-- Show login window
function showLoginWindow()
    guiSetVisible(GUIEditor_Window[1], true)
    guiSetInputEnabled(true)
    showCursor(true)
end
addEvent("showLoginWindow", true)
addEventHandler("showLoginWindow",getRootElement(),showLoginWindow)
 
 
 
Link to comment
اخواني لقد صنعت لوحة تسجيل

من الأخير ~

اخواني اللوحة ما اشتغلت

ومدري شصار فيها اذا تسمحون تعدلون الي الكودات يمكن ؟

الكلنت

fadeCamera(true, 6, 0, 0, 0) 
setCameraMatrix(-1475.5, 831.18, 65.5, -1487.5, 800.18, 65.5)
----------------------------------
-----------| Settings |-----------
----------------------------------
 
 
 
enableKickPlayer = true         -- Set whether to kick the player after they fail to login specified amount of times.
 
disallowLogout = false          -- Set whether to show the userpanel to the players if they log out of their accounts.
 
maxLoginAttempts = 5            -- Set the maximum incorrect login attempts before the player gets kicked - If player kicking is enabled.
 
----------------------------------
 
 
 
-- Set the text you want displayed in the "rules" window here - use '\n' to go into the next line
infoText = "------ Rules ------ \n\n* No cheating!\n* No insulting and spamming!\n* No vehicle mods\n\nEdit the text however you like\n\n\n\n\n\n\n\nLogin panel by BiG,BoSs"
 
 
 
-- Screen and GUI window sizes
screenWidth,screenHeight = guiGetScreenSize()
mainWidth,mainHeight = 749,472
regWidth,regHeight = 439,344
 
 
-- Generate the XML file name
function getServerName()
    triggerServerEvent("onClientLoginLoaded",getLocalPlayer())
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),getServerName)
 
function setXmlFileName(sName)
    xmlFileName = tostring("login_"..sName..".xml")
    loginPanel()
end
addEvent("onGetServerData",true)
addEventHandler("onGetServerData",getRootElement(),setXmlFileName)
 
 
 
 
 
----------------------------------
 
addEvent("onRequestIncreaseAttempts",true)
addEvent("onRequestDisplayPanel",true)
 
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)
                end
            else
                if blackLoginScreen == true then
                    fadeCamera(false,0,0,0,0)
                end
 
 
 
 
GUIEditor = {
    button = {},
    staticimage = {},
    label = {},
    memo = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        login = guiCreateWindow(143, 114, 467, 372, "login-Panel By #BiG,BoSs~", false)
        guiWindowSetSizable(login, false)
 
        GUIEditor.staticimage[1] = guiCreateStaticImage(9, 19, 448, 343, ":login-panel/images/SoftWaves.png", false, login)
 
        GUIEditor.memo[1] = guiCreateMemo(224, 127, 220, 32, "", false, GUIEditor.staticimage[1])
        GUIEditor.memo[2] = guiCreateMemo(223, 170, 221, 31, "", false, GUIEditor.staticimage[1])
        GUIEditor.button[1] = guiCreateButton(227, 230, 211, 86, "Login", false, GUIEditor.staticimage[1])
        guiSetFont(GUIEditor.button[1], "sa-header")
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF51ADAC")
        GUIEditor.button[2] = guiCreateButton(10, 230, 213, 86, "Register ", false, GUIEditor.staticimage[1])
        guiSetFont(GUIEditor.button[2], "sa-header")
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FEEFE707")
        GUIEditor.label[1] = guiCreateLabel(10, 125, 211, 35, "USERNAME :~", false, GUIEditor.staticimage[1])
        guiSetFont(GUIEditor.label[1], "sa-header")
        guiLabelSetColor(GUIEditor.label[1], 0, 0, 0)
        guiLabelSetHorizontalAlign(GUIEditor.label[1], "right", false)
        GUIEditor.label[2] = guiCreateLabel(10, 170, 211, 31, "PASSWORD :~", false, GUIEditor.staticimage[1])
        guiSetFont(GUIEditor.label[2], "sa-header")
        guiLabelSetColor(GUIEditor.label[2], 0, 0, 0)
        guiLabelSetHorizontalAlign(GUIEditor.label[2], "right", false)    
    end
)
 
 
 
                guiSetVisible(GUIEditor_Window[1], true)
                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
--addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),loginPanel)
 
 
 
-- Disable autologin
function removeAutoLogin()
    local xmlFile = xmlLoadFile(xmlFileName)
    if xmlFile then
        local status = xmlNodeGetAttribute(xmlFile,"autologin")
        if status == "true" then
            xmlNodeSetAttribute(xmlFile,"autologin","false")
            outputChatBox("#0000FF* #FFFFFFAuto-login is now #FF0000DISABLED#FFFFFF!",255,255,255,true)
            xmlSaveFile(xmlFile)
            xmlUnloadFile(xmlFile)
        else
            outputChatBox("#0000FF* #FFFFFFAuto-login is already #FF0000DISABLED#FFFFFF!",255,255,255,true)
            xmlUnloadFile(xmlFile)
        end
    end
end
addCommandHandler("disableauto", removeAutoLogin)
 
 
 
-- Enable autologin
function addAutoLogin()
    local xmlFile = xmlLoadFile(xmlFileName)
    if xmlFile then
        local status  = xmlNodeGetAttribute(xmlFile,"autologin")
        if status == "false" then
            xmlNodeSetAttribute(xmlFile,"autologin","true")
            outputChatBox("#0000FF* #FFFFFFAuto-login is now #00FF00ENABLED#FFFFFF! You will be automatically logged in every time you join the server.",255,255,255,true)
            setTimer(outputChatBox,1000,1,"#0000FF* #FFFFFFTo #FF0000DISABLE#FFFFFF auto-login, use #ABCDEF/disableauto#FFFFFF!",255,255,255,true)
            xmlSaveFile(xmlFile)
            xmlUnloadFile(xmlFile)
        else
            outputChatBox("#0000FF* #FFFFFFAuto-login is already #00FF00ENABLED#FFFFFF!",255,255,255,true)
            xmlUnloadFile(xmlFile)
        end
    end
end
addCommandHandler("enableauto", addAutoLogin)
 
 
 
-- LOGIN PLAYER
function onClickLogin(button,state)
    if(button == "left" and state == "up") then
        if (source == btnLogin) then
            username = guiGetText(editUsername)
            password = guiGetText(editPassword)
            triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,enableKickPlayer,attemptedLogins,maxLoginAttempts)
            xmlFileHandler()
        end
    end
end
 
 
 
-- REGISTER PLAYER
function onClickRegisterConfirm(button,state)
    if(button == "left" and state == "up") then
        if (source == btnConfirmRegistration) then
            username = guiGetText(editRegistrationUsername)
            password = guiGetText(editRegistrationPassword)
            passwordConfirm = guiGetText(editRegistrationRepeatPassword)
            triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm)
        end
    end
end
 
 
 
-- Open registration window
function onClickRegisterToggle(button,state)
    if(button == "left" and state == "up") then
        if (source == btnToggleRegister) then
            guiSetVisible(registerWindow, true)
            guiBringToFront(registerWindow)
            guiSetInputEnabled(true)
            showCursor(true)
        end
    end
end
 
 
 
-- Cancel registration
function onClickCancel(button,state)
    if(button == "left" and state == "up") then
        if (source == btnCancel) then
            guiSetVisible(mainWindow, true)
            guiSetVisible(registerWindow, false)
            guiSetInputEnabled(true)
            showCursor(true)
        end
    end
end
 
 
 
-- Guest mode
function onClickGuest(button,state)
    if(button == "left" and state == "up") then
        if (source == btnPlayAsGuest) then
            guiSetVisible(GUIEditor_Window[1], false)
            guiSetInputEnabled(false)
            showCursor(false)
            outputChatBox("#0000FF* #FFFFFFYou've chosen to play as a #ABCDEFGUEST#FFFFFF!",255,255,255,true)
            triggerServerEvent("onRequestGuest",getLocalPlayer(), "Guest mode")
            if blackLoginScreen == true then
                fadeCamera(true,removeBlackScreenTime)
            end
        end
    end
end
 
 
-- Show login window
function showLoginWindow()
    guiSetVisible(GUIEditor_Window[1], true)
    guiSetInputEnabled(true)
    showCursor(true)
end
addEvent("showLoginWindow", true)
addEventHandler("showLoginWindow",getRootElement(),showLoginWindow)
 
 
 
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...