Jump to content

Vg login problem


Axel

Recommended Posts

As far as i'v noticed it might be here:

  
  
function createMainUI(res, isChangeAccount) 
    if (res==getThisResource()) then 
        sent = false 
        local tutFile = xmlLoadFile("vgrptut.xml") 
        local regFile = xmlLoadFile("vgrpreg.xml") 
         
        if (tutFile) or (regFile) then 
            -- Set the camera to a nice view 
            local cameraRand = math.random(1, 1) 
             
             
            if (cameraRand==1) then 
                loadScenarioOne() 
                addEventHandler("onClientRender", getRootElement(), renderWelcomeMessage) 
            end 
            fadeCamera(false) 
             
            if (bChangeAccount) then 
                destroyElement(bChangeAccount) 
                bChangeAccount = nil 
            end 
             
            checkTOS() -- Terms of Service 
             
            local width, height = 400, 200 
             
            local scrWidth, scrHeight = guiGetScreenSize() 
            local x = scrWidth/2 - (width/2) 
            local y = scrHeight/2 - (height/2) 
  
            if (scrWidth<1024) and (scrHeight<768) then 
                outputChatBox("WARNING: You are running on a low resolution. We recommend atleast 1024x768.", 255, 0, 0) 
            end 
             
            --[[ 
            local version = tonumber(string.sub(getVersion().type, 10, string.len(getVersion().type))) 
            if (getVersion().type~="Custom" and getVersion().type~="Release") and sversion then 
                if (version~=nil) then 
                    if (version
                        clearChatBox() 
                        showChat(true) 
                        outputChatBox("You are using an older nightly. You require r" .. sversion .. ".") 
                        outputChatBox("You can obtain this at [url=https://nightly.multitheftauto.com]https://nightly.multitheftauto.com[/url]") 
                        return 
                    end 
                end 
            end 
            ]]-- 
                 
            tabPanelMain = guiCreateTabPanel(x, y, width, height, false) 
             
            if (regFile) then -- User has already registered on this PC before. 
                tabLogin = guiCreateTab("Login to Account", tabPanelMain) 
                tabRegister = guiCreateTab("Register Account", tabPanelMain) 
                tabForgot = guiCreateTab("Forgot Details", tabPanelMain) 
            else 
                tabRegister = guiCreateTab("Register Account", tabPanelMain) 
                tabLogin = guiCreateTab("Login to Account", tabPanelMain) 
                tabForgot = guiCreateTab("Forgot Details", tabPanelMain) 
            end 
             
            guiSetAlpha(tabPanelMain, 0) 
             
            lRegUsername = guiCreateLabel(0.025, 0.15, 0.95, 0.95, "To join this server you must submit an application at: \n\n\n[url=http://www.ValhallaGaming.net/mtaucp]www.ValhallaGaming.net/mtaucp[/url].\n\n\n We aim to respond to all applications within a few hours. \n\n This helps us pick out undesirable players such as Deathmatchers.", true, tabRegister) 
            lRegUsernameNote = guiCreateLabel(0.225, 0.25, 0.8, 0.2, "NOTE: This is NOT your character's name.", true, tabRegister) 
            guiLabelSetHorizontalAlign(lRegUsername, "center") 
            guiSetFont(lRegUsername, "default-bold-small") 
             
            lRegUsername = guiCreateLabel(0.2, 0.15, 0.3, 0.1, "Account Name:", true, tabRegister) 
            lRegUsernameNote = guiCreateLabel(0.225, 0.25, 0.8, 0.2, "NOTE: This is NOT your character's name.", true, tabRegister) 
            guiSetFont(lRegUsernameNote, "default-bold-small") 
             
            tRegUsername = guiCreateEdit(0.425, 0.15, 0.3, 0.1, "Memorable Name", true, tabRegister) 
            guiEditSetMaxLength(tRegUsername, 16) 
             
            lRegPassword = guiCreateLabel(0.15, 0.45, 0.3, 0.1, "Account Password:", true, tabRegister) 
            tRegPassword = guiCreateEdit(0.425, 0.45, 0.3, 0.1, "password", true, tabRegister) 
            guiEditSetMasked(tRegPassword, true) 
            guiEditSetMaxLength(tRegPassword, 29) 
             
            lRegPassword2 = guiCreateLabel(0.165, 0.575, 0.3, 0.1, "Confirm Password:", true, tabRegister) 
            tRegPassword2 = guiCreateEdit(0.425, 0.575, 0.3, 0.1, "password", true, tabRegister) 
            guiEditSetMasked(tRegPassword2, true) 
            guiEditSetMaxLength(tRegPassword2, 29) 
             
            bRegister = guiCreateButton(0.25, 0.75, 0.5, 0.2, "Register", true, tabRegister) 
            addEventHandler("onClientGUIClick", bRegister, validateDetails, false) 
             
            -- LOGIN 
            lLogUsername = guiCreateLabel(0.2, 0.2, 0.3, 0.1, "Account Name:", true, tabLogin) 
            lLogUsernameNote = guiCreateLabel(0.225, 0.3, 0.8, 0.2, "NOTE: This is NOT your character's name.", true, tabLogin) 
            guiSetFont(lLogUsernameNote, "default-bold-small") 
             
             
            tLogUsername = guiCreateEdit(0.425, 0.2, 0.3, 0.1, "", true, tabLogin) 
            guiEditSetMaxLength(tLogUsername, 32) 
             
            lLogPassword = guiCreateLabel(0.15, 0.45, 0.3, 0.1, "Account Password:", true, tabLogin) 
            tLogPassword = guiCreateEdit(0.425, 0.45, 0.3, 0.1, "", true, tabLogin) 
            guiEditSetMasked(tLogPassword, true) 
            guiEditSetMaxLength(tLogPassword, 32) 
             
            chkRemember = guiCreateCheckBox(0.35, 0.52, 0.5, 0.15, "Remember my Details", false, true, tabLogin) 
            chkAutoLogin = guiCreateCheckBox(0.35, 0.62, 0.5, 0.15, "Automatic Login", false, true, tabLogin) 
             
            addEventHandler("onClientGUIClick", chkRemember, updateLoginState) 
             
            bLogin = guiCreateButton(0.25, 0.75, 0.5, 0.2, "Login", true, tabLogin) 
            addEventHandler("onClientGUIClick", bLogin, validateDetails, false) 
             
            -- FORGOTTEN DETAILS 
            lLostSecurityKey = guiCreateLabel(0.025, 0.15, 0.95, 0.95, "To retrieve your username and password please visit the UCP: \n\n\n[url=http://www.ValhallaGaming.net/mtaucp]www.ValhallaGaming.net/mtaucp[/url]., true, tabForgot) 
            guiLabelSetHorizontalAlign(lLostSecurityKey, "center") 
            guiSetFont(lLostSecurityKey, "default-bold-small") 
             
            -- LOAD SAVED USER INFO  
            local xmlRoot = xmlLoadFile( ip == "127.0.0.1" and "vgloginlocal.xml" or "vglogin.xml" ) 
            if (xmlRoot) then 
                local usernameNode = xmlFindChild(xmlRoot, "username", 0) 
                local passwordNode = xmlFindChild(xmlRoot, "hashcode", 0) 
                local autologinNode = xmlFindChild(xmlRoot, "autologin", 0) 
                 
                if (usernameNode) then 
                    uname = xmlNodeGetValue(usernameNode) 
                    if (uname) and (uname~="") then 
                        guiSetText(tLogUsername, tostring(uname)) 
                        guiCheckBoxSetSelected(chkRemember, true) 
                        if (passwordNode) then 
                            local pword = xmlNodeGetValue(passwordNode) 
                            if (pword) and (pword~="") then 
                                guiSetText(tLogPassword, tostring(pword)) 
                                guiCheckBoxSetSelected(chkRemember, true) 
                            else 
                                guiSetEnabled(chkAutoLogin, false) 
                            end 
                                 
                            if (autologinNode) then 
                                local autolog = xmlNodeGetValue(autologinNode) 
                                if (autolog) and (autolog=="1") then         
                                    if(guiGetEnabled(chkAutoLogin)) then 
                                        guiCheckBoxSetSelected(chkAutoLogin, true) 
                                        if not (isChangeAccount) then 
                                            triggerServerEvent("attemptLogin", getLocalPlayer(), guiGetText(tLogUsername), guiGetText(tLogPassword), nil, true)  
                                        end 
                                    end 
                                end 
                            end 
                        else 
                            guiCheckBoxSetSelected(chkAutoLogin, false) 
                        end 
                    end 
                end 
            end 
             
            if (toswindow) then 
                guiBringToFront(toswindow) 
            end 
            setTimer(fadeWindow, 50, 20) 
        else 
            showChat(true) 
            showTutorial() 
        end 
    end 
end 
--addEventHandler("onClientResourceStart", getRootElement(), createMainUI)  

Link to comment
  • Discord Moderators

yeah it's on line 18.

Is the camera not faded in again? I suppose you want to place fadeCamera (true) at the same place where the window is hid, or on the server side upon successful login.

Link to comment
  • 2 weeks later...

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...