Jump to content

getElementsWithinColShape is BUGGED.


Recommended Posts

outputChatBox(tostring(#getElementsWithinColShape(col,"vehicle")),root) 

The colshapes exists.

It is serverside.

It will always return 0, even though there are vehicles in colshape.

Wanna hear the funniest part? When I walk ingame near the colshape it gets normal and outputs the EXact ammount.

And I dont even enter colshape just Visual Contact! And also I am a player nott a vehicle

Is this a bug or what????? What can I use instead this bugged function

Link to comment

working fine for me , try to use sth like this

local count = 0 
function getElementsWithinColShapes() 
    local vehicles = getElementsByType ("vehicle") 
    for i, veh in pairs (vehicles) do 
        if (isElementWithinColShape(veh, col)) then 
            count = count + 1 
        end  
    end  
    return count 
end  

Link to comment
working fine for me , try to use sth like this
local count = 0 
function getElementsWithinColShapes() 
    local vehicles = getElementsByType ("vehicle") 
    for i, veh in pairs (vehicles) do 
        if (isElementWithinColShape(veh, col)) then 
            count = count + 1 
        end  
    end  
    return count 
end  

Thanks, but is getElementsWithinColShape working for you?

Really, I know you might think this is too weird, but the script detects the good ammount of vehicles if I got visual contact with the colShape... it's unbeliable..

Link to comment

Try this.

   
    function getElementsWithinColShapes() 
       local count = 0 
        local vehicles = getElementsByType ("vehicle") 
        for i, veh in pairs (vehicles) do 
            if (isElementWithinColShape(veh, col)) then 
                count = count + 1 
            end 
        end 
        return count 
    end  

Not much of a difference, but it resets count each time which could be your issue.

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