Jump to content

[Help]Ped Click


Recommended Posts

there are no errors in console or debugscript but still its not working:-

function pedClick(button, state, x, y, fx, fy, fz, clickedElement) 
    if (button == "left" and state == "up") then 
        if  (clickedElement == "pedFreightJob") then 
        guiSetVisible(GUIEditor.window[1], true) 
        end 
    end 
end 
  
addEventHandler("onClientClick", root, pedClick) 
  
function cursorShowing(button, press) 
    if (button == "m") then 
        if (press == "false") then 
            showCursor(not isCursorShowing) 
        end 
    end 
end 
  
addEventHandler("onClientKey", root, cursorShowing) 

Edited by Guest
Link to comment
addEventHandler ( 'onClientClick',root, 
    function ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) 
        if  ( clickedElement ) and ( getElementType ( clickedElement )  == 'ped' ) then 
            if  ( clickedElement == pedFreightJob ) then 
                if ( guiGetVisible ( GUIEditor.window[1] ) == false ) then 
                    guiSetVisible ( GUIEditor.window[1],true ) 
                end 
            end 
        end 
    end 
) 
                 
bindKey ( 'm','down', 
    function (      ) 
        showCursor ( not isCursorShowing (      )   ) 
    end 
) 

Try that.

Link to comment
addEventHandler ( 'onClientClick',root, 
    function ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) 
        if  ( clickedElement ) and ( getElementType ( clickedElement )  == 'ped' ) then 
            if  ( clickedElement == pedFreightJob ) then 
                if ( guiGetVisible ( GUIEditor.window[1] ) == false ) then 
                    guiSetVisible ( GUIEditor.window[1],true ) 
                end 
            end 
        end 
    end 
) 
                 
bindKey ( 'm','down', 
    function (      ) 
        showCursor ( not isCursorShowing (      )   ) 
    end 
) 

Try that.

The showing cursor part works but clicking on ped part does not work.

Link to comment

Do you have any more PED except that one in the resource? If NO then you can modify it to :

addEventHandler ( 'onClientClick',root, 
    function ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) 
        if  ( clickedElement ) and ( getElementType ( clickedElement )  == 'ped' ) then 
            for _,ped in ipairs ( getElementsByType ( 'ped',resourceRoot ) ) do 
                if  ( clickedElement == ped ) then 
                    if ( guiGetVisible ( GUIEditor.window[1] ) == false ) then 
                        guiSetVisible ( GUIEditor.window[1],true ) 
                    end 
                end 
            end 
        end 
    end 
) 
                
bindKey ( 'm','down', 
    function (      ) 
        showCursor ( not isCursorShowing (      )   ) 
    end 
) 

And it should work as well .

Link to comment

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