Jump to content

onClientClick


Arsilex

Recommended Posts

Posted

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

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

osea es asi

function bla bla bla() 
     if getElementType(clickedWorld) == "vehicle" then 
          GUi bla bla bla 
  
     end 
end 

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted
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) 

Developer @ MYVAL

Posted

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 xD

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted
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 xD

Si, tambien recuerda poner los argumentos a la funcion.

Developer @ MYVAL

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

Developer @ MYVAL

Posted

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) 

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted
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) 

Developer @ MYVAL

Posted

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

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

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 

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.

  • Recently Browsing   0 members

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