Jump to content

Disable jumping from the vehicle windows


CastiaL

Recommended Posts

To make a specific vehicle (in this case, vehicle ID 480) open its doors like all other cars in MTASA, you can use the setVehicleHandling function to modify the "vehicleanim" attribute of the vehicle's  handling data. This attribute determines the animation that plays when the player enters or exits the vehicle, so setting it to a value that matches other cars in the game should make the doors open in a more conventional manner.

local vehicle = getVehicleByID(480)
local handling = getVehicleHandling(vehicle)
handling["vehicleanim"] = "SALOON_DoorSH_L"
setVehicleHandling(vehicle, handling)

 

Edited by Anoir Tizaoui
Link to comment
On 09/04/2023 at 16:57, CastiaL said:

character enters some vehicles by jumping from the window, how can we turn it off ?
for exp vehicle id: 480

function onVehicleStartEnter(player, seat, jacked)
    local vehicle = getPedOccupiedVehicle(player)
    if vehicle and getElementModel(vehicle) == 480 then
        cancelEvent()
        outputChatBox("You cannot enter this vehicle.")
    end
end
addEventHandler("onVehicleStartEnter", getRootElement(), onVehicleStartEnter)

 

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