Jump to content

guiSetVisible


glowdemon1

Recommended Posts

Posted

No errors at all, it does show the edit box but it doesn't get rid of all the windows, AKA guiSetVisible doesn't seem to work, I tried bypassing it couple of times for bugtesting but i was unable to solve this bug.

function centerWindow(center_window,addX,addY) 
    local screenW,screenH=guiGetScreenSize() 
    local windowW,windowH=guiGetSize(center_window,false) 
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
    guiSetPosition(center_window,x+addX,y+addY,false) 
end 
  
function guiShowFalse() 
    -- local guis = logo,logBtn,regBtn 
    guiSetVisible(logLogo, false) 
    guiSetVisible(logBtn, false) 
    guiSetVisible(regBtn, false) 
end 
  
function showRegForm() 
local x = 20 
local y = 30 
    guiShowFalse() 
    nameFld = guiCreateEdit(0,0,x,y, "Name", false) 
    centerWindow(nameFld,50,50) 
end 
     
function disableStuffOnJoin() 
    logLogo = guiCreateStaticImage(0,0,370,112,"logoWC.png", false) 
    logBtn = guiCreateButton(0,0,120,30,"Log in", false) 
    regBtn = guiCreateButton(0,0,120,30,"Register", false) 
     
    centerWindow(logLogo,0,0) 
    centerWindow(logBtn,65,50) 
    centerWindow(regBtn,-65,50) 
     
    showPlayerHudComponent("all", false) 
    themeSfx = playSFX("genrl",75,0,true) 
    fadeCamera(true) 
     
    guiSetFont(logBtn,"default-bold-small") 
    guiSetFont(regBtn,"default-bold-small") 
     
    addEventHandler("onClientGUIClick", regBtn, showRegForm, false) 
    addEventHandler("onClientGUIClick", regBtn,guiShowFalse , false) 
end disableStuffOnJoin() 
  
addEventHandler("onClientResourceStart", resourceRoot ,disableStuffOnJoin) 
  

Posted

First error I got so far;

Attempt to perform arithmetic on local 'windowW' ( a boolean value) 

second thing, if you give them a parent ( define the window where the buttons, images etc are on ) you can just do; guiSetVisible ( window_name, false ) to hide all of the elements. If you don't want to place them on a window, create an array holding the elements. After that loop through it with a foreach and toggle their status.

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

Posted

That's becuase you are creating the GUI twice, see here:

end disableStuffOnJoin() 
  
addEventHandler("onClientResourceStart", resourceRoot ,disableStuffOnJoin) 

You create it twice, change it to:

end 
addEventHandler("onClientResourceStart", resourceRoot ,disableStuffOnJoin) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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