Killbean Posted February 28, 2021 Share Posted February 28, 2021 Hello guys, I am hoping someone here can help me to do imposible task. I need vehicle doors to stay open after I enter vehicle. How to do it? Does somebody knows? Thank you very much! Link to comment
Moderators Patrick Posted February 28, 2021 Moderators Share Posted February 28, 2021 You can change door's rotation with setVehicleDoorOpenRatio. Also here is a resource. 1 Link to comment
Killbean Posted February 28, 2021 Author Share Posted February 28, 2021 (edited) Thanks, I know...But DoorOpenRatio is automaticly set to 0 (closed) when player enters vehicle. So this does not work: function startEnterVehicle ( player, seat, jacked, door ) --when a player enters a vehicle local vehicle = getPedOccupiedVehicle ( player ) setVehicleDoorOpenRatio ( vehicle, seat + 2, 1, 0 ) -- open vehicle door end addEventHandler ( "onVehicleStartEnter", getRootElement(), startEnterVehicle) Edited February 28, 2021 by Killbean Link to comment
Scripting Moderators xLive Posted March 1, 2021 Scripting Moderators Share Posted March 1, 2021 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 ( player, seat, jacked, door ) --when a player enters a vehicle local vehicle = getPedOccupiedVehicle ( player ) setVehicleDoorOpenRatio ( vehicle, seat + 2, 1, 0 ) -- 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 1 Link to comment
Killbean Posted March 1, 2021 Author Share Posted March 1, 2021 (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 March 1, 2021 by Killbean Link to comment
Killbean Posted March 1, 2021 Author Share Posted March 1, 2021 So progress! I tried onPlayerVehicleEnter again. When player enters vehicle he closes door and then onPlayerVehicleEnter opens it. I need to remove closing door animation when player enters vehicle. 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