Jump to content

onpedClick


Best-Killer

Recommended Posts

local peds = { } 
for i, v in ipairs ( locs ) do 
    local x, y, z, rot = unpack ( v ) 
    peds[i] = createPed ( 57, x, y, z, rot ) 
    exports.SAEGJobs:create3DText ( "Lottery", { x, y, z }, { 255, 255, 0 }, nil, { } ) 
    setElementFrozen ( peds[i], true ) 
    addEventHandler ( "onClientPedDamage", peds[i], cancelEvent ) 
end 
  
  
function onPedClick(button, state, absX, absY, wx, wy, wz, element) 
    if (element and getElementType(element) == "peds" and state=="down") then 
        local x, y, z = getElementPosition(localPlayer) 
        if (element == peds[i]) then 
            if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then 
                guiSetVisible(GUIEditor.window[1], true) 
                showCursor (true) 
           end 
        end 
    end 
end 
addEventHandler("onClientClick", root, onPedClick) 

0 Errors but when i click on ped the gui not showing

Link to comment
local peds = { } 
for i, v in ipairs ( locs ) do 
    local x, y, z, rot = unpack ( v ) 
    peds[i] = createPed ( 57, x, y, z, rot ) 
    exports.SAEGJobs:create3DText ( "Lottery", { x, y, z }, { 255, 255, 0 }, nil, { } ) 
    setElementFrozen ( peds[i], true ) 
    addEventHandler ( "onClientPedDamage", peds[i], cancelEvent ) 
end 
  
  
function onPedClick(button, state, absX, absY, wx, wy, wz, element) 
    if (element and getElementType(element) == "peds" and state=="down") then 
        local x, y, z = getElementPosition(localPlayer) 
        if (element == peds[i]) then 
            if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then 
                guiSetVisible(GUIEditor.window[1], true) 
                showCursor (true) 
           end 
        end 
    end 
end 
addEventHandler("onClientClick", root, onPedClick) 

0 Errors but when i click on ped the gui not showing

you should create a loop to use

   if (element == peds[i]) then 

in your onPedClick function, because there is no i in that function

Link to comment
local peds = { } 
for i, v in ipairs ( locs ) do 
    local x, y, z, rot = unpack ( v ) 
    peds[i] = createPed ( 57, x, y, z, rot ) 
    exports.SAEGJobs:create3DText ( "Lottery", { x, y, z }, { 255, 255, 0 }, nil, { } ) 
    setElementFrozen ( peds[i], true ) 
    addEventHandler ( "onClientPedDamage", peds[i], cancelEvent ) 
end 
  
  
function onPedClick(button, state, absX, absY, wx, wy, wz, element) 
    if (element and getElementType(element) == "ped" and state=="down") then -- is ped no peds 
        local x, y, z = getElementPosition(localPlayer) 
        if (element == peds[i]) then 
            if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then 
                guiSetVisible(GUIEditor.window[1], true) 
                showCursor (true) 
           end 
        end 
    end 
end 
addEventHandler("onClientClick", root, onPedClick) 

Link to comment
local peds = { } 
for i, v in ipairs ( locs ) do 
    local x, y, z, rot = unpack ( v ) 
    peds[i] = createPed ( 57, x, y, z, rot ) 
    exports.SAEGJobs:create3DText ( "Lottery", { x, y, z }, { 255, 255, 0 }, nil, { } ) 
    setElementFrozen ( peds[i], true ) 
    addEventHandler ( "onClientPedDamage", peds[i], cancelEvent ) 
end 
  
  
function onPedClick(button, state, absX, absY, wx, wy, wz, element) 
    if (element and getElementType(element) == "ped" and state=="down") then -- is ped no peds 
        local x, y, z = getElementPosition(localPlayer) 
        if (element == peds[i]) then 
            if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then 
                guiSetVisible(GUIEditor.window[1], true) 
                showCursor (true) 
           end 
        end 
    end 
end 
addEventHandler("onClientClick", root, onPedClick) 

Not Work

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