Jump to content

Lock moving with gui


papam77

Recommended Posts

I have this and still can move with gui

local clientContainer = {} 
  
clientContainer.createLogin = function() 
    guiWindowSetMovable ( window, false ) 
    clientContainer.GUI = {} 
    local resX, resY = guiGetScreenSize(); 
    clientContainer.GUI.root = guiCreateWindow(resX/2-300/2, resY/2-500.5/2, 300, 500.5, 'Log in', false) 
    -- USERNAME 
    clientContainer.GUI.UserLab = guiCreateLabel(10,25,75,25,'Username:',false,clientContainer.GUI.root) 
    clientContainer.GUI.UserEdt = guiCreateEdit(70,22.5,225,25,'', false,clientContainer.GUI.root) 
    -- PASSWORD 
    clientContainer.GUI.PassLab = guiCreateLabel(10,55,75,25,'Password:',false,clientContainer.GUI.root) 
    clientContainer.GUI.PassEdt = guiCreateEdit(70,52.5,225,25,'', false,clientContainer.GUI.root) 
    guiEditSetMasked(clientContainer.GUI.PassEdt, true) 
    -- BUTTONS 
    clientContainer.GUI.Check = guiCreateCheckBox(10,82.5,75,25,'save Data!',false,false,clientContainer.GUI.root) 
    clientContainer.GUI.LogButt = guiCreateButton(216,82.5,75,25,'Log In',false,clientContainer.GUI.root) 
    -- HANDLER 
    addEventHandler('onClientGUIClick', clientContainer.GUI.LogButt, function() 
        local user = guiGetText(clientContainer.GUI.UserEdt); 
        local pass = guiGetText(clientContainer.GUI.PassEdt); 
        if pass and pass ~= '' and user and user ~= '' then 
            triggerServerEvent('onClientLogins', localPlayer, user, pass) 
        end 
    end, false) 
     
    -- XML 
    if fileExists('acc.xml') then 
        local accRoot = xmlLoadFile('acc.xml') 
        if accRoot then 
            for index, child in next, xmlNodeGetChildren(accRoot) do 
                if xmlNodeGetAttribute(child,'Save') == 'true' then  
                    guiSetText(clientContainer.GUI.UserEdt,xmlNodeGetAttribute(child,'Username')) 
                    guiSetText(clientContainer.GUI.PassEdt,xmlNodeGetAttribute(child,'Password')) 
                    guiCheckBoxSetSelected(clientContainer.GUI.Check,true) 
                end 
            end 
            xmlUnloadFile(accRoot) 
        end 
    else 
        local accRoot = xmlCreateFile('acc.xml','authentication') 
        if accRoot then 
            local settings = xmlCreateChild(accRoot,'Settings') 
            -- settings 
            xmlNodeSetAttribute(settings,'Username','') 
            xmlNodeSetAttribute(settings,'Password','') 
            xmlNodeSetAttribute(settings,'Save','false') 
            xmlSaveFile(accRoot) 
            xmlUnloadFile(accRoot) 
        end 
    end 
     
    showCursor(true) 
end 
  
addEventHandler('onClientResourceStart', resourceRoot, clientContainer.createLogin) 
  
clientContainer.onClientSuccessfullyLogin = function() 
    -- XML SAVE 
    if ( guiCheckBoxGetSelected(clientContainer.GUI.Check) == true ) then 
        local accRoot = xmlLoadFile('acc.xml') 
        if accRoot then 
            for index, child in next, xmlNodeGetChildren(accRoot) do 
                xmlNodeSetAttribute(child,'Save','true') 
                xmlNodeSetAttribute(child,'Username',guiGetText(clientContainer.GUI.UserEdt)) 
                xmlNodeSetAttribute(child,'Password',guiGetText(clientContainer.GUI.PassEdt)) 
            end 
            xmlSaveFile(accRoot) 
            xmlUnloadFile(accRoot) 
        end 
    end 
    destroyElement(clientContainer.GUI.root) 
    showCursor(false) 
end 
  
addEvent('onClientSuccessfullyLogin', true) 
addEventHandler('onClientSuccessfullyLogin', root, clientContainer.onClientSuccessfullyLogin) 

Link to comment
clientContainer.GUI.root = guiCreateWindow(resX/2-300/2, resY/2-500.5/2, 300, 500.5, 'Log in', false) 

Thats the GUI you're creating, and the name of it. To set the window not moveable, you've to use the name of the window you created + you've to set it not moveable after you created it;

ClientContainer.GUI.loginGui = guiCreateWindow(resX/2-300/2, resY/2-500.5/2, 300, 500.5, 'Login', false); 
guiWindowSetMovable(loginGui, false); 

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