Jump to content

Vehicle doors - stay open


Recommended Posts

Thanks, I know...But DoorOpenRatio is automaticly set to 0 (closed) when player enters vehicle.

So this does not work:

function startEnterVehicle ( playerseatjackeddoor ) --when a player enters a vehicle
    local vehicle = getPedOccupiedVehicle ( player )
    setVehicleDoorOpenRatio ( vehicle, seat + 210 ) -- open vehicle door
end
addEventHandler ( "onVehicleStartEnter"getRootElement(), startEnterVehicle) 
 
Edited by Killbean
Link to post
10 hours ago, Killbean said:

Thanks, I know...But DoorOpenRatio is automaticly set to 0 (closed) when player enters vehicle.

So this does not work:

function startEnterVehicle ( playerseatjackeddoor ) --when a player enters a vehicle
    local vehicle = getPedOccupiedVehicle ( player )
    setVehicleDoorOpenRatio ( vehicle, seat + 210 ) -- open vehicle door
end
addEventHandler ( "onVehicleStartEnter"getRootElement(), startEnterVehicle) 
 

Because this will work when the player is entering the vehicle not after
so use onPlayerVehicleEnter instead

Also, in MTA we have pre-defined variables
like getRootElement() you can use just root you can find them here
 

  • Like 1
Link to post
Posted (edited)

Thanks for discussion! I tried also onPlayerVehicleEnter, but this does not work either. Because default internal implementation of onVehicleStartEnter is that after some time elapsed the door will be closed.

Edited by Killbean
Link to post

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