JeViCo Posted April 27, 2018 Posted April 27, 2018 Hello everyone! My code doesn't work for unknown reason: addCommandHandler("ivi",function() det = getAttachedElements(getPedOccupiedVehicle(localPlayer)) for u , num in ipairs(det) do outputDebugString(tostring(num)) end end) Any ideas? Maybe i'm doing something wrong\\\
LLCoolJ Posted April 27, 2018 Posted April 27, 2018 Your code works.Are you sure that you have attached elements to vehicle? addCommandHandler("ivi",function() det = getAttachedElements(getPedOccupiedVehicle(localPlayer)) if #det > 0 then for k,v in ipairs(det) do outputDebugString(tostring(v)) end else outputChatBox("no elements were attached") end end) or addCommandHandler("ivi",function() det = getAttachedElements(getPedOccupiedVehicle(localPlayer)) iprint(det) end) 1
JeViCo Posted April 27, 2018 Author Posted April 27, 2018 1 hour ago, IRBIS said: Your code works.Are you sure that you have attached elements to vehicle? addCommandHandler("ivi",function() det = getAttachedElements(getPedOccupiedVehicle(localPlayer)) if #det > 0 then for k,v in ipairs(det) do outputDebugString(tostring(v)) end else outputChatBox("no elements were attached") end end) or addCommandHandler("ivi",function() det = getAttachedElements(getPedOccupiedVehicle(localPlayer)) iprint(det) end) i forgot that i used setElementParent instead. I added attachElements and it works now. Thank you! but now it is not attaches properly\ soo how can i use only setElementParent to detect objects? getElementParent can return only a vehicle - not a vehicle attached part
JeViCo Posted April 28, 2018 Author Posted April 28, 2018 6 hours ago, IRBIS said: getElementChildren Thanks!
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