Jump to content

Help..! guiSetVisible and..


iPrestege

Recommended Posts

Posted

hi , i need help here what,s the wrong!

bindKey ( "F1" , "down" ,  
function() 
 if ( guiGetVisible ( GUIEditor_Window[1] ) and  ( guiGetVisible ( GUIEditor_Window[2] ) and  ( guiGetVisible ( GUIEditor_Window[3] ) == true ) then 
 guiSetVisible ( GUIEditor_Window[1] ,false ) 
 guiSetVisible ( GUIEditor_Window[2] ,false ) 
 guiSetVisible ( GUIEditor_Window[3] ,false ) 
 showCursor (false ) 
  
 elseif ( guiGetVisible ( GUIEditor_Window[1] ) and  ( guiGetVisible ( GUIEditor_Window[2] ) and ( guiGetVisible ( GUIEditor_Window[3] ) == false ) then 
 guiSetVisible ( GUIEditor_Window[1] ,true ) 
 guiSetVisible ( GUIEditor_Window[2] ,true ) 
 guiSetVisible ( GUIEditor_Window[3] ,true ) 
 showCursor (true) 
 end 
 end 
 ) 
  

  

Posted

Maybe if you could tell us what's the problem?

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

Post the full code so I can test on it.

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
Post the full code so I can test on it.

realy it,s hard to post the full script but i but my full code about guiSetVisible... and the error here:

Warning: Loading script failed: name/client.lua:342: unexpected symbol near "and"

full code =

bindKey ( "n" , "down" ,  
function() 
 if ( guiGetVisible ( Drift ) and  ( guiGetVisible ( War ) and  ( guiGetVisible ( Chose ) and  and  ( guiGetVisible ( Ver )== true ) then 
 guiSetVisible ( Drift ,false ) 
 guiSetVisible ( War ,false ) 
 guiSetVisible ( Chose ,false ) 
 guiSetVisible ( Ver ,false ) 
 fadeCamera(true) 
 showChat(true) 
 showCursor (false ) 
  
 elseif ( guiGetVisible ( Drift ) and  ( guiGetVisible ( War ) and  ( guiGetVisible ( Chose ) and  and  ( guiGetVisible ( Ver )== false ) then 
 guiSetVisible ( Drift ,true ) 
 guiSetVisible ( War ,true ) 
 guiSetVisible ( Chose ,true ) 
 guiSetVisible ( Ver ,true ) 
 fadeCamera(false) 
 showChat(false) 
 showCursor (true) 
 end 
 end 
 ) 

:)

  

Posted

Could have posted the error from the beginning.

You got two "and" instead of one, check "if" and "elseif" lines.

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 (edited)
Could have posted the error from the beginning.

You got two "and" instead of one, check "if" and "elseif" lines.

sorry my bad! and here new problem and dont work:(

bindKey ( "n" , "down" ,  
function() 
 if ( guiGetVisible ( Drift ) and  ( guiGetVisible ( War ) and  ( guiGetVisible ( Chose ) and   ( guiGetVisible ( Ver )== true ) then 
 guiSetVisible ( Drift ,false ) 
 guiSetVisible ( War ,false ) 
 guiSetVisible ( Chose ,false ) 
 guiSetVisible ( Ver ,false ) 
 fadeCamera(true) 
 showChat(true) 
 showCursor (false ) 
  
 elseif ( guiGetVisible ( Drift ) and  ( guiGetVisible ( War ) and  ( guiGetVisible ( Chose ) and  ( guiGetVisible ( Ver )== false ) then 
 guiSetVisible ( Drift ,true ) 
 guiSetVisible ( War ,true ) 
 guiSetVisible ( Chose ,true ) 
 guiSetVisible ( Ver ,true ) 
 fadeCamera(false) 
 showChat(false) 
 showCursor (true) 
 end 
 end 
 ) 

reason:Warning: Loading script failed: name/client.lua:347: expected symbol near "then"

Edited by Guest

  

Posted
bindKey ( "n" , "down" , 
    function ( ) 
        if ( guiGetVisible ( Drift ) and guiGetVisible ( War ) and guiGetVisible ( ChoseL ) and guiGetVisible ( Ver ) == true ) then 
            guiSetVisible ( Drift, false ) 
            guiSetVisible ( War, false ) 
            guiSetVisible ( ChoseL, false ) 
            guiSetVisible ( Ver, false ) 
            fadeCamera ( true ) 
            showChat ( true ) 
            showCursor ( false ) 
        elseif ( guiGetVisible ( Drift ) and guiGetVisible ( War ) and guiGetVisible ( ChoseL ) and guiGetVisible ( Ver ) == false ) then 
            guiSetVisible ( Drift, true ) 
            guiSetVisible ( War, true ) 
            guiSetVisible ( ChoseL, true ) 
            guiSetVisible ( Ver, true ) 
            fadeCamera ( false ) 
            showChat ( false ) 
            showCursor ( true ) 
        end 
    end 
) 

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
bindKey ( "n" , "down" , 
    function ( ) 
        if ( guiGetVisible ( Drift ) and guiGetVisible ( War ) and guiGetVisible ( ChoseL ) and guiGetVisible ( Ver ) == true ) then 
            guiSetVisible ( Drift, false ) 
            guiSetVisible ( War, false ) 
            guiSetVisible ( ChoseL, false ) 
            guiSetVisible ( Ver, false ) 
            fadeCamera ( true ) 
            showChat ( true ) 
            showCursor ( false ) 
        elseif ( guiGetVisible ( Drift ) and guiGetVisible ( War ) and guiGetVisible ( ChoseL ) and guiGetVisible ( Ver ) == false ) then 
            guiSetVisible ( Drift, true ) 
            guiSetVisible ( War, true ) 
            guiSetVisible ( ChoseL, true ) 
            guiSetVisible ( Ver, true ) 
            fadeCamera ( false ) 
            showChat ( false ) 
            showCursor ( true ) 
        end 
    end 
) 

my script work now but the key not work!i mean not binded! i don know why no errors!

  

Posted

Well, the problem is that you're checking only the last GUI element ( "Ver" ) if is visible or not.

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 (edited)
Well, the problem is that you're checking only the last GUI element ( "Ver" ) if is visible or not.
  
bindKey ( "n" , "down" , 
    function ( ) 
        if ( guiGetVisible ( Drift ) and guiGetVisible ( War ) and guiGetVisible ( ChoseL ) and guiGetVisible ( Ver ) == true ) then 
            guiSetVisible ( Drift, false ) 
            guiSetVisible ( War, false ) 
            guiSetVisible ( ChoseL, false ) 
            guiSetVisible ( Ver, false ) 
            fadeCamera ( true ) 
            showChat ( true ) 
            showCursor ( false ) 
        elseif ( guiGetVisible ( Drift ) and guiGetVisible ( War ) and guiGetVisible ( ChoseL ) and guiGetVisible ( Ver ) == false ) then 
            guiSetVisible ( Drift, true ) 
            guiSetVisible ( War, true ) 
            guiSetVisible ( ChoseL, true ) 
            guiSetVisible ( Ver, true ) 
            fadeCamera ( false ) 
            showChat ( false ) 
            showCursor ( true ) 
        end 
    end 
) 
  

No Erros or Warnings .

Edited by Guest

  

Posted

You didn't change anything?

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 didn't change anything?

Ahh!, yes it,s visible :) .

Ver = guiCreateLabel(0.10029282420874,0.76041668653488,0.81551975011826,0.23046875, "(V.2)", true) 
guiSetVisible ( Ver, false ) 
guiLabelSetColor(Ver, 0, 254, 233) 

  

Posted

Try this ^^

bindKey ( "F1" , "down" ,  
function() 
    if guiGetVisible ( GUIEditor_Window[1] ) == true and guiGetVisible ( GUIEditor_Window[2] ) == true and  ( guiGetVisible ( GUIEditor_Window[3] ) == true ) then 
        guiSetVisible ( GUIEditor_Window[1] ,false ) 
        guiSetVisible ( GUIEditor_Window[2] ,false ) 
        guiSetVisible ( GUIEditor_Window[3] ,false ) 
        showCursor (false ) 
    elseif  guiGetVisible ( GUIEditor_Window[1] )  == true and guiGetVisible ( GUIEditor_Window[2] )  == true and ( guiGetVisible ( GUIEditor_Window[3] ) == false ) then 
        guiSetVisible ( GUIEditor_Window[1] ,true ) 
        guiSetVisible ( GUIEditor_Window[2] ,true ) 
        guiSetVisible ( GUIEditor_Window[3] ,true ) 
        showCursor (true) 
    end 
end) 
  
  

Retired.

Posted
Try this ^^
bindKey ( "F1" , "down" ,  
function() 
    if guiGetVisible ( GUIEditor_Window[1] ) == true and guiGetVisible ( GUIEditor_Window[2] ) == true and  ( guiGetVisible ( GUIEditor_Window[3] ) == true ) then 
        guiSetVisible ( GUIEditor_Window[1] ,false ) 
        guiSetVisible ( GUIEditor_Window[2] ,false ) 
        guiSetVisible ( GUIEditor_Window[3] ,false ) 
        showCursor (false ) 
    elseif  guiGetVisible ( GUIEditor_Window[1] )  == true and guiGetVisible ( GUIEditor_Window[2] )  == true and ( guiGetVisible ( GUIEditor_Window[3] ) == false ) then 
        guiSetVisible ( GUIEditor_Window[1] ,true ) 
        guiSetVisible ( GUIEditor_Window[2] ,true ) 
        guiSetVisible ( GUIEditor_Window[3] ,true ) 
        showCursor (true) 
    end 
end) 
  
  

dont work!

  

Posted
bindKey ( "n", "down", 
    function ( ) 
        if ( guiGetVisible ( Drift ) == true and guiGetVisible ( War ) == true and guiGetVisible ( ChoseL ) == true and guiGetVisible ( Ver ) == true ) then 
            guiSetVisible ( Drift, false ) 
            guiSetVisible ( War, false ) 
            guiSetVisible ( ChoseL, false ) 
            guiSetVisible ( Ver, false ) 
            fadeCamera ( true ) 
            showChat ( true ) 
            showCursor ( false ) 
        else 
            guiSetVisible ( Drift, true ) 
            guiSetVisible ( War, true ) 
            guiSetVisible ( ChoseL, true ) 
            guiSetVisible ( Ver, true ) 
            fadeCamera ( false ) 
            showChat ( false ) 
            showCursor ( true ) 
        end 
    end 
) 

Posted
bindKey ( "n", "down", 
    function ( ) 
        if ( guiGetVisible ( Drift ) == true and guiGetVisible ( War ) == true and guiGetVisible ( ChoseL ) == true and guiGetVisible ( Ver ) == true ) then 
            guiSetVisible ( Drift, false ) 
            guiSetVisible ( War, false ) 
            guiSetVisible ( ChoseL, false ) 
            guiSetVisible ( Ver, false ) 
            fadeCamera ( true ) 
            showChat ( true ) 
            showCursor ( false ) 
        else 
            guiSetVisible ( Drift, true ) 
            guiSetVisible ( War, true ) 
            guiSetVisible ( ChoseL, true ) 
            guiSetVisible ( Ver, true ) 
            fadeCamera ( false ) 
            showChat ( false ) 
            showCursor ( true ) 
        end 
    end 
) 

Thanks it works! (:

  

Posted
bindKey ( "n", "down", 
    function ( ) 
        if ( guiGetVisible ( Drift ) == true and guiGetVisible ( War ) == true and guiGetVisible ( ChoseL ) == true and guiGetVisible ( Ver ) == true ) then 
            guiSetVisible ( Drift, false ) 
            guiSetVisible ( War, false ) 
            guiSetVisible ( ChoseL, false ) 
            guiSetVisible ( Ver, false ) 
            fadeCamera ( true ) 
            showChat ( true ) 
            showCursor ( false ) 
        else 
            guiSetVisible ( Drift, true ) 
            guiSetVisible ( War, true ) 
            guiSetVisible ( ChoseL, true ) 
            guiSetVisible ( Ver, true ) 
            fadeCamera ( false ) 
            showChat ( false ) 
            showCursor ( true ) 
        end 
    end 
) 

Thanks it works! (:

Welcome Any Time !

Posted
local function getTeam(team) 
return getTeamFromName(team) 
end 
  
addEventHandler("onClientRender", root,  
function() 
  local team1 = getTeam("Players Drift") 
  local team2 = getTeam("Grove") 
  local team3 = getTeam("Police") 
  local team4 = getTeam("No Team") 
  local count1 = count("Players Drift") 
  local count2 = count("Grove") 
  local count3 = count("Police") 
  local count4 = count("No Team") 
  if count1 then 
    guiSetText( 
DriftPlayers, "Drift Players: " .. tonumber(count1)) 
  end 
  local counall = count2 + count3 + count4 
  if counall then 
    guiSetText( 
WarPlayers, "War Players: " .. tonumber(counall)) 
  end 
  end 
) 
  

what,s the problem here? :roll:

  

Posted

getTeam and count are custom functions?

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
local function getTeam ( team ) 
    return getTeamFromName ( team ) 
end 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local team1 = getTeam ( "Players Drift" ) 
        local team2 = getTeam ( "Grove" ) 
        local team3 = getTeam ( "Police" ) 
        local team4 = getTeam ( "No Team" ) 
        local count1 = countPlayersInTeam ( team1 ) 
        local count2 = countPlayersInTeam ( team2 ) 
        local count3 = countPlayersInTeam ( team3 ) 
        local count4 = countPlayersInTeam ( team3 ) 
        if ( count1 ) then 
            guiSetText (    DriftPlayers, "Drift Players: ".. tonumber ( count1 ) ) 
        end 
        local counall = ( count2 + count3 + count4 ) 
        if ( counall ) then 
            guiSetText ( WarPlayers, "War Players: ".. tonumber ( counall ) ) 
        end 
    end 
) 

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
local function getTeam ( team ) 
    return getTeamFromName ( team ) 
end 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local team1 = getTeam ( "Players Drift" ) 
        local team2 = getTeam ( "Grove" ) 
        local team3 = getTeam ( "Police" ) 
        local team4 = getTeam ( "No Team" ) 
        local count1 = countPlayersInTeam ( team1 ) 
        local count2 = countPlayersInTeam ( team2 ) 
        local count3 = countPlayersInTeam ( team3 ) 
        local count4 = countPlayersInTeam ( team3 ) 
        if ( count1 ) then 
            guiSetText (    DriftPlayers, "Drift Players: ".. tonumber ( count1 ) ) 
        end 
        local counall = ( count2 + count3 + count4 ) 
        if ( counall ) then 
            guiSetText ( WarPlayers, "War Players: ".. tonumber ( counall ) ) 
        end 
    end 
) 

Thank You very much :D.

  

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