Jump to content

guiSetVisible Invalid!help


crazyde21

Recommended Posts

Posted

My question is: When I "F5" status "up", "Gui" can not close! :( help.!

client

addEvent( "moneyn", true ) 
addEventHandler( "moneyn", getRootElement(),  
function(qian)  
  bindKey ( "F5", "down",function() 
  
        qianbao.window[1] = guiCreateWindow(0.33, 0.28, 0.25, 0.16, "钱包", true) 
        guiWindowSetSizable(qianbao.window[1], false) 
        guiSetAlpha(qianbao.window[1], 1.00) 
        qianbao.label[1] = guiCreateLabel(0.10, 0.18, 0.34, 0.24, "你的金钱:", true, qianbao.window[1]) 
        guiSetFont(qianbao.label[1], "default-bold-small") 
                guiLabelSetColor(qianbao.label[1], 247, 246, 121) 
        guiLabelSetHorizontalAlign(qianbao.label[1], "center", true) 
        guiLabelSetVerticalAlign(qianbao.label[1], "center") 
        qianbao.label[2] = guiCreateLabel(0.34, 0.38, 0.48, 0.23,"请登录!", true, qianbao.window[1]) 
        guiSetText ( qianbao.label[2], qian ) 
         guiLabelSetColor(qianbao.label[2], 213, 72, 92) 
        guiLabelSetVerticalAlign(qianbao.label[2], "center") 
        qianbao.staticimage[1] = guiCreateStaticImage(0.04, 0.18, 0.92, 0.76, ":login_mysql/images/qianbao.png", true, qianbao.window[1]) 
        guiSetAlpha(qianbao.staticimage[1], 0.23)            
        guiSetProperty(qianbao.button[1], "NormalTextColour", "FFAAAAAA") 
end 
) 
         
    end 
) 
 bindKey ( "F5", "up",function() 
guiSetVisible(qianbao.window[1],false) 
end 
) 

server

addEventHandler("onPlayerJoin", getRootElement(), 
    function(player) 
setTimer(function() 
    handler = mysql_connect( host, username, password, db ) 
if handler then 
local result = mysql_query(handler, "SELECT Money FROM players WHERE Username='crazyde21'")-- Execute the query 
for result,row in mysql_rows(result) do -- Iterate through all the result rows 
  mysql_field_seek(result, 1) -- Reset the field cursor to the first field 
  for k,qian in ipairs(row) do 
    local field = mysql_fetch_field(result) -- Retreive the field data 
 triggerClientEvent("moneyn",getRootElement(),qian) 
  end 
  end 
  end 
  end,10000,0) 
    end 
    ) 

Posted

Try this:

Client:

addEvent( "moneyn", true ) 
addEventHandler("onClientResourceStart", resourceRoot, 
function() 
    qianbao.window[1] = guiCreateWindow(0.33, 0.28, 0.25, 0.16, "钱包", true) 
    guiSetVisible(qianbao.window[1], false) 
    guiWindowSetSizable(qianbao.window[1], false) 
    guiSetAlpha(qianbao.window[1], 1.00) 
     
    qianbao.label[1] = guiCreateLabel(0.10, 0.18, 0.34, 0.24, "你的金钱:", true, qianbao.window[1]) 
    guiSetFont(qianbao.label[1], "default-bold-small") 
    guiLabelSetColor(qianbao.label[1], 247, 246, 121) 
    guiLabelSetHorizontalAlign(qianbao.label[1], "center", true) 
    guiLabelSetVerticalAlign(qianbao.label[1], "center") 
     
    qianbao.label[2] = guiCreateLabel(0.34, 0.38, 0.48, 0.23,"请登录!", true, qianbao.window[1]) 
    guiSetText ( qianbao.label[2], qian ) 
    guiLabelSetColor(qianbao.label[2], 213, 72, 92) 
    guiLabelSetVerticalAlign(qianbao.label[2], "center") 
     
    qianbao.staticimage[1] = guiCreateStaticImage(0.04, 0.18, 0.92, 0.76, ":login_mysql/images/qianbao.png", true, qianbao.window[1]) 
    guiSetAlpha(qianbao.staticimage[1], 0.23)           
    guiSetProperty(qianbao.button[1], "NormalTextColour", "FFAAAAAA") 
end) 
  
addEventHandler( "moneyn", getRootElement(), 
function(qian) 
    bindKey("F5", "down", 
    function() 
        toggleWindow() 
    end)   
end 
) 
  
function toggleWindow() 
    guiSetVisible(qianbao.window[1], not guiGetVisible(qianbao.window[1])) 
    showCursor(guiGetVisible(qianbao.window[1])) 
end 
  

Server:

addEventHandler("onPlayerJoin", getRootElement(), 
    function() 
setTimer(function() 
    handler = mysql_connect( host, username, password, db ) 
if handler then 
local result = mysql_query(handler, "SELECT Money FROM players WHERE Username='crazyde21'")-- Execute the query 
for result,row in mysql_rows(result) do -- Iterate through all the result rows 
  mysql_field_seek(result, 1) -- Reset the field cursor to the first field 
  for k,qian in ipairs(row) do 
    local field = mysql_fetch_field(result) -- Retreive the field data 
 triggerClientEvent(source,"moneyn",getRootElement(),qian) 
  end 
  end 
  end 
  end,10000,0) 
    end 
    ) 

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

I'm not sure i understand what you meant but, use "both" in keyState argument of the bindKey function.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted
    bindKey("F5", "down", 
    function() 
        toggleWindow() 
    end)   

What's the point of creating another function? you can just bind it to "toggleWindow" function.

bindKey ( "F5", "down", toggleWindow ) 

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