tosfera Posted February 18, 2013 Share Posted February 18, 2013 HEy, I was asking myself, can you get an attached object? Like, I'll create a marker @ 0,0,0 (position) and a box at 5, 5, 5. I'll use a forklift to grab and lift the box, and when I hit the marker it has to say like; good job! you are holding the object: . I've no idea if that is possible, if it is. Does anyone have a idea how to check it? Link to comment
tosfera Posted February 18, 2013 Author Share Posted February 18, 2013 getAttachedElements woow, please punch me in the face. Going to try it, thanks! Link to comment
csiguusz Posted February 18, 2013 Share Posted February 18, 2013 /me punches tosfera in the face And you are welcome Link to comment
tosfera Posted February 18, 2013 Author Share Posted February 18, 2013 /me punches tosfera in the faceAnd you are welcome Keep getting the message;"You need to pickup the supplies first!" addEventHandler("onClientMarkerLeave", root, function ( hitElement ) local v = getPedOccupiedVehicle ( hitElement ) local element = getElementAttachedTo ( v ) local object = getAttachedElements ( element ) if object then outputChatBox("ok!") else outputChatBox("You need to pickup the supplies first!") end end ) results I got back: local v = userdata local element = false local object = false Link to comment
csiguusz Posted February 18, 2013 Share Posted February 18, 2013 For the "element" variable: i think your vehicle is not attached to any element, why do you want to get it? getAttachedElements returns a table. Link to comment
tosfera Posted February 18, 2013 Author Share Posted February 18, 2013 For the "element" variable: i think your vehicle is not attached to any element, why do you want to get it?getAttachedElements returns a table. Thats the point, is an object getting attached to a forklift if you try to lift it? Link to comment
csiguusz Posted February 18, 2013 Share Posted February 18, 2013 I don't think its easy (if not possible) to check if the forklift is trying to lift an object. Link to comment
tosfera Posted February 18, 2013 Author Share Posted February 18, 2013 (edited) Wonder wat 50p or SolidSnake has to say about this... Edited February 18, 2013 by Guest Link to comment
csiguusz Posted February 18, 2013 Share Posted February 18, 2013 (edited) 50p* I also got some ideas how to do it, but can't try it now, just tomorrow... Edited February 18, 2013 by Guest Link to comment
tosfera Posted February 18, 2013 Author Share Posted February 18, 2013 50p*I also got some ideas how to it, but can't try it now, just tomorrow... Would be awesome, I do have an idea how to fix it in another way, but that isn't rly realistic. Link to comment
Castillo Posted February 19, 2013 Share Posted February 19, 2013 For the "element" variable: i think your vehicle is not attached to any element, why do you want to get it?getAttachedElements returns a table. Thats the point, is an object getting attached to a forklift if you try to lift it? No as far as I know, the only way would be attaching it yourself. Link to comment
50p Posted February 19, 2013 Share Posted February 19, 2013 You can only do it with attachments. It's not that hard to do but if you want some advanced system then you'd have to spend some more time. I've seen this video on youtube some time ago: /me punches tosfera in the faceAnd you are welcome Keep getting the message;"You need to pickup the supplies first!" addEventHandler("onClientMarkerLeave", root, function ( hitElement ) local v = getPedOccupiedVehicle ( hitElement ) local element = getElementAttachedTo ( v ) local object = getAttachedElements ( element ) if object then outputChatBox("ok!") else outputChatBox("You need to pickup the supplies first!") end end ) ... local v = userdata local element = false -- reason is you're getting what element your vehicle is attached to, your vehicle is not attached to anything so it returns false local object = false -- this is obvious, if element is false then getAttachedElements will return false too Link to comment
tosfera Posted February 19, 2013 Author Share Posted February 19, 2013 Thanks Solid and 50p for clearing it up; An element in not being attached tot he forklift when you're trying to pick it up. Time to write my other idea now :3 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