Jump to content

nilsathp

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by nilsathp

  1. Yes, thank you very much, this is the solution!
  2. I have a little but annoying problem with my script. It´s my first GUI script. The script should close the window after i´ve pressed the button close. The cursor is not visible anymore and I can play the game, but the window is still in the middle of my screen and it isn´t closing, although I´ve written the code in my script: guiSetVisible(gui, false) Here is the whole script: (You can find the problem at the end of the script) local gui = {} function GUI() gui._placeHolders = {} local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 531, 452 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 gui["_root"] = guiCreateWindow(left, top, windowWidth, windowHeight, "Spawnpunkt - Login", false) guiWindowSetSizable(gui["_root"], false) gui["pushButton"] = guiCreateButton(80, 283, 371, 28, "Airport Los Santos", false, gui["_root"]) if on_pushButton_clicked then addEventHandler("onClientGUIClick", gui["pushButton"], on_pushButton_clicked, false) end gui["pushButton_3"] = guiCreateButton(80, 167, 371, 28, "Airport San Fierro", false, gui["_root"]) if on_pushButton_3_clicked then addEventHandler("onClientGUIClick", gui["pushButton_3"], on_pushButton_3_clicked, false) end gui["pushButton_4"] = guiCreateButton(80, 109, 371, 28, "CJ´s Hood", false, gui["_root"]) if on_pushButton_4_clicked then addEventHandler("onClientGUIClick", gui["pushButton_4"], on_pushButton_4_clicked, false) end gui["pushButton_2"] = guiCreateButton(80, 225, 371, 28, "Airport Las Venturas", false, gui["_root"]) if on_pushButton_2_clicked then addEventHandler("onClientGUIClick", gui["pushButton_2"], on_pushButton_2_clicked, false) end gui["pushButton_5"] = guiCreateButton(420, 425, 101, 21, "login", false, gui["_root"]) if on_pushButton_5_clicked then addEventHandler("onClientGUIClick", gui["pushButton_5"], on_pushButton_5_clicked, false) end gui["pushButton_6"] = guiCreateButton(80, 355, 121, 23, "OK", false, gui["_root"]) if on_pushButton_6_clicked then addEventHandler("onClientGUIClick", gui["pushButton_6"], on_pushButton_6_clicked, false) end return gui, windowWidth, windowHeight end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () GUI() guiSetVisible(gui, true) showCursor(true) guiSetInputEnabled(true) end ) function on_pushButton_clicked(button, state, absoluteX, absoluteY) if (button ~= "left") or (state ~= "up") then return end --TODO: Implement your button click handler here triggerServerEvent("spawnLosSantos", getRootElement(), username, password) end function on_pushButton_3_clicked(button, state, absoluteX, absoluteY) if (button ~= "left") or (state ~= "up") then return end --TODO: Implement your button click handler here triggerServerEvent("spawnSanFierro", getRootElement(), username, password) end function on_pushButton_4_clicked(button, state, absoluteX, absoluteY) if (button ~= "left") or (state ~= "up") then return end --TODO: Implement your button click handler here triggerServerEvent("spawnCJ", getRootElement(), username, password) end function on_pushButton_2_clicked(button, state, absoluteX, absoluteY) if (button ~= "left") or (state ~= "up") then return end --TODO: Implement your button click handler here triggerServerEvent("spawnVenturas", getRootElement(), username, password) end function on_pushButton_5_clicked(button, state, absoluteX, absoluteY) if (button ~= "left") or (state ~= "up") then return end --TODO: Implement your button click handler here triggerServerEvent("doLogin", getRootElement(), username, password) end function on_pushButton_6_clicked(button, state, absoluteX, absoluteY) if (button ~= "left") or (state ~= "up") then return end --TODO: Implement your button click handler here function hideGUI() guiSetVisible(gui, false) showCursor(false) guiSetInputEnabled(false) end addEventHandler ( "onClientGUIClick", gui["pushButton_6"], hideGUI, false ) end I don´t get any warnings or errors... I thank you in advance, nilsathp
×
×
  • Create New...