Jump to content

help gui


Recommended Posts

because the panel does not close

what is the problem: (

server

auto1 = createVehicle ( 425, 2296.1000976563, 462.5, 12.699999809265 
, 0,  0, 0 ) 
setVehicleDamageProof ( auto1, true ) 
  
auto2 = createVehicle ( 520, 2326.5083007813, 461.42266845703, 12.5, 0, 0, 0 ) 
setVehicleDamageProof ( auto2, true ) 
  
auto3 = createVehicle ( 411, 2390.6999511719, 447.39999389648, 11.39999961853, 340, 0, 90 ) 
setVehicleDamageProof ( auto3, true ) 
setVehicleColor ( auto3, 81, 84, 89 ) 
  
auto4 = createVehicle ( 411, 2390.5, 459.10000610352, 11.39999961853, 339.99938964844, 0, 90 ) 
setVehicleDamageProof ( auto4, true ) 
setVehicleColor ( auto4, 0, 0, 255 ) 
  
auto5 = createVehicle ( 451, 2390.6999511719, 470.29998779297, 10.961318969727, 339.99938964844, 0, 90 ) 
setVehicleDamageProof ( auto5, true ) 
setVehicleColor ( auto5, 63, 147, 12 ) 
  
auto6 = createVehicle ( 451, 2391.1000976563,483.29998779297, 10.961318969727, 339.99938964844, 0, 90 ) 
setVehicleDamageProof ( auto6, true ) 
setVehicleColor ( auto6, 251, 31, 6 ) 
  
auto7 = createVehicle ( 432,  2391.796875, 545.5048828125, 11, 0, 0, 180 ) 
setVehicleDamageProof ( auto7, true ) 
setVehicleColor ( auto7, 251, 31, 6 ) 
  
  
function panel ( player, seat, jacked ) 
    if ( seat == 0 and source == auto or source == auto1 or source == auto2 or source == auto3 or source == auto4 or source == auto5 or source == auto6 or source == auto7 ) then -- Aca tenias que checkear si el asiento era "0", no si no era "0". 
        local accountName = getAccountName ( getPlayerAccount ( player ) ) 
        if ( not isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Consesionaria" ) ) ) then 
            cancelEvent ( ) 
    triggerClientEvent ( "panel", getRootElement() ) 
        end 
    end 
end 
addEventHandler ( "onVehicleStartEnter", root, panel ) 

client

    function draw() 
        dxDrawRectangle(215, 144, 396, 385, tocolor(0, 0, 0, 140), false) 
        dxDrawRectangle(215, 144, 396, 21, tocolor(0, 0, 0, 255), true) 
        dxDrawLine(214, 143, 611, 143, tocolor(70, 70, 70, 255), 1, true) 
        dxDrawLine(215, 529, 612, 529, tocolor(70, 70, 70, 255), 1, true) 
        dxDrawLine(213, 143, 213, 530, tocolor(70, 70, 70, 255), 1, true) 
        dxDrawLine(611, 144, 611, 531, tocolor(70, 70, 70, 255), 1, true) 
        dxDrawLine(215, 165, 612, 165, tocolor(70, 70, 70, 255), 1, true) 
        dxDrawText("Vehicle Shop", 296, 139, 686, 165, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false) 
        dxDrawRectangle(228, 242, 365, 256, tocolor(255, 255, 255, 255), false) 
        dxDrawLine(503, 180, 593, 180, tocolor(4, 25, 232, 254), 1, true) 
        dxDrawLine(503, 222, 593, 222, tocolor(4, 25, 232, 254), 1, true) 
        dxDrawLine(502, 180, 502, 223, tocolor(4, 25, 232, 254), 1, true) 
        dxDrawLine(593, 180, 593, 223, tocolor(4, 25, 232, 254), 1, true) 
        dxDrawText("Cerrar", 502, 190, 617, 218, tocolor(251, 251, 254, 254), 0.80, "bankgothic", "left", "top", false, false, true, false, false) 
        dxDrawText("Vehicle :", 225, 170, 333, 196, tocolor(251, 251, 254, 254), 0.70, "bankgothic", "left", "top", false, false, true, false, false) 
        dxDrawText("Latin Server", 218, 508, 412, 539, tocolor(5, 110, 239, 254), 0.80, "bankgothic", "left", "top", false, false, true, false, false) 
        dxDrawText("Vehiculo En Venta", 234, 249, 583, 282, tocolor(12, 27, 139, 254), 0.70, "bankgothic", "left", "top", false, false, true, false, false) 
        dxDrawText("Si Deseas Adquirir Este vehiculo ", 234, 300, 583, 333, tocolor(4, 3, 3, 254), 0.60, "bankgothic", "left", "top", false, false, true, false, false) 
        dxDrawText("Esta Disponible en nuestro Foro", 234, 338, 583, 371, tocolor(4, 3, 3, 254), 0.60, "bankgothic", "left", "top", false, false, true, false, false) 
        dxDrawText("Informate de Todo lo necesario en :", 234, 371, 583, 404, tocolor(4, 3, 3, 254), 0.60, "bankgothic", "left", "top", false, false, true, false, false) 
        dxDrawText("http://latinserver.nuevoforo.es/", 234, 414, 583, 447, tocolor(4, 3, 3, 254), 0.60, "bankgothic", "left", "top", false, false, true, false, false) 
        dxDrawText("https://www.facebook.com/groups/187411881390218/", 238, 485, 587, 518, tocolor(2, 43, 99, 254), 0.40, "bankgothic", "left", "top", false, false, true, false, false) 
    end 
  
  
  
function panel() 
        cerrar = guiCreateButton(503, 182, 89, 40, "", false) 
        guiSetAlpha(cerrar, 100)  
addEventHandler("onClientRender", root, draw)    
end      
addEvent("panel", true) 
addEventHandler("panel", getRootElement(), panel) 
  
  
function qpanel() 
if (guiGetVisible (cerrar) == true) then  
guiSetVisible(cerrar,false)         
removeEventHandler("onClientRender", root, draw) 
end 
end 
addEventHandler("onClientGUIClick", cerrar, qpanel) 
  

Link to comment
buttons = { } 
  
function panel() 
    buttons[1] = guiCreateButton(503, 182, 89, 40, "", false) 
    guiSetVisible ( buttons[1], true ) 
    guiSetAlpha(buttons[1], 100) 
    addEventHandler("onClientRender", root, draw)    
end     
addEvent("panel", true) 
addEventHandler("panel", getRootElement(), panel) 
  
  
function qpanel() 
    if ( source == buttons[1] and guiGetVisible (buttons[1]) ) then 
        guiSetVisible(buttons[1], false)         
        removeEventHandler("onClientRender", root, draw) 
    end 
end 
addEventHandler("onClientGUIClick", buttons[1], qpanel) 

Check this out.

Link to comment

Since the button gets created when you trigger panel évent, thats why onClientGUIClick couldn't get the gui élément ( button ). So WhoamI added a check

  if ( source == buttons[1] and guiGetVisible (buttons[1]) ) then 

and used table so source is always defined. This is what he fixed.

Link to comment
buttons = { } 
  
function panel ( ) 
    buttons[1] = guiCreateButton ( 503, 182, 89, 40, "", false ) 
    guiSetVisible ( buttons[1], true ) 
    guiSetAlpha ( buttons[1], 1 ) 
    addEventHandler ( "onClientRender", root, draw )    
end     
addEvent ( "panel", true ) 
addEventHandler ( "panel", root, panel ) 
  
  
function qpanel() 
    if ( source == buttons[1] ) then 
        if ( guiGetVisible ( buttons[1] ) ) then 
            guiSetVisible ( buttons[1], false )         
            removeEventHandler ( "onClientRender", root, draw ) 
        end 
    end 
end 
addEventHandler ( "onClientGUIClick", resourceRoot, qpanel ) 

This is it. In guiSetAlpha the maximal amount of 2nd argument is 1.

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