GTX Posted April 13, 2013 Share Posted April 13, 2013 Hello. I have problem with colliding vehicles. Well, here's picture: http://shrani.si/f/33/5z/3ObG7iTG/mta-s ... 1400-2.png As you can see in the picture, vehicles can't collide correctly. Code: function col() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then for i,v in ipairs(getElementsByType("vehicle")) do setElementCollidableWith(vehicle, v, false) end end end addEventHandler("onClientRender", root, col) Link to comment
50p Posted April 13, 2013 Share Posted April 13, 2013 You haven't explained what you're trying to do. Besides, you don't have to change collidable state every frame. That's overkill. Link to comment
codeluaeveryday Posted April 14, 2013 Share Posted April 14, 2013 instead use this, because your code looks normal to the vehicle element, but not to the other element. function col() for k, z in ipairs(getElementsByType("vehicle")) do for i,v in ipairs(getElementsByType("vehicle")) do setElementCollidableWith(k, v, false) end end end addEventHandler("onClientRender", root, col) You probably should use setTimer, and make it every 500 ms. Link to comment
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