Feche1320 Posted January 9, 2011 Posted January 9, 2011 Is there a function that retrieves the player range from a specific cord? Thanks
Scooby Posted January 9, 2011 Posted January 9, 2011 range as in distance? since all weapons have different ranges. either: getDistanceBetweenPoints2D( float x1, float y1, float x2, float y2 ) getDistanceBetweenPoints3D( float x1, float y1, float z1, float x2, float y2, float z2 ) depending on what u need it for. for more info: https://wiki.multitheftauto.com/wiki/Get ... enPoints2D https://wiki.multitheftauto.com/wiki/Get ... enPoints3D
Feche1320 Posted January 9, 2011 Author Posted January 9, 2011 Nonon, for example, I make an object at X 0, Y 0, Z 0 and I want to check if the player is near that point.
SDK Posted January 9, 2011 Posted January 9, 2011 You could use colshapes for that: colShape = createColCircle(0,0,10) --radius=10 addEventHandler('onColShapeHit',colShape, function(element) if getElementType(element) == 'player' then outputChatBox('You are near the 0,0 point!', element) end end )
Scooby Posted January 9, 2011 Posted January 9, 2011 yes what i first posted would give you the distance from player to object as requested, local x1,y1,z1 = getElementPosition(player) local x2,y2,z2 = getElementPosition(object) local distance = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) but its quicker to just use a colshape as SDK suggested.
Feche1320 Posted January 9, 2011 Author Posted January 9, 2011 The problem is that I need Z height too.
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