Jump to content

Pregunta sobre Cursor (Mouse)


JuanM27

Recommended Posts

Posted

hola quiera saber como puedo poner un cursor custom,

eh visto varios servidores mta que usan un efecto en el mouse,

busque en el wiki sobre "mouse" y como "Cursor"

pero no encontre nada relacionado a lo que yo ando buscando...

no pido que me den un script o ejemplo, simplemente pregunto sobre que funciones y / o eventos se usan para lograr esos efectos o remplazar el cursor.

saludos

Posted
Usa:
getCursorPosition 
isCursorShowing 
dxDrawImage 
"onClientRender" 
--No se si también, pero prueba con 
"onClientCursorMove" 

gracias, ahora voy a ver si me sale hacerlo,

gracias por responder alex

Posted

bueno tengo un pequeño problema....

logre hacer que se ponga una imagen y se mueva con el mouse..

addEventHandler( "onClientRender", root, 
    function() 
        if isCursorShowing() then 
            
          local screenx, screeny, worldx, worldy = getCursorPosition() 
               dxDrawImage ( worldx, worldy, 15, 15, "cursor.png",0, 0, 0,tocolor( 255, 0, 0, 255 ),false) 
           
        end 
    end 
) 

addEventHandler( "onClientCursorMove", getRootElement( ), 
    function ( _, _, x, y ) 
     if isCursorShowing() then 
        dxDrawImage ( x, y, 15, 15, "cursor.png",0, 0, 0,tocolor( 255, 0, 0, 255 ),false) 
        end 
    end 
) 

el problema que tengo es que cuando el mouse se queda quieto la imagen desaparece y solo se muestra cuando se mueve el mouse...

como tendria que hacer para que la imagen siempre este visible cuando el isCursorShowing sea True?

Posted
El problema se da en ambos códigos?

lo estoy probando por separado, y solo funciona el evento "onClientCursorMove",

el otro por mas que el mouse este activo no muestra la imagen.

Posted
addEventHandler( "onClientRender", root, 
    function() 
        if isCursorShowing() then 
            
          local screenx, screeny, worldx, worldy, worldz = getCursorPosition() 
               dxDrawImage ( screenx, screenyx, 16, 16, "cursor.png",0, 0, 0,tocolor( 255, 0, 0, 255 ),false) 
           
        end 
    end 
) 

Posted
addEventHandler( "onClientRender", root, 
    function() 
        if isCursorShowing() then 
            
          local screenx, screeny, worldx, worldy, worldz = getCursorPosition() 
               dxDrawImage ( screenx, screenyx, 16, 16, "cursor.png",0, 0, 0,tocolor( 255, 0, 0, 255 ),false) 
           
        end 
    end 
) 

sigue sin funcionar.

Posted

Error en el debug?

Intenta:

local w, h = guiGetScreenSize () 
addEventHandler( "onClientRender", root, 
    function() 
        if isCursorShowing() then 
          local screenx, screeny, worldx, worldy, worldz = getCursorPosition() 
               dxDrawImage ( screenx*w, screeny*h, 16, 16, "cursor.png",0, 0, 0,tocolor( 255, 0, 0, 255 ),true) 
           
        end 
    end 
) 
  

Posted
Error en el debug?

Intenta:

local w, h = guiGetScreenSize () 
addEventHandler( "onClientRender", root, 
    function() 
        if isCursorShowing() then 
          local screenx, screeny, worldx, worldy, worldz = getCursorPosition() 
               dxDrawImage ( screenx*w, screeny*h, 16, 16, "cursor.png",0, 0, 0,tocolor( 255, 0, 0, 255 ),true) 
           
        end 
    end 
) 
  

Perfecto Alex, Muchas gracias. anda joya..

por lo que vi es que le faltaba el guiGetScreenSize

y bueno sobre tu pregunta... (ya no tiene sentido responder) pero igual te respondo..

en dubugscript no tiraba ningun error.

pero asi anda joya, y bueno gracias de nuevo.

  • Recently Browsing   0 members

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