Jump to content

onClientClick


Arsilex

Recommended Posts

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

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

nada se quedo igual :S

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...