Axel Posted September 2, 2011 Posted September 2, 2011 How can i make.. when i click with the mouse on a ped a gui appears?
Mimimiguel Posted September 2, 2011 Posted September 2, 2011 try addEventHandler( "OnElementClicked", pedvar, yourfunction )
Castillo Posted September 3, 2011 Posted September 3, 2011 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(getLocalPlayer()) if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then guiSetVisible(myGUIElement, true) end end end addEventHandler("onClientClick", getRootElement(), onPedClick)
Axel Posted October 3, 2011 Author Posted October 3, 2011 I made 2 of those for 2 peds and now it shows the both gui's when i click on one of them..
NotAvailable Posted October 3, 2011 Posted October 3, 2011 I made 2 of those for 2 peds and now it shows the both gui's when i click on one of them.. --Made by Jesseunit --skin, name, x, y, z, rotationZ peds = { {115, "John", 0, 0, 3, 180} } for i = 1, #peds do ped = createPed(peds[i][1], peds[i][3], peds[i][4], peds[i][5]) setElementRotation(ped, 0, 0, peds[i][6]) setElementData(ped, "name", peds[i][2], true) end Then, when the player clicks on it, get his elementData and trigger the event by using triggerEvent/triggerServerEvent/triggerClientEvent. -- Made by Jesseunit function clickPed(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) if (clickedElement) and (getElementType(clickedElement) == "ped" ) then local x, y, z = getElementPosition(getLocalPlayer()) local wx, wy, wz = getElementPosition(clickedElement) local jij = getLocalPlayer() if (getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3) and (button == "right") and (state == "down" ) then local ped = getElementData(clickedElement, "name") if (ped=="John") then triggerEvent("showBarWnd", getLocalPlayer()) end end else return end end addEventHandler("onClientClick", getRootElement(), clickPed, true) Thats a part of my script. Please correct me if there is something wrong. EDIT: I'm in a good mood today, please dont ruin it by removing my tags.
Axel Posted October 3, 2011 Author Posted October 3, 2011 I used setElementData(tped,"name","John") and getElementData(tped,"name","John") at a if and it works. Thanks for the suggestion Jesse.
NotAvailable Posted October 4, 2011 Posted October 4, 2011 I used setElementData(tped,"name","John") and getElementData(tped,"name","John") at a if and it works. Thanks for the suggestion Jesse. No problem
weedsawq Posted August 28, 2017 Posted August 28, 2017 How can the client work?I do not know the client is working or not.Can you give OutputChatBox Also? To know the client is working.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now