Jump to content

Getting player range.


Feche1320

Recommended Posts

Posted

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 
)  

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...