Best-Killer Posted January 18, 2016 Share Posted January 18, 2016 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
#RooTs Posted January 18, 2016 Share Posted January 18, 2016 stolen code ? paste all code, please Link to comment
Tox Posted January 18, 2016 Share Posted January 18, 2016 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
starksZ Posted January 18, 2016 Share Posted January 18, 2016 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
Best-Killer Posted January 18, 2016 Author Share Posted January 18, 2016 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
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