Jump to content

Vehicle colliding issue.


GTX

Recommended Posts

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

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

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