Jump to content

Mouse Click to object


Jumper_Mych

Recommended Posts

Posted

... who you think you are? the U.S President or what?

You could ask it nicely and you would get replys faster.

P.S: what are you trying to do? when click a object show a GUI? if yes use the event onClientClick and showCursor/bindKey for the mouse stuff.

https://wiki.multitheftauto.com/wiki/OnClientClick

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.

Posted

... what do you mean?

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.

Posted

huh.. doesn't work type /mouse next nothing

function Mouse ( player ) 
    showCursor ( player, true )  
    else 
    showCursor ( player, false ) 
addCommandHandler ( "mouse", Mouse) 

Doesn't work

local myobject = createObject ( 1300, 2188.064453125, 40.50089263916, 25.705852508545, 0, 0, 0 ) 
  
function addObjectOnClick ( button, state, clickedElement ) 
        if ( clickedElement ) then 
                local elementType = getElementType ( clickedElement ) 
                guiSetText ( myobject, elementType ) 
        guiwin = guiCreateWindow ( 0, 0, 0.5, 0.4, "Information", true ) 
        button = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Close", true, guiwin ) 
        guiSetVisible ( clickedElement, false ) 
    else 
        guiSetVisible ( clickedElement, true ) 
        end 
end 
addEventHandler ( "onClientClick", getRootElement(), addObjectOnClick ) 

VINEWOOD

Posted

Seriously, you should learn LUA. Not random typing. Where's if-then-else -end?

function Mouse ( player ) 
    if not isCursorShowing ( player ) then 
        showCursor ( player, true )  
    else 
        showCursor ( player, false ) 
    end 
end 
addCommandHandler ( "mouse", Mouse) 

This is wrong, check https://wiki.multitheftauto.com/wiki/OnClientClick

function addObjectOnClick ( button, state, clickedElement ) 
... 
addEventHandler ( "onClientClick", getRootElement(), addObjectOnClick ) 

Wtf is this? You're setting text on an object? guiSetText works ONLY on gui labels (guiCreateLabel)

local myobject = createObject ( 1300, 2188.064453125, 40.50089263916, 25.705852508545, 0, 0, 0 ) 
... 
                guiSetText ( myobject, elementType ) 

How is this supposed to work?

function addObjectOnClick ( button, state, clickedElement ) 
    if ( clickedElement ) then 
        ... 
        guiSetVisible ( clickedElement, false ) 
    else 
        guiSetVisible ( clickedElement, true ) 
    end 
end 

Learn Lua - Learn to script - GUI scripting

Scripter tools - Find/fix errors yourself(!)

Don't pm me for scripting help, keep it for the Scripting subforum!

Posted

Sorry change to dxDrawText not gui :mrgreen:

And my code doesn't work

local screenWidth, screenHeight = guiGetScreenSize() -- Get the screen resolution 
local myobject = createObject ( 1300, 2188.064453125, 40.50089263916, 25.705852508545, 0, 0, 0 ) 
  
function addObjectOnClick ( player ) 
    if theButton == "left" then 
        dxDrawText( "Object id 1300", 44, screenHeight-41, screenWidth, screenHeight, tocolor(255,200,0,255), 1.02, "clear" ) 
            guiSetVisible ( theButton, false ) 
        else 
            guiSetVisible ( theButton, true ) 
    end 
end 
addEventHandler ( "onClientClick", getRootElement(), addObjectOnClick ) 

Own worth learning LUA. because week for me I was not at my home because forgotten lua

Maybe explained to me how work

because i weak gui therefore teach me maybe understand

VINEWOOD

Posted
Sorry change to dxDrawText not gui :mrgreen:

And my code doesn't work

local screenWidth, screenHeight = guiGetScreenSize() -- Get the screen resolution 
local myobject = createObject ( 1300, 2188.064453125, 40.50089263916, 25.705852508545, 0, 0, 0 ) 
  
function addObjectOnClick ( player ) 
    if theButton == "left" then 
        dxDrawText( "Object id 1300", 44, screenHeight-41, screenWidth, screenHeight, tocolor(255,200,0,255), 1.02, "clear" ) 
            guiSetVisible ( theButton, false ) 
        else 
            guiSetVisible ( theButton, true ) 
    end 
end 
addEventHandler ( "onClientClick", getRootElement(), addObjectOnClick ) 

Own worth learning LUA. because week for me I was not at my home because forgotten lua

Maybe explained to me how work

because i weak gui therefore teach me maybe understand

And where is the button?

Posted

1. You can't use dxDrawText and than guiSetVisible because it requires a GUI element.

2. You are missing some paremeters for the function.

3. I don't understand what you want to do but if you want that text stay on the player's screen all the time use onClientRender.If you do not provide it, the text will be rendered for one frame.

Posted

im not sure a pickup element generates click events, since it has no collision.

but i maybe wrong.

imo, you should start with simple pickup handler to display your window.

?

Posted

stop pressing all the buttons you can find, it will get you nowhere.

and i doubt anyone will understand your «Report» anyway

?

Posted

sorry my fault because earlier no i was check the onPickupHit but not is black board. I Want help me black board and type

Did you will help me?

My bad send report :(

VINEWOOD

Posted

omfg, i don't get a word of this guy.. what he's trying to do?

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.

Posted

"Noob" language translation to english:

"Hello, here I am and I want to make a house system with pickups that must be clicked to open the house status window.

And I want DX Drawing objects in the 3D world like in Dakilla's House System. Can you help me?"

Jumper_Mych: http://www.ajaxtrans.com

Posted

What the...? now i'm really confused :roll:

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.

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