Arsilex Posted August 14, 2012 Share Posted August 14, 2012 Como hacer para que cuando un player presione doble click encima de un coche le salga un panel osea que devo usar se que se usa onClientClick pero como le doy señal que esta clickeando en un caro ._.? Link to comment
Alexs Posted August 14, 2012 Share Posted August 14, 2012 El Parametro "clickedWorld" te podria servir Para saber si es un carro algo asi: if getElementType(clickedWorld) == "vehicle" then Link to comment
Arsilex Posted August 14, 2012 Author Share Posted August 14, 2012 osea es asi function bla bla bla() if getElementType(clickedWorld) == "vehicle" then GUi bla bla bla end end Link to comment
Arsilex Posted August 14, 2012 Author Share Posted August 14, 2012 digo que si no hace falta mas? osea con eso ya al presionar en un coche ya funciona no? Link to comment
Alexs Posted August 14, 2012 Share Posted August 14, 2012 digo que si no hace falta mas?osea con eso ya al presionar en un coche ya funciona no? Pues, no deberia, a pesar de tu burdo ejemplo. function blablabla( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld ) if getElementType(clickedWorld) == "vehicle" then guiSetVisible(esosargumentos) end end addEventHandler("onClientClick", getLocalPlayer(), blablabla) Link to comment
Arsilex Posted August 14, 2012 Author Share Posted August 14, 2012 jeje eso lo se de evento y tal digo que con if getElementType(clickedWorld) == "vehicle" then ya al presionar sale lo que ponga en la funcion Link to comment
Alexs Posted August 14, 2012 Share Posted August 14, 2012 jeje eso lo se de evento y tal digo que con if getElementType(clickedWorld) == "vehicle" thenya al presionar sale lo que ponga en la funcion Si, tambien recuerda poner los argumentos a la funcion. Link to comment
Arsilex Posted August 14, 2012 Author Share Posted August 14, 2012 osea el argumento es onClientClick no ? Link to comment
Alexs Posted August 14, 2012 Share Posted August 14, 2012 button: This refers the button used to click on the mouse, can be left, right, or middle' state: This can be used to tell if the user released or pressed the mouse button, where up is passed if the button is released, and down is passed if the button is pushed absoluteX: This refers to the 2D x coordinate the user clicked on his screen, and is an absolute position in pixels. absoluteY: This refers to the 2D y coordinate the user clicked on his screen, and is an absolute position in pixels. worldX: This represents the 3D x coordinate the player clicked on the screen, and is relative to the GTA world. worldY: This represents the 3D y coordinate the player clicked on the screen, and is relative to the GTA world. worldZ: This represents the 3D z coordinate the player clicked on the screen, and is relative to the GTA world. clickedWorld: This represents any physical entity elements that were clicked. If the player clicked on no MTA element, it's set to false. Esos, agregalos arriba en los parentesis. Link to comment
Arsilex Posted August 14, 2012 Author Share Posted August 14, 2012 olle maxo no me funciona mira function Coche( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld ) if getElementType(clickedWorld) == "vehicle" then guiSetVisible(Coches) Coches = guiCreateWindow(0.2101,0.1549,0.1149,0.3945,"Opciones de coche",true) X = guiCreateButton(0.2247,0.4557,0.0893,0.0534,"Cerrar",true,Coches) Park = guiCreateButton(0.2247,0.1888,0.0893,0.0534,"Aparcar",true,Coches) Multar = guiCreateButton(0.2247,0.3203,0.0893,0.0534,"Multar",true,Coches) end end addEventHandler("onClientClick", getLocalPlayer(), Coche) Link to comment
Alexs Posted August 14, 2012 Share Posted August 14, 2012 Coches = guiCreateWindow(0.2101,0.1549,0.1149,0.3945,"Opciones de coche",true) X = guiCreateButton(0.2247,0.4557,0.0893,0.0534,"Cerrar",true,Coches) Park = guiCreateButton(0.2247,0.1888,0.0893,0.0534,"Aparcar",true,Coches) Multar = guiCreateButton(0.2247,0.3203,0.0893,0.0534,"Multar",true,Coches) guiSetVisible(Coches, false) function Coche( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld ) if getElementType(clickedWorld) == "vehicle" then guiSetVisible(Coches, true) end end addEventHandler("onClientClick", getLocalPlayer(), Coche) Link to comment
Arsilex Posted August 14, 2012 Author Share Posted August 14, 2012 nada se quedo igual function Coche( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld ) if getElementType(clickedWorld) == "vehicle" then if ( not isElement ( Coches ) ) then Cochess ( ) else guiSetVisible ( Coches, not guiGetVisible ( Coches ) ) end end end addEventHandler("onClientClick", getLocalPlayer(), Coche) function Cochess() Coches = guiCreateWindow(0.2101,0.1549,0.1149,0.3945,"Opciones de coche",true) X = guiCreateButton(0.2247,0.4557,0.0893,0.0534,"Cerrar",true,Coches) Park = guiCreateButton(0.2247,0.1888,0.0893,0.0534,"Aparcar",true,Coches) Multar = guiCreateButton(0.2247,0.3203,0.0893,0.0534,"Multar",true,Coches) end hize esto y tampoco Link to comment
Arsilex Posted August 15, 2012 Author Share Posted August 15, 2012 Alguen me dice por que no funciona eso? Link to comment
Arsilex Posted August 15, 2012 Author Share Posted August 15, 2012 Alguen me dice que no funciona ? Link to comment
Alexs Posted August 15, 2012 Share Posted August 15, 2012 No hagas tantos post's seguidos, si al segundo (que ya es anti reglamentario) no te responden, ya no lo haran. Link to comment
Arsilex Posted August 15, 2012 Author Share Posted August 15, 2012 entonces nadie me ayudara?.. Link to comment
Alexs Posted August 15, 2012 Share Posted August 15, 2012 entonces nadie me ayudara?.. Creo que no. Link to comment
Castillo Posted August 16, 2012 Share Posted August 16, 2012 El principal problema es que pusiste: getLocalPlayer ( ) en el addEventHandler , pero ahi tenia que ir 'root', el segundo problema era que tenias que verificar si el estado del click era "down", porque si no iva a abrirse y cerrarse. function Coche ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld ) if ( state == "down" and clickedWorld and getElementType ( clickedWorld ) == "vehicle" ) then if ( not isElement ( Coches ) ) then Cochess ( ) else guiSetVisible ( Coches, not guiGetVisible ( Coches ) ) end end end addEventHandler ( "onClientClick", root, Coche ) function Cochess ( ) Coches = guiCreateWindow(0.2101,0.1549,0.1149,0.3945,"Opciones de coche",true) X = guiCreateButton(0.2247,0.4557,0.0893,0.0534,"Cerrar",true,Coches) Park = guiCreateButton(0.2247,0.1888,0.0893,0.0534,"Aparcar",true,Coches) Multar = guiCreateButton(0.2247,0.3203,0.0893,0.0534,"Multar",true,Coches) end Link to comment
Recommended Posts