goodiewarrior Posted July 18, 2016 Posted July 18, 2016 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
Walid Posted July 18, 2016 Posted July 18, 2016 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
goodiewarrior Posted July 19, 2016 Author Posted July 19, 2016 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..
Captain Cody Posted July 24, 2016 Posted July 24, 2016 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.
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