Feche1320 Posted January 9, 2011 Share Posted January 9, 2011 Is there a function that retrieves the player range from a specific cord? Thanks Link to comment
Scooby Posted January 9, 2011 Share 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 Link to comment
Feche1320 Posted January 9, 2011 Author Share 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. Link to comment
SDK Posted January 9, 2011 Share 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 ) Link to comment
Scooby Posted January 9, 2011 Share 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. Link to comment
Feche1320 Posted January 9, 2011 Author Share Posted January 9, 2011 The problem is that I need Z height too. Link to comment
SDK Posted January 9, 2011 Share Posted January 9, 2011 Then use createColSphere(0,0,0,10) 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