Jump to content

how to find closest world element?


Salem

Recommended Posts

Hi. I have something like this:

addCommandHandler( 'wrem', function( player, command, radius )
    if radius then radius = tonumber( radius ) else radius = 10 end
    local t = false;
    local x,y,z = getElementPosition( player )
    for i=500,20000 do
        t = removeWorldModel( i,radius, x, y, z )
        if t == true then
            outputChatBox( "[WREM] First object found: model "..i..", radius "..radius, player )
            break
        end
    end
    outputChatBox( "[WREM] Done.", player )
end )

This function should return first met object but it returns true for every iteration. I want to ask someone who really knows what's up - who knows how to find and call, for example, function used in editor which returns world object on click. I didn't study that code yet, so if someone can give some hint will be appreciated.

 

Link to comment

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...