Jump to content

getElementsWithinColShape is BUGGED.


Recommended Posts

Posted
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

Posted

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  

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

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

Posted

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.

Wolf Inc Discord

Youtube channel
Github

  • Moderators
Posted

Vehicles are also serverside?

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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