tosfera Posted February 18, 2013 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? If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
csiguusz Posted February 18, 2013 Posted February 18, 2013 getAttachedElements Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
tosfera Posted February 18, 2013 Author Posted February 18, 2013 getAttachedElements woow, please punch me in the face. Going to try it, thanks! If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
csiguusz Posted February 18, 2013 Posted February 18, 2013 /me punches tosfera in the face And you are welcome Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
tosfera Posted February 18, 2013 Author 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 If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
csiguusz Posted February 18, 2013 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. Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
tosfera Posted February 18, 2013 Author 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? If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
csiguusz Posted February 18, 2013 Posted February 18, 2013 I don't think its easy (if not possible) to check if the forklift is trying to lift an object. Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
tosfera Posted February 18, 2013 Author Posted February 18, 2013 (edited) Wonder wat 50p or SolidSnake has to say about this... Edited February 18, 2013 by Guest If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
csiguusz Posted February 18, 2013 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 Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
tosfera Posted February 18, 2013 Author 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. If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
Castillo Posted February 19, 2013 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
50p Posted February 19, 2013 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 - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
tosfera Posted February 19, 2013 Author 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 If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
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