Jump to content

Ped/NPC - Click


Absence2

Recommended Posts

How do I make a GUI window open when I right click on a Ped?

all I got is this:

local laura = createPed( 211, 1488.5498046875, 1305.8798828125, 1093.2963867188, 275 ) 
setElementDimension( laura, 0 ) 
setElementData( laura, "name", "Laura Fredriksen" ) 
setPedAnimation ( laura, "DEALER", "DEALER_IDLE_01", -1, true, false, false ) 
setElementFrozen(laura, true) 

I don't know how to go further :D, couldn't find much on wiki either

Link to comment

You should learn to use the 'search' feature, this question has been asked before.

viewtopic.php?f=91&t=35564&p=373950&hilit=onClientClick

function onPedClick(button, state, absX, absY, wx, wy, wz, element) 
    if (element and getElementType(element) == "ped" and state=="down") then 
        local x, y, z = getElementPosition(localPlayer) 
        if (getDistanceBetweenPoints3D(x, y, z, wx, wy, wz) <=3) then 
            guiSetVisible(myGUIElement, true) 
        end 
    end 
end 
addEventHandler("onClientClick", getRootElement(), onPedClick) 

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