Lukkaz Posted May 30, 2011 Share Posted May 30, 2011 Hey everyone I was just wondering how I can get the distance from an object model, for example a safe. What functions could I use to determine where it is for the getDistanceBetween3d function. example: x,y,z = getElementPosition(getLocalPlayer()) wx,wy,wz = (idk what goes here) local dis = getDistanceBetweenPoints3D(x,y,z,wx,wy,wz) if dis >5 then outputChatbox("your not near a safe") else outputChatBox ("you ARE near a safe") Can someone help me out here? Link to comment
Aibo Posted May 30, 2011 Share Posted May 30, 2011 local x,y,z = getElementPosition(getLocalPlayer()) local wx,wy,wz = getElementPosition(safeObject) local dis = getDistanceBetweenPoints3D(x,y,z,wx,wy,wz) if dis >5 then outputChatBox("your not near a safe") else outputChatBox ("you ARE near a safe") end Link to comment
Lukkaz Posted May 30, 2011 Author Share Posted May 30, 2011 local x,y,z = getElementPosition(getLocalPlayer()) local wx,wy,wz = getElementPosition(safeObject) ---is that the model ID of the object? local dis = getDistanceBetweenPoints3D(x,y,z,wx,wy,wz) if dis >5 then outputChatBox("your not near a safe") else outputChatBox ("you ARE near a safe") end Link to comment
Castillo Posted May 30, 2011 Share Posted May 30, 2011 safeObject = createObject(args..) Link to comment
qaisjp Posted May 30, 2011 Share Posted May 30, 2011 local safeObject = createObject(1337, 0, 0, 0) local x,y,z = getElementPosition(getLocalPlayer()) local wx,wy,wz = getElementPosition(safeObject) local dis = getDistanceBetweenPoints3D(x,y,z,wx,wy,wz) if dis >5 then outputChatBox("your not near a safe") else outputChatBox ("you ARE near a safe") end safeObject is the safe OBJECT. Is the safe object already made? If so, copy the createObject line. 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